You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
874 B
35 lines
874 B
1 year ago
|
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,
|
||
|
}
|
||
|
}
|