forked from free-lancers/electricity_bill_calc_service
enhance(user):完成可运行的程序基本结构以及用户基本查询功能。
This commit is contained in:
@@ -23,6 +23,38 @@ type ManagementAccountCreationForm struct {
|
||||
Expires Date
|
||||
}
|
||||
|
||||
func (m ManagementAccountCreationForm) IntoUser() *User {
|
||||
return &User{
|
||||
Id: *m.Id,
|
||||
Username: m.Username,
|
||||
Password: "",
|
||||
ResetNeeded: false,
|
||||
UserType: m.Type,
|
||||
Enabled: m.Enabled,
|
||||
CreatedAt: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func (m ManagementAccountCreationForm) IntoUserDetail() *UserDetail {
|
||||
return &UserDetail{
|
||||
Id: *m.Id,
|
||||
Name: &m.Name,
|
||||
Abbr: nil,
|
||||
Region: nil,
|
||||
Address: nil,
|
||||
Contact: m.Contact,
|
||||
Phone: m.Phone,
|
||||
UnitServiceFee: decimal.Zero,
|
||||
ServiceExpiration: m.Expires,
|
||||
CreatedAt: time.Now(),
|
||||
CreatedBy: nil,
|
||||
LastModifiedAt: time.Now(),
|
||||
LastModifiedBy: nil,
|
||||
DeletedAt: nil,
|
||||
DeletedBy: nil,
|
||||
}
|
||||
}
|
||||
|
||||
type User struct {
|
||||
Id string
|
||||
Username string
|
||||
|
Reference in New Issue
Block a user