mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 23:35:43 +00:00
FIX(BE): category dto do not show
This commit is contained in:
@@ -219,8 +219,8 @@ func (s *projectflockService) CreateOne(c *fiber.Ctx, req *validation.Create) (*
|
||||
return nil, err
|
||||
}
|
||||
|
||||
category, ok := utils.NormalizeProjectFlockCategory(req.Category)
|
||||
if !ok {
|
||||
cat := strings.ToUpper(req.Category)
|
||||
if !utils.IsValidProjectFlockCategory(cat) {
|
||||
return nil, fiber.NewError(fiber.StatusBadRequest, "Invalid category")
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ func (s *projectflockService) CreateOne(c *fiber.Ctx, req *validation.Create) (*
|
||||
createBody := &entity.ProjectFlock{
|
||||
FlockId: req.FlockId,
|
||||
AreaId: req.AreaId,
|
||||
Category: string(category),
|
||||
Category: cat,
|
||||
FcrId: req.FcrId,
|
||||
LocationId: req.LocationId,
|
||||
CreatedBy: 1,
|
||||
@@ -342,11 +342,12 @@ func (s projectflockService) UpdateOne(c *fiber.Ctx, req *validation.Update, id
|
||||
})
|
||||
}
|
||||
if req.Category != nil {
|
||||
if normalized, ok := utils.NormalizeProjectFlockCategory(*req.Category); ok {
|
||||
updateBody["category"] = string(normalized)
|
||||
} else {
|
||||
cat := strings.ToUpper(*req.Category)
|
||||
if !utils.IsValidProjectFlockCategory(cat) {
|
||||
return nil, fiber.NewError(fiber.StatusBadRequest, "Invalid category")
|
||||
}
|
||||
|
||||
updateBody["category"] = cat
|
||||
}
|
||||
if req.FcrId != nil {
|
||||
updateBody["fcr_id"] = *req.FcrId
|
||||
|
||||
Reference in New Issue
Block a user