package request import ( "sorbet/internal/entities" "sorbet/pkg/db" ) type ConfigGroupUpsertRequest struct { ID uint `json:"id" xml:"id" path:"id"` Name string `json:"name" xml:"name" form:"name"` Description string `json:"description" xml:"description" form:"description"` Sort int32 `json:"sort" xml:"sort" form:"sort"` } func (c *ConfigGroupUpsertRequest) GetID() any { return c.ID } func (c *ConfigGroupUpsertRequest) ToEntity() *entities.ConfigGroup { return &entities.ConfigGroup{ Name: c.Name, Description: c.Description, Sort: c.Sort, Version: db.Version{Int64: 1, Valid: true}, } } func (c *ConfigGroupUpsertRequest) ToMap() map[string]any { return map[string]any{ "name": c.Name, "description": c.Description, "sort": c.Sort, } }