info update profile

This commit is contained in:
eson
2023-09-26 15:02:09 +08:00
parent f9595aad3f
commit 31debda97f
9 changed files with 157 additions and 22 deletions

View File

@@ -4,6 +4,7 @@ package gmodel
import (
"context"
"fusenapi/utils/fssql"
"fusenapi/utils/handlers"
"gorm.io/gorm"
@@ -42,3 +43,9 @@ func (p *FsUserInfoModel) CreateOrUpdate(gormDB *gorm.DB, req *FsUserInfo) (resp
}
return req, err
}
func (m *FsUserInfoModel) MergeMetadata(userId int64, meta any) error {
return fssql.MetadataModulePATCH(m.db, "profile", FsUserInfo{}, map[string]any{
"base": meta,
}, "user_id = ?", userId)
}

View File

@@ -145,28 +145,6 @@ func (u *FsUserModel) RegisterByGoogleOAuth(ctx context.Context, token *auth.Reg
return user, nil
}
// SubscriptionStatus 订阅状态
type SubscriptionStatus struct {
SubEmail bool `json:"all_emails"`
ItemMap *struct {
} `json:"item_map"`
}
type UserAddress struct {
}
type UserProfile struct {
ProfileBase UserProfileBase `json:"base"`
SubStatus SubscriptionStatus `json:"sub_status"`
}
// UserProfileBase 个人信息
type UserProfileBase struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Resetaurant string `json:"resetaurant"`
}
// 自平台的注册流程
func (u *FsUserModel) RegisterByFusen(ctx context.Context, token *auth.RegisterToken) (user *FsUser, err error) {

View File

@@ -35,3 +35,25 @@ func FsFloat(v float64) *float64 {
func FsBool(v bool) *bool {
return &v
}
// SubscriptionStatus 订阅状态
type SubscriptionStatus struct {
SubEmail bool `json:"all_emails"`
ItemMap *struct {
} `json:"item_map"`
}
type UserProfile struct {
ProfileBase UserProfileBase `json:"base"`
SubStatus SubscriptionStatus `json:"sub_status"`
}
// UserProfileBase 个人信息
type UserProfileBase struct {
FirstName string `json:"first_name"` // 首名
LastName string `json:"last_name"` // 后名
UserName string `json:"user_name"` // 用户名
Mobile string `json:"mobile"` // 电话
Resetaurant string `json:"resetaurant"` // 不知道干什么
Company string `json:"company"` // 公司
}