Skip to content

Commit

Permalink
fix(faucet): CanGetFaucet method fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mj committed Jun 17, 2024
1 parent 237ae54 commit 5a3784f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/repository/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ func (db *DB) AddFaucet(f *entity.PhoenixFaucet) error {

func (db *DB) CanGetFaucet(user *entity.User) bool {
var lastFaucet entity.PhoenixFaucet
tx := db.Model(&entity.PhoenixFaucet{}).
Last(&lastFaucet, "user_id = ?", user.ID)
if tx.Error != nil {
err := db.Model(&entity.PhoenixFaucet{}).Where("user_id = ?", user.ID).Order("id DESC").First(&lastFaucet).Error
if err != nil {
return true
}

Expand Down

0 comments on commit 5a3784f

Please sign in to comment.