1)修改数据库命名,不和业务使用重合。
2)修改user 表,uid为unique, 聊天室文件夹name unique移除
This commit is contained in:
@@ -28,31 +28,75 @@ part 'get_profile_request.g.dart';
|
||||
/// 用户资料响应 DTO(只需反序列化,禁止生成无用的 toJson)
|
||||
@JsonSerializable(createToJson: false)
|
||||
class ProfileData {
|
||||
@JsonKey(name: 'user_id')
|
||||
final String userId;
|
||||
final int uid;
|
||||
final String uuid;
|
||||
@JsonKey(name: 'last_online')
|
||||
final int lastOnline;
|
||||
@JsonKey(name: 'profile_pic')
|
||||
final String profilePic;
|
||||
@JsonKey(name: 'profile_pic_gaussian')
|
||||
final String profilePicGaussian;
|
||||
final String nickname;
|
||||
final String contact;
|
||||
@JsonKey(name: 'country_code')
|
||||
final String countryCode;
|
||||
final String email;
|
||||
final String? nickname;
|
||||
final String? avatar;
|
||||
@JsonKey(name: 'recovery_email')
|
||||
final String recoveryEmail;
|
||||
final String username;
|
||||
final String bio;
|
||||
final int relationship;
|
||||
@JsonKey(name: 'user_alias')
|
||||
final String? userAlias;
|
||||
@JsonKey(name: 'channel_id')
|
||||
final int channelId;
|
||||
@JsonKey(name: 'channel_group_id')
|
||||
final int channelGroupId;
|
||||
final String hint;
|
||||
|
||||
const ProfileData({
|
||||
required this.userId,
|
||||
required this.uid,
|
||||
required this.uuid,
|
||||
required this.lastOnline,
|
||||
required this.profilePic,
|
||||
required this.profilePicGaussian,
|
||||
required this.nickname,
|
||||
required this.contact,
|
||||
required this.countryCode,
|
||||
required this.email,
|
||||
this.nickname,
|
||||
this.avatar,
|
||||
required this.recoveryEmail,
|
||||
required this.username,
|
||||
required this.bio,
|
||||
required this.relationship,
|
||||
this.userAlias,
|
||||
required this.channelId,
|
||||
required this.channelGroupId,
|
||||
required this.hint,
|
||||
});
|
||||
|
||||
factory ProfileData.fromJson(Map<String, dynamic> json) =>
|
||||
_$ProfileDataFromJson(json);
|
||||
|
||||
/// DTO → Domain Entity
|
||||
User toEntity() {
|
||||
return User(
|
||||
id: userId,
|
||||
email: email,
|
||||
nickname: nickname,
|
||||
avatar: avatar,
|
||||
);
|
||||
}
|
||||
User toEntity() => User(
|
||||
uid: uid,
|
||||
uuid: uuid,
|
||||
lastOnline: lastOnline,
|
||||
profilePic: profilePic,
|
||||
profilePicGaussian: profilePicGaussian,
|
||||
nickname: nickname,
|
||||
contact: contact,
|
||||
countryCode: countryCode,
|
||||
email: email,
|
||||
recoveryEmail: recoveryEmail,
|
||||
username: username,
|
||||
bio: bio,
|
||||
relationship: relationship,
|
||||
userAlias: userAlias,
|
||||
channelId: channelId,
|
||||
channelGroupId: channelGroupId,
|
||||
hint: hint,
|
||||
);
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user