feat: require brand description in create and update operations, add validation messages
Frontend CI / Frontend (push) Successful in 4m25s
Backend CI / Backend (push) Successful in 15m23s

This commit is contained in:
2026-06-09 14:09:05 +08:00
parent a6d203a300
commit 41f5623791
9 changed files with 148 additions and 25 deletions
@@ -123,6 +123,9 @@ func (s *BrandService) Create(ctx context.Context, req BrandRequest) (*BrandResp
if req.Name == "" {
return nil, response.ErrBadRequest(40001, "invalid_params", "name is required")
}
if req.Description == nil {
return nil, response.ErrBadRequest(40002, "brand_description_required", "description is required")
}
summary, err := s.loadBrandLibrarySummary(ctx, actor.TenantID)
if err != nil {
@@ -218,6 +221,9 @@ func (s *BrandService) Update(ctx context.Context, id int64, req BrandRequest) e
if req.Name == "" {
return response.ErrBadRequest(40001, "invalid_params", "name is required")
}
if req.Description == nil {
return response.ErrBadRequest(40002, "brand_description_required", "description is required")
}
tag, err := s.pool.Exec(ctx, `
UPDATE brands SET name = $1, website = $2, description = $3, updated_at = NOW()
WHERE id = $4 AND tenant_id = $5 AND deleted_at IS NULL