好友:好友排序以及一键赠送排序

This commit is contained in:
luying
2021-02-24 17:06:48 +08:00
parent 1a4f3e84d5
commit 87d7bf6a8e
5 changed files with 47 additions and 15 deletions
+7 -1
View File
@@ -96,6 +96,11 @@ export default class FriendRelation extends BaseModel {
return result.length > 0;
}
public static async updateInfo(roleId: string, update: friendShipUpdate) {
const result = await FriendRelationModel.findOneAndUpdate({ roleId }, {$set: update}, { new: true }).lean();
return result;
}
public static async deleteAccount(roleId: string) {
let result = await FriendRelationModel.deleteMany({ roleId });
await FriendRelationModel.updateMany({}, { $pull: { friends: { roleId }, blacklist: { roleId } }});
@@ -105,4 +110,5 @@ export default class FriendRelation extends BaseModel {
export const FriendRelationModel = getModelForClass(FriendRelation);
export interface FriendRelationType extends Pick<DocumentType<FriendRelation>, keyof FriendRelation> { };
export interface FriendRelationType extends Pick<DocumentType<FriendRelation>, keyof FriendRelation> { };
type friendShipUpdate = Partial<FriendRelationType>; // 将所有字段变成可选项