(w http.ResponseWriter, r *http.Request)
| 153 | } |
| 154 | |
| 155 | func (h *handler) getOrder(w http.ResponseWriter, r *http.Request) { |
| 156 | claims := r.Context().Value(authKey{}).(*token.UserClaims) |
| 157 | |
| 158 | order, err := h.client.GetOrder(h.ctx, &pb.OrderReq{ |
| 159 | UserId: claims.ID, |
| 160 | }) |
| 161 | if err != nil { |
| 162 | http.Error(w, "internal server error", http.StatusInternalServerError) |
| 163 | return |
| 164 | } |
| 165 | |
| 166 | res := toOrderRes(order) |
| 167 | w.Header().Set("Content-Type", "application/json") |
| 168 | json.NewEncoder(w).Encode(res) |
| 169 | } |
| 170 | |
| 171 | func (h *handler) listOrders(w http.ResponseWriter, r *http.Request) { |
| 172 | orders, err := h.client.ListOrders(h.ctx, &pb.OrderReq{}) |
nothing calls this directly
no test coverage detected