fix: small bug
This commit is contained in:
parent
6a341da9b3
commit
ddf55763d2
|
|
@ -116,7 +116,7 @@ WHERE bet_id = $1;
|
|||
-- name: GetBetCount :one
|
||||
SELECT COUNT(*)
|
||||
FROM bets
|
||||
where user_id = $1
|
||||
WHERE user_id = $1
|
||||
AND outcomes_hash = $2;
|
||||
-- name: UpdateCashOut :exec
|
||||
UPDATE bets
|
||||
|
|
|
|||
|
|
@ -133,9 +133,10 @@ func convertCreateBet(bet domain.CreateBet) dbgen.CreateBetParams {
|
|||
Int64: bet.UserID.Value,
|
||||
Valid: bet.UserID.Valid,
|
||||
},
|
||||
IsShopBet: bet.IsShopBet,
|
||||
CashoutID: bet.CashoutID,
|
||||
FastCode: bet.FastCode,
|
||||
IsShopBet: bet.IsShopBet,
|
||||
CashoutID: bet.CashoutID,
|
||||
OutcomesHash: bet.OutcomesHash,
|
||||
FastCode: bet.FastCode,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -294,7 +295,7 @@ func (s *Store) GetBetByFastCode(ctx context.Context, fastcode string) (domain.G
|
|||
|
||||
func (s *Store) GetBetCount(ctx context.Context, UserID int64, outcomesHash string) (int64, error) {
|
||||
count, err := s.queries.GetBetCount(ctx, dbgen.GetBetCountParams{
|
||||
UserID: pgtype.Int8{Int64: UserID},
|
||||
UserID: pgtype.Int8{Int64: UserID, Valid: true},
|
||||
OutcomesHash: outcomesHash,
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ func (s *Service) PlaceBet(ctx context.Context, req domain.CreateBetReq, userID
|
|||
if err != nil {
|
||||
return domain.CreateBetRes{}, err
|
||||
}
|
||||
if count == 2 {
|
||||
if count >= 2 {
|
||||
return domain.CreateBetRes{}, fmt.Errorf("bet already pleaced twice")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package odds
|
||||
package odds
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user