好友:好友排序以及一键赠送排序
This commit is contained in:
@@ -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>; // 将所有字段变成可选项
|
||||
Reference in New Issue
Block a user