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, } }