mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: 支持联合排名
This commit is contained in:
1 parent
c0e67917a2
commit
f906178de3
5 files changed
+70
-42
No files matched your search
@@ -10,6 +10,7 @@ import UserModel, { deleteUserCache } from './user';
|
||||
|
||||
const coll = db.collection('domain');
|
||||
const collUser = db.collection('domain.user');
|
||||
const collUnion = db.collection('domain.union');
|
||||
|
||||
interface DomainUserArg {
|
||||
_id: number,
|
||||
@@ -256,6 +257,21 @@ class DomainModel {
|
||||
await collUser.deleteMany({ domainId });
|
||||
await bus.parallel('domain/delete', domainId);
|
||||
}
|
||||
|
||||
@ArgMethod
|
||||
static async addUnion(domainId: string, union: string[]) {
|
||||
return await collUnion.updateOne({ _id: domainId }, { $set: { union } }, { upsert: true });
|
||||
}
|
||||
|
||||
@ArgMethod
|
||||
static async removeUnion(domainId: string) {
|
||||
return await collUnion.deleteOne({ _id: domainId });
|
||||
}
|
||||
|
||||
@ArgMethod
|
||||
static async getUnion(domainId: string) {
|
||||
return await collUnion.findOne({ _id: domainId });
|
||||
}
|
||||
}
|
||||
|
||||
export default DomainModel;
|
||||
|
||||
Reference in new issue
Block a user