self-order+notification #5
@ -54,7 +54,7 @@ type SelfOrderCreateOrderItem struct {
|
||||
}
|
||||
|
||||
type SelfOrderListCategoriesRequest struct {
|
||||
TableID uuid.UUID `form:"table_id" validate:"required"`
|
||||
TableID string `form:"table_id" validate:"required"`
|
||||
}
|
||||
|
||||
type SelfOrderCategoryItem struct {
|
||||
|
||||
@ -308,14 +308,22 @@ func (h *SelfOrderHandler) ListCategories(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if req.TableID == uuid.Nil {
|
||||
if req.TableID == "" {
|
||||
util.HandleResponse(c.Writer, c.Request, contract.BuildErrorResponse([]*contract.ResponseError{
|
||||
contract.NewResponseError(constants.MissingFieldErrorCode, constants.RequestEntity, "table_id is required"),
|
||||
}), "SelfOrderHandler::ListCategories")
|
||||
return
|
||||
}
|
||||
|
||||
table, err := h.tableRepo.GetByID(ctx, req.TableID)
|
||||
parsedTableID, err := uuid.Parse(req.TableID)
|
||||
if err != nil {
|
||||
util.HandleResponse(c.Writer, c.Request, contract.BuildErrorResponse([]*contract.ResponseError{
|
||||
contract.NewResponseError(constants.ValidationErrorCode, constants.RequestEntity, "table_id must be a valid UUID"),
|
||||
}), "SelfOrderHandler::ListCategories")
|
||||
return
|
||||
}
|
||||
|
||||
table, err := h.tableRepo.GetByID(ctx, parsedTableID)
|
||||
if err != nil {
|
||||
logger.FromContext(ctx).WithError(err).Error("SelfOrderHandler::ListCategories -> table not found")
|
||||
util.HandleResponse(c.Writer, c.Request, contract.BuildErrorResponse([]*contract.ResponseError{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user