package endpoints import ( "encoding/json" . "github.com/imosed/signet/data" "net/http" ) type QueueMember struct { Asset string `json:"asset"` Title string `json:"title"` } 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 { panic("Could not decode body") } var members []QueueMember Db.Table("queue_orders qo").Select("reward_fund_id, asset, title").Where("queue_id = ?", req.ID). Joins("inner join reward_funds rf on qo.reward_fund_id = rf.id"). Scan(&members) var resp GetQueueMembersResponse resp.Members = members err = json.NewEncoder(w).Encode(resp) if err != nil { panic("Could not deliver response") } }