code refactor
This commit is contained in:
+3
-21
@@ -203,27 +203,7 @@ type UserProfileUpdateResponse struct {
|
||||
|
||||
// UserProfileResponse represents a view-object of user profile
|
||||
type UserProfileResponse struct {
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Nickname string `json:"nickname"`
|
||||
AvatarUrl string `json:"avatar"`
|
||||
AvatarProvider string `json:"avatarProvider,omitempty"`
|
||||
DefaultAccountId int64 `json:"defaultAccountId,string"`
|
||||
TransactionEditScope TransactionEditScope `json:"transactionEditScope"`
|
||||
Language string `json:"language"`
|
||||
DefaultCurrency string `json:"defaultCurrency"`
|
||||
FirstDayOfWeek WeekDay `json:"firstDayOfWeek"`
|
||||
LongDateFormat LongDateFormat `json:"longDateFormat"`
|
||||
ShortDateFormat ShortDateFormat `json:"shortDateFormat"`
|
||||
LongTimeFormat LongTimeFormat `json:"longTimeFormat"`
|
||||
ShortTimeFormat ShortTimeFormat `json:"shortTimeFormat"`
|
||||
DecimalSeparator DecimalSeparator `json:"decimalSeparator"`
|
||||
DigitGroupingSymbol DigitGroupingSymbol `json:"digitGroupingSymbol"`
|
||||
DigitGrouping DigitGroupingType `json:"digitGrouping"`
|
||||
CurrencyDisplayType CurrencyDisplayType `json:"currencyDisplayType"`
|
||||
ExpenseAmountColor AmountColorType `json:"expenseAmountColor"`
|
||||
IncomeAmountColor AmountColorType `json:"incomeAmountColor"`
|
||||
EmailVerified bool `json:"emailVerified"`
|
||||
UserBasicInfo
|
||||
LastLoginAt int64 `json:"lastLoginAt"`
|
||||
}
|
||||
|
||||
@@ -299,6 +279,7 @@ func (u *User) ToUserBasicInfo() *UserBasicInfo {
|
||||
// ToUserProfileResponse returns a user profile view-object according to database model
|
||||
func (u *User) ToUserProfileResponse() *UserProfileResponse {
|
||||
return &UserProfileResponse{
|
||||
UserBasicInfo: UserBasicInfo{
|
||||
Username: u.Username,
|
||||
Email: u.Email,
|
||||
Nickname: u.Nickname,
|
||||
@@ -320,6 +301,7 @@ func (u *User) ToUserProfileResponse() *UserProfileResponse {
|
||||
ExpenseAmountColor: u.ExpenseAmountColor,
|
||||
IncomeAmountColor: u.IncomeAmountColor,
|
||||
EmailVerified: u.EmailVerified,
|
||||
},
|
||||
LastLoginAt: u.LastLoginUnixTime,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user