package endpoints import ( "encoding/json" "net/http" . "github.com/imosed/signet/data" "github.com/rs/zerolog/log" ) type QueueMember struct { ID uint `json:"id"` Asset string `json:"asset"` Order int `json:"order"` } type GetQueueMembersRequest struct { ID uint `json:"id"` } type GetQueueMembersResponse struct { Members []QueueMember `json:"members"` } func GetQueueMembers(w http.ResponseWriter, r *http.Request) { var req GetQueueMembersRequest err := json.NewDecoder(r.Body).Decode(&req) if err != nil { log.Error().Err(err).Msg("Could not decode body in GetQueueMembers call") return } var members []QueueMember Db.Table("queue_orders qo").Select("rf.id, asset, qo.order"). Where("queue_id = ?", req.ID). Joins("inner join reward_funds rf on qo.reward_fund_id = rf.id"). Order("qo.order"). Scan(&members) var resp GetQueueMembersResponse resp.Members = members err = json.NewEncoder(w).Encode(resp) if err != nil { log.Error().Err(err).Msg("Could not deliver response in GetQueueMembers call") } }