|
|
@ -68,10 +68,52 @@ func (c *Convert) ConvertUserRpc(ctx context.Context, v *ent.User) *core.UserInf
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(v.Edges.Token) > 0 {
|
|
|
|
if len(v.Edges.Token) > 0 {
|
|
|
|
|
|
|
|
tmp.Tokens = make([]*core.TokenInfo, len(v.Edges.Token))
|
|
|
|
|
|
|
|
for i, item := range v.Edges.Token {
|
|
|
|
|
|
|
|
tmp.Tokens[i] = c.ConvertTokenRpc(ctx, item)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(v.Edges.Socials) > 0 {
|
|
|
|
if len(v.Edges.Socials) > 0 {
|
|
|
|
|
|
|
|
tmp.Socials = make([]*core.UserSocialInfo, len(v.Edges.Socials))
|
|
|
|
|
|
|
|
for i, item := range v.Edges.Socials {
|
|
|
|
|
|
|
|
tmp.Socials[i] = c.ConvertSocialRpc(ctx, item)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return &tmp
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (c *Convert) ConvertTokenRpc(ctx context.Context, v *ent.Token) *core.TokenInfo {
|
|
|
|
|
|
|
|
if v == nil {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var tmp core.TokenInfo
|
|
|
|
|
|
|
|
_ = copier.Copy(&tmp, v)
|
|
|
|
|
|
|
|
tmp.CreatedAt = ntime.Format(v.CreatedAt)
|
|
|
|
|
|
|
|
tmp.UpdatedAt = ntime.Format(v.UpdatedAt)
|
|
|
|
|
|
|
|
tmp.UserId = v.UserID
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if v.Edges.User != nil {
|
|
|
|
|
|
|
|
tmp.User = c.ConvertUserRpc(ctx, v.Edges.User)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return &tmp
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (c *Convert) ConvertSocialRpc(ctx context.Context, v *ent.UserSocial) *core.UserSocialInfo {
|
|
|
|
|
|
|
|
if v == nil {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var tmp core.UserSocialInfo
|
|
|
|
|
|
|
|
_ = copier.Copy(&tmp, v)
|
|
|
|
|
|
|
|
tmp.CreatedAt = ntime.Format(v.CreatedAt)
|
|
|
|
|
|
|
|
tmp.UpdatedAt = ntime.Format(v.UpdatedAt)
|
|
|
|
|
|
|
|
tmp.UserId = v.UserID
|
|
|
|
|
|
|
|
tmp.Uid = v.UID
|
|
|
|
|
|
|
|
tmp.OpenId = v.OpenID
|
|
|
|
|
|
|
|
tmp.UnionId = v.UnionID
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if v.Edges.User != nil {
|
|
|
|
|
|
|
|
tmp.User = c.ConvertUserRpc(ctx, v.Edges.User)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return &tmp
|
|
|
|
return &tmp
|
|
|
|