Skip to content

Commit

Permalink
chore: not include pending items
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing committed Oct 23, 2023
1 parent 5f4628d commit fc75a77
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
Expand Down
13 changes: 6 additions & 7 deletions dao/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"context"
"fmt"
"github.com/bnb-chain/mind-marketplace-backend/database"
"github.com/shopspring/decimal"
"gorm.io/gorm"
)

const (
Expand Down Expand Up @@ -74,8 +72,8 @@ func (dao *dbItemDao) Get(context context.Context, id int64, includeAll bool) (d
return item, err
}
} else {
if err := dao.db.Preload("Stats").Where("id = ? and status <> ? and status <> ?",
id, database.ItemBlocked, database.ItemDelisted).Take(&item).Error; err != nil {
if err := dao.db.Preload("Stats").Where("id = ? and status <> ? and status <> ? and status <> ?",
id, database.ItemBlocked, database.ItemDelisted, database.ItemPending).Take(&item).Error; err != nil {
return item, err
}
}
Expand All @@ -89,8 +87,8 @@ func (dao *dbItemDao) GetByGroupId(context context.Context, groupId int64, inclu
return item, err
}
} else {
if err := dao.db.Preload("Stats").Where("group_id = ? and status <> ? and status <> ?",
groupId, database.ItemBlocked, database.ItemDelisted).Take(&item).Error; err != nil {
if err := dao.db.Preload("Stats").Where("group_id = ? and status <> ? and status <> ? and status <> ?",
groupId, database.ItemBlocked, database.ItemDelisted, database.ItemPending).Take(&item).Error; err != nil {
return item, err
}
}
Expand All @@ -112,9 +110,10 @@ func (dao *dbItemDao) Search(context context.Context, address, keyword string, i
}

if !includeAll {
rawSql = rawSql + ` and status not in ( ?, ? ) `
rawSql = rawSql + ` and status not in ( ?, ?, ?) `
parameters = append(parameters, database.ItemDelisted)
parameters = append(parameters, database.ItemBlocked)
parameters = append(parameters, database.ItemPending)
}

countSql := "select count(1) from items " + rawSql
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/bnb-chain/greenfield-go-sdk v0.2.6
github.com/cometbft/cometbft v0.37.2
github.com/coocood/freecache v1.2.4
github.com/cosmos/cosmos-sdk v0.47.3
github.com/ethereum/go-ethereum v1.10.26
github.com/go-openapi/errors v0.20.4
github.com/go-openapi/loads v0.21.2
Expand Down Expand Up @@ -58,7 +59,6 @@ require (
github.com/consensys/gnark-crypto v0.10.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect
github.com/cosmos/cosmos-sdk v0.47.3 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogoproto v1.4.10 // indirect
github.com/cosmos/iavl v0.20.0 // indirect
Expand Down

0 comments on commit fc75a77

Please sign in to comment.