forked from free-lancers/electricity_bill_calc_service
		
	enhance(user):为用户模型增加Json键定义。
This commit is contained in:
		
							
								
								
									
										106
									
								
								model/user.go
									
									
									
									
									
								
							
							
						
						
									
										106
									
								
								model/user.go
									
									
									
									
									
								
							| @@ -13,14 +13,14 @@ const ( | ||||
| ) | ||||
|  | ||||
| type ManagementAccountCreationForm struct { | ||||
| 	Id       *string | ||||
| 	Username string | ||||
| 	Name     string | ||||
| 	Contact  *string | ||||
| 	Phone    *string | ||||
| 	Type     int16 `json:"type"` | ||||
| 	Enabled  bool | ||||
| 	Expires  Date | ||||
| 	Id       *string `json:"id"` | ||||
| 	Username string  `json:"username"` | ||||
| 	Name     string  `json:"name"` | ||||
| 	Contact  *string `json:"contact"` | ||||
| 	Phone    *string `json:"phone"` | ||||
| 	Type     int16   `json:"type"` | ||||
| 	Enabled  bool    `json:"enabled"` | ||||
| 	Expires  Date    `json:"expires"` | ||||
| } | ||||
|  | ||||
| func (m ManagementAccountCreationForm) IntoUser() *User { | ||||
| @@ -56,58 +56,58 @@ func (m ManagementAccountCreationForm) IntoUserDetail() *UserDetail { | ||||
| } | ||||
|  | ||||
| type UserModificationForm struct { | ||||
| 	Name           string | ||||
| 	Region         *string | ||||
| 	Address        *string | ||||
| 	Contact        *string | ||||
| 	Phone          *string | ||||
| 	UnitServiceFee *decimal.Decimal | ||||
| 	Name           string           `json:"name"` | ||||
| 	Region         *string          `json:"region"` | ||||
| 	Address        *string          `json:"address"` | ||||
| 	Contact        *string          `json:"contact"` | ||||
| 	Phone          *string          `json:"phone"` | ||||
| 	UnitServiceFee *decimal.Decimal `json:"unitServiceFee"` | ||||
| } | ||||
|  | ||||
| type User struct { | ||||
| 	Id          string | ||||
| 	Username    string | ||||
| 	Password    string | ||||
| 	ResetNeeded bool | ||||
| 	UserType    int16 `db:"type"` | ||||
| 	Enabled     bool | ||||
| 	CreatedAt   *time.Time | ||||
| 	Id          string     `json:"id"` | ||||
| 	Username    string     `json:"username"` | ||||
| 	Password    string     `json:"password"` | ||||
| 	ResetNeeded bool       `json:"resetNeeded"` | ||||
| 	UserType    int16      `db:"type"` | ||||
| 	Enabled     bool       `json:"enabled"` | ||||
| 	CreatedAt   *time.Time `json:"createdAt"` | ||||
| } | ||||
|  | ||||
| type UserDetail struct { | ||||
| 	Id                string | ||||
| 	Name              *string | ||||
| 	Abbr              *string | ||||
| 	Region            *string | ||||
| 	Address           *string | ||||
| 	Contact           *string | ||||
| 	Phone             *string | ||||
| 	UnitServiceFee    decimal.Decimal `db:"unit_service_fee"` | ||||
| 	ServiceExpiration Date | ||||
| 	CreatedAt         time.Time | ||||
| 	CreatedBy         *string | ||||
| 	LastModifiedAt    time.Time | ||||
| 	LastModifiedBy    *string | ||||
| 	DeletedAt         *time.Time | ||||
| 	DeletedBy         *string | ||||
| 	Id                string          `json:"id"` | ||||
| 	Name              *string         `json:"name"` | ||||
| 	Abbr              *string         `json:"abbr"` | ||||
| 	Region            *string         `json:"region"` | ||||
| 	Address           *string         `json:"address"` | ||||
| 	Contact           *string         `json:"contact"` | ||||
| 	Phone             *string         `json:"phone"` | ||||
| 	UnitServiceFee    decimal.Decimal `db:"unit_service_fee" json:"unitServiceFee"` | ||||
| 	ServiceExpiration Date            `json:"serviceExpiration"` | ||||
| 	CreatedAt         time.Time       `json:"createdAt"` | ||||
| 	CreatedBy         *string         `json:"createdBy"` | ||||
| 	LastModifiedAt    time.Time       `json:"lastModifiedAt"` | ||||
| 	LastModifiedBy    *string         `json:"lastModifiedBy"` | ||||
| 	DeletedAt         *time.Time      `json:"deletedAt"` | ||||
| 	DeletedBy         *string         `json:"deletedBy"` | ||||
| } | ||||
|  | ||||
| type UserWithDetail struct { | ||||
| 	Id                string | ||||
| 	Username          string | ||||
| 	ResetNeeded       bool | ||||
| 	UserType          int16 `db:"type"` | ||||
| 	Enabled           bool | ||||
| 	Name              *string | ||||
| 	Abbr              *string | ||||
| 	Region            *string | ||||
| 	Address           *string | ||||
| 	Contact           *string | ||||
| 	Phone             *string | ||||
| 	UnitServiceFee    decimal.Decimal `db:"unit_service_fee"` | ||||
| 	ServiceExpiration Date | ||||
| 	CreatedAt         time.Time | ||||
| 	CreatedBy         *string | ||||
| 	LastModifiedAt    time.Time | ||||
| 	LastModifiedBy    *string | ||||
| 	Id                string          `json:"id"` | ||||
| 	Username          string          `json:"username"` | ||||
| 	ResetNeeded       bool            `json:"resetNeeded"` | ||||
| 	UserType          int16           `db:"type" json:"type"` | ||||
| 	Enabled           bool            `json:"enabled"` | ||||
| 	Name              *string         `json:"name"` | ||||
| 	Abbr              *string         `json:"abbr"` | ||||
| 	Region            *string         `json:"region"` | ||||
| 	Address           *string         `json:"address"` | ||||
| 	Contact           *string         `json:"contact"` | ||||
| 	Phone             *string         `json:"phone"` | ||||
| 	UnitServiceFee    decimal.Decimal `db:"unit_service_fee" json:"unitServiceFee"` | ||||
| 	ServiceExpiration Date            `json:"serviceExpiration"` | ||||
| 	CreatedAt         time.Time       `json:"createdAt"` | ||||
| 	CreatedBy         *string         `json:"createdBy"` | ||||
| 	LastModifiedAt    time.Time       `json:"lastModifiedAt"` | ||||
| 	LastModifiedBy    *string         `json:"lastModifiedBy"` | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user