Skip to content

Commit

Permalink
Merge pull request stakwork#1508 from stakwork/feat/change_count_tabs
Browse files Browse the repository at this point in the history
Feat/change count tabs
  • Loading branch information
elraphty authored Feb 13, 2024
2 parents 2811e42 + 89b4b4e commit 1cc053c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
12 changes: 8 additions & 4 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,9 @@ func (db database) GetUserBountiesCount(personKey string, tabType string) int64
var count int64

query := db.db.Model(&Bounty{})
if tabType == "wanted" {
if tabType == "bounties" {
query.Where("owner_id", personKey)
} else if tabType == "usertickets" {
} else if tabType == "assigned" {
query.Where("assignee", personKey)
}

Expand Down Expand Up @@ -658,7 +658,9 @@ func (db database) GetOrganizationBounties(r *http.Request, org_uuid string) []B

func (db database) GetAssignedBounties(r *http.Request) ([]Bounty, error) {
offset, limit, sortBy, direction, _ := utils.GetPaginationParams(r)
pubkey := chi.URLParam(r, "pubkey")
uuid := chi.URLParam(r, "uuid")
person := db.GetPersonByUuid(uuid)
pubkey := person.OwnerPubKey

orderQuery := ""
limitQuery := ""
Expand All @@ -682,7 +684,9 @@ func (db database) GetAssignedBounties(r *http.Request) ([]Bounty, error) {

func (db database) GetCreatedBounties(r *http.Request) ([]Bounty, error) {
offset, limit, sortBy, direction, _ := utils.GetPaginationParams(r)
pubkey := chi.URLParam(r, "pubkey")
uuid := chi.URLParam(r, "uuid")
person := db.GetPersonByUuid(uuid)
pubkey := person.OwnerPubKey

orderQuery := ""
limitQuery := ""
Expand Down
1 change: 1 addition & 0 deletions handlers/people.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ func GetPersonByUuid(w http.ResponseWriter, r *http.Request) {
personResponse := make(map[string]interface{})
personResponse["id"] = person.ID
personResponse["uuid"] = person.Uuid
personResponse["owner_pubkey"] = person.OwnerPubKey
personResponse["owner_alias"] = person.OwnerAlias
personResponse["unique_name"] = person.UniqueName
personResponse["description"] = person.Description
Expand Down
4 changes: 2 additions & 2 deletions routes/people.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ func PeopleRoutes() chi.Router {
r.Get("/", handlers.GetListedPeople)
r.Get("/search", handlers.GetPeopleBySearch)
r.Get("/posts", handlers.GetListedPosts)
r.Get("/wanteds/assigned/{pubkey}", handlers.GetPersonAssignedBounties)
r.Get("/wanteds/created/{pubkey}", handlers.GetPersonCreatedBounties)
r.Get("/wanteds/assigned/{uuid}", handlers.GetPersonAssignedBounties)
r.Get("/wanteds/created/{uuid}", handlers.GetPersonCreatedBounties)
r.Get("/wanteds/header", handlers.GetWantedsHeader)
r.Get("/short", handlers.GetPeopleShortList)
r.Get("/offers", handlers.GetListedOffers)
Expand Down

0 comments on commit 1cc053c

Please sign in to comment.