MCPcopy Index your code
hub / github.com/53AI/53AIHub / GetOrder

Function GetOrder

api/controller/order.go:211–228  ·  view source on GitHub ↗

GetOrder gets an order by ID @Summary Get order @Description Get an order by ID @Tags Order @Accept json @Produce json @Security BearerAuth @Param id path int true "Order ID" @Success 200 {object} model.CommonResponse{data=model.Order} @Router /api/orders/{id} [get]

(c *gin.Context)

Source from the content-addressed store, hash-verified

209// @Success 200 {object} model.CommonResponse{data=model.Order}
210// @Router /api/orders/{id} [get]
211func GetOrder(c *gin.Context) {
212 id, err := strconv.ParseInt(c.Param("id"), 10, 64)
213 if err != nil {
214 c.JSON(http.StatusBadRequest, model.ParamError.ToResponse("Invalid ID"))
215 return
216 }
217
218 eid := config.GetEID(c)
219
220 // Get order
221 order, err := model.GetOrderByID(eid, id)
222 if err != nil {
223 c.JSON(http.StatusNotFound, model.NotFound.ToNewErrorResponse(model.OrderNotFound))
224 return
225 }
226
227 c.JSON(http.StatusOK, model.Success.ToResponse(order))
228}
229
230// GetUserOrders gets orders for the current user
231// @Summary Get user orders

Callers

nothing calls this directly

Calls 3

ToResponseMethod · 0.80
GetEIDMethod · 0.80
ToNewErrorResponseMethod · 0.80

Tested by

no test coverage detected