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.
39 lines
1.0 KiB
39 lines
1.0 KiB
package request
|
|
|
|
import (
|
|
"sorbet/internal/entities"
|
|
"sorbet/pkg/db"
|
|
)
|
|
|
|
type CompanyUpsertRequest struct {
|
|
ID uint `json:"id" xml:"id" form:"id" path:"id"`
|
|
PrincipalID uint `json:"principal_id" xml:"principal_id" form:"principal_id"`
|
|
Name string `json:"name" xml:"name" form:"name"`
|
|
Logo string `json:"logo" xml:"logo" form:"logo"`
|
|
Status bool `json:"status" xml:"status" form:"status"`
|
|
}
|
|
|
|
func (r *CompanyUpsertRequest) GetID() any {
|
|
return r.ID
|
|
}
|
|
|
|
func (r *CompanyUpsertRequest) ToEntity() *entities.Company {
|
|
return &entities.Company{
|
|
ID: r.ID,
|
|
PrincipalID: &r.PrincipalID,
|
|
Name: r.Name,
|
|
Logo: r.Logo,
|
|
Status: r.Status,
|
|
Version: db.Version{Int64: 1, Valid: true},
|
|
}
|
|
}
|
|
|
|
func (r *CompanyUpsertRequest) ToMap() map[string]any {
|
|
return map[string]any{
|
|
"id": r.ID,
|
|
"principal_id": r.PrincipalID,
|
|
"name": r.Name,
|
|
"logo": r.Logo,
|
|
"status": r.Status,
|
|
}
|
|
}
|
|
|