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.
50 lines
1.6 KiB
50 lines
1.6 KiB
1 year ago
|
package request
|
||
|
|
||
|
import (
|
||
|
"sorbet/internal/entities"
|
||
|
)
|
||
|
|
||
1 year ago
|
type CompanyEmployeeUpsertRequest struct {
|
||
1 year ago
|
ID uint `json:"id" xml:"id" form:"id" path:"id"`
|
||
|
CompanyID uint `json:"company_id" xml:"company_id" form:"company_id"`
|
||
|
Name string `json:"name" xml:"name" form:"name"`
|
||
|
Gender string `json:"gender" xml:"gender" form:"gender"`
|
||
|
Position string `json:"position" xml:"position" form:"position"`
|
||
|
PhoneNumber string `json:"phone_number" xml:"phone_number" form:"phone_number"`
|
||
|
WechatOpenid string `json:"wechat_openid" xml:"wechat_openid" form:"wechat_openid"`
|
||
|
WithoutStudy bool `json:"without_study" xml:"without_study" form:"without_study"`
|
||
|
IsAdmin bool `json:"is_admin" xml:"is_admin" form:"is_admin"`
|
||
|
}
|
||
|
|
||
1 year ago
|
func (c *CompanyEmployeeUpsertRequest) GetID() any {
|
||
1 year ago
|
return c.ID
|
||
|
}
|
||
|
|
||
1 year ago
|
func (c *CompanyEmployeeUpsertRequest) ToMap() map[string]any {
|
||
1 year ago
|
return map[string]any{
|
||
|
"id": c.ID,
|
||
|
"company_id": c.CompanyID,
|
||
|
"name": c.Name,
|
||
|
"gender": c.Gender,
|
||
|
"position": c.Position,
|
||
|
"phone_number": c.PhoneNumber,
|
||
|
"wechat_openid": c.WechatOpenid,
|
||
|
"without_study": c.WithoutStudy,
|
||
|
"is_admin": c.IsAdmin,
|
||
|
}
|
||
|
}
|
||
|
|
||
1 year ago
|
func (c *CompanyEmployeeUpsertRequest) ToEntity() any {
|
||
|
return &entities.CompanyEmployee{
|
||
1 year ago
|
ID: c.ID,
|
||
|
CompanyID: c.CompanyID,
|
||
|
Name: c.Name,
|
||
|
Gender: c.Gender,
|
||
|
Position: c.Position,
|
||
|
PhoneNumber: c.PhoneNumber,
|
||
|
WechatOpenid: c.WechatOpenid,
|
||
|
WithoutStudy: c.WithoutStudy,
|
||
|
IsAdmin: c.IsAdmin,
|
||
|
}
|
||
|
}
|