Skip to content

Commit 34a4f6c

Browse files
committed
fix: filter deleted_at rows
1 parent 35d3933 commit 34a4f6c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

model/rank/action.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func UpdateRank(id int64, updates map[string]interface{}) error {
6666
}
6767

6868
func SearchRank(query string, pageSize int) (ranks []Rank, err error) {
69-
db := load.GetDB().Where("to_tsvector('zh', unique_key || ' ' || name) @@ to_tsquery('zh', ?)", query)
69+
db := load.GetDB().Where("to_tsvector('zh', unique_key || ' ' || name) @@ to_tsquery('zh', ?) AND deleted_at IS NULL", query)
7070
if err := db.Limit(pageSize).Find(&ranks).Error; err != nil {
7171
return ranks, err
7272
}
@@ -143,7 +143,7 @@ func UpdateRankGroup(id int64, updates map[string]interface{}) error {
143143
}
144144

145145
func ListAllRank() (ranks []Rank, err error) {
146-
db := load.GetDB().Order("created_at DESC")
146+
db := load.GetDB().Where("deleted_at IS NULL").Order("created_at DESC")
147147
if err := db.Find(&ranks).Error; err != nil {
148148
return ranks, err
149149
}

0 commit comments

Comments
 (0)