Skip to content

Commit

Permalink
Merge branch 'stakwork:master' into Refactor-TestGetListedBots-UT
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdulWahab3181 authored Jun 25, 2024
2 parents 4cb68e5 + c901d7a commit b77d526
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 85 deletions.
1 change: 1 addition & 0 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,7 @@ func (db database) SearchBots(s string, limit, offset int) []BotRes {
// set limit
limitStr := strconv.Itoa(limit)
offsetStr := strconv.Itoa(offset)
s = strings.ReplaceAll(s, " ", " & ")
db.db.Raw(
`SELECT uuid, owner_pub_key, name, unique_name, img, description, tags, price_per_use, ts_rank(tsv, q) as rank
FROM bots, to_tsquery(?) q
Expand Down
3 changes: 2 additions & 1 deletion db/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type Bot struct {
Deleted bool `json:"deleted"`
MemberCount uint64 `json:"member_count"`
OwnerRouteHint string `json:"owner_route_hint"`
Tsv string `gorm:"type:tsvector"`
}

// Bot struct
Expand All @@ -73,7 +74,7 @@ type BotRes struct {
Name string `json:"name"`
UniqueName string `json:"unique_name"`
Description string `json:"description"`
Tags pq.StringArray `json:"tags"`
Tags pq.StringArray `gorm:"type:text[]" json:"tags"`
Img string `json:"img"`
PricePerUse int64 `json:"price_per_use"`
}
Expand Down
Loading

0 comments on commit b77d526

Please sign in to comment.