feat: add description and sequence fields to Category model and update request struct

This commit is contained in:
Ardeman 2025-03-07 23:41:54 +08:00
parent 479703dfd0
commit 68f33d101b
2 changed files with 17 additions and 11 deletions

View File

@ -8,6 +8,8 @@ type Category struct {
ID string `json:"id" gorm:"primaryKey"`
Name string `json:"name"`
Code string `json:"code"`
Description string `json:"description"`
Sequence int `json:"sequence"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
@ -15,4 +17,6 @@ type Category struct {
type CategoryReq struct {
Name string `json:"name" validate:"required"`
Code string `json:"code" validate:"required"`
Description string `json:"description"`
Sequence int `json:"sequence"`
}

View File

@ -10,6 +10,8 @@ func (i *impl) Update(categoryID string, spec categorydomain.CategoryReq) error
ID: categoryID,
Name: spec.Name,
Code: spec.Code,
Description: spec.Description,
Sequence: spec.Sequence,
UpdatedAt: timeutils.Now(),
}