enhance(user):为用户模型增加Json键定义。

This commit is contained in:
徐涛 2023-06-02 10:18:16 +08:00
parent 04dc9c51aa
commit 919883f521

View File

@ -13,14 +13,14 @@ const (
) )
type ManagementAccountCreationForm struct { type ManagementAccountCreationForm struct {
Id *string Id *string `json:"id"`
Username string Username string `json:"username"`
Name string Name string `json:"name"`
Contact *string Contact *string `json:"contact"`
Phone *string Phone *string `json:"phone"`
Type int16 `json:"type"` Type int16 `json:"type"`
Enabled bool Enabled bool `json:"enabled"`
Expires Date Expires Date `json:"expires"`
} }
func (m ManagementAccountCreationForm) IntoUser() *User { func (m ManagementAccountCreationForm) IntoUser() *User {
@ -56,58 +56,58 @@ func (m ManagementAccountCreationForm) IntoUserDetail() *UserDetail {
} }
type UserModificationForm struct { type UserModificationForm struct {
Name string Name string `json:"name"`
Region *string Region *string `json:"region"`
Address *string Address *string `json:"address"`
Contact *string Contact *string `json:"contact"`
Phone *string Phone *string `json:"phone"`
UnitServiceFee *decimal.Decimal UnitServiceFee *decimal.Decimal `json:"unitServiceFee"`
} }
type User struct { type User struct {
Id string Id string `json:"id"`
Username string Username string `json:"username"`
Password string Password string `json:"password"`
ResetNeeded bool ResetNeeded bool `json:"resetNeeded"`
UserType int16 `db:"type"` UserType int16 `db:"type"`
Enabled bool Enabled bool `json:"enabled"`
CreatedAt *time.Time CreatedAt *time.Time `json:"createdAt"`
} }
type UserDetail struct { type UserDetail struct {
Id string Id string `json:"id"`
Name *string Name *string `json:"name"`
Abbr *string Abbr *string `json:"abbr"`
Region *string Region *string `json:"region"`
Address *string Address *string `json:"address"`
Contact *string Contact *string `json:"contact"`
Phone *string Phone *string `json:"phone"`
UnitServiceFee decimal.Decimal `db:"unit_service_fee"` UnitServiceFee decimal.Decimal `db:"unit_service_fee" json:"unitServiceFee"`
ServiceExpiration Date ServiceExpiration Date `json:"serviceExpiration"`
CreatedAt time.Time CreatedAt time.Time `json:"createdAt"`
CreatedBy *string CreatedBy *string `json:"createdBy"`
LastModifiedAt time.Time LastModifiedAt time.Time `json:"lastModifiedAt"`
LastModifiedBy *string LastModifiedBy *string `json:"lastModifiedBy"`
DeletedAt *time.Time DeletedAt *time.Time `json:"deletedAt"`
DeletedBy *string DeletedBy *string `json:"deletedBy"`
} }
type UserWithDetail struct { type UserWithDetail struct {
Id string Id string `json:"id"`
Username string Username string `json:"username"`
ResetNeeded bool ResetNeeded bool `json:"resetNeeded"`
UserType int16 `db:"type"` UserType int16 `db:"type" json:"type"`
Enabled bool Enabled bool `json:"enabled"`
Name *string Name *string `json:"name"`
Abbr *string Abbr *string `json:"abbr"`
Region *string Region *string `json:"region"`
Address *string Address *string `json:"address"`
Contact *string Contact *string `json:"contact"`
Phone *string Phone *string `json:"phone"`
UnitServiceFee decimal.Decimal `db:"unit_service_fee"` UnitServiceFee decimal.Decimal `db:"unit_service_fee" json:"unitServiceFee"`
ServiceExpiration Date ServiceExpiration Date `json:"serviceExpiration"`
CreatedAt time.Time CreatedAt time.Time `json:"createdAt"`
CreatedBy *string CreatedBy *string `json:"createdBy"`
LastModifiedAt time.Time LastModifiedAt time.Time `json:"lastModifiedAt"`
LastModifiedBy *string LastModifiedBy *string `json:"lastModifiedBy"`
} }