fix: Code for category
This commit is contained in:
@@ -34,12 +34,13 @@ func (h *CategoryHandler) Register(r chi.Router) {
|
||||
|
||||
type categoryRequest struct {
|
||||
ParentID *string `json:"parent_id" validate:"omitempty,uuid"`
|
||||
Code string `json:"code" validate:"required,max=255,slug"`
|
||||
Name string `json:"name" validate:"required,max=255"`
|
||||
Description string `json:"description" validate:"max=2000"`
|
||||
}
|
||||
|
||||
func (r categoryRequest) toInput() (service.CategoryInput, error) {
|
||||
in := service.CategoryInput{Name: r.Name, Description: r.Description}
|
||||
in := service.CategoryInput{Code: r.Code, Name: r.Name, Description: r.Description}
|
||||
if r.ParentID != nil {
|
||||
id, err := uuid.Parse(*r.ParentID)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user