package handler import ( "google.golang.org/protobuf/types/known/timestamppb" "hilo/api/service/user" "hilo/app/service/user/internal/model" ) func ProtoToUser(src *user.MUser) *model.User { return &model.User{ Avatar: src.Avatar, Birthday: src.Birthday, Code: src.Code, Country: src.Country, CountryIcon: src.CountryIcon, DefaultAvatar: int(src.DefaultAvatar), Description: src.Description, DeviceType: src.DeviceType, ExternalId: src.ExternalId, IsPush: int(src.IsPush), IsShowAge: int(src.IsShowAge), Language: src.Language, LogoutTime: src.LogoutTime, Nick: src.Nick, OriginCode: src.OriginCode, Sex: int(src.Sex), Status: int8(src.Status), } } func UserToProto(src *model.User) *user.MUser { return &user.MUser{ Avatar: src.Avatar, Birthday: src.Birthday, Code: src.Code, Country: src.Country, CountryIcon: src.CountryIcon, DefaultAvatar: int32(src.DefaultAvatar), Description: src.Description, DeviceType: src.DeviceType, ExternalId: src.ExternalId, IsPush: int32(src.IsPush), IsShowAge: int32(src.IsShowAge), Language: src.Language, LogoutTime: src.LogoutTime, Nick: src.Nick, OriginCode: src.OriginCode, Sex: user.ESex(src.Sex), Status: int32(src.Status), } } func UserOAuthToProto(src *model.UserOauth) *user.MUserOauth { return &user.MUserOauth{ Id: src.Id, UserId: src.UserId, ThirdPartyId: src.ThirdPartyId, ThirdPartyType: user.EThirdPartyType(src.ThirdPartyType), ThirdPartyToken: src.ThirdPartyToken, CreatedTime: timestamppb.New(src.CreatedTime), UpdatedTime: timestamppb.New(src.UpdatedTime), } }