Skip to content

Commit

Permalink
refactor: adding error handling to createAuctionUsecase
Browse files Browse the repository at this point in the history
  • Loading branch information
henriquemarlon committed Oct 14, 2024
1 parent 94ab31a commit 33cc440
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/usecase/auction_usecase/create_auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func (c *CreateAuctionUseCase) Execute(input *CreateAuctionInputDTO, metadata ro
return nil, err
}
auctions, err := c.AuctionRepository.FindAuctionsByCreator(creator.Username)
if err != nil {
return nil, err
}
for _, auction := range auctions {
if auction.State == entity.AuctionOngoing || auction.State == entity.AuctionFinished {
return nil, fmt.Errorf("creator already has an non paid auction")
Expand Down

0 comments on commit 33cc440

Please sign in to comment.