diff --git a/db/db.go b/db/db.go index afd30590f..683e3ba62 100644 --- a/db/db.go +++ b/db/db.go @@ -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) } @@ -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 := "" @@ -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 := "" diff --git a/handlers/people.go b/handlers/people.go index 64bc71368..4d2a92db7 100644 --- a/handlers/people.go +++ b/handlers/people.go @@ -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 diff --git a/routes/people.go b/routes/people.go index c852da74f..2ed0bfa85 100644 --- a/routes/people.go +++ b/routes/people.go @@ -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)