mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: add problems gql to fix autocomplete (#389)
This commit is contained in:
1 parent
4b3c57549a
commit
a52c488e23
5 files changed
+17
-5
No files matched your search
@@ -80,6 +80,11 @@ registerResolver(
|
||||
return pdoc;
|
||||
},
|
||||
);
|
||||
registerResolver('Query', 'problems(ids: [Int])', '[Problem]', async (arg, ctx) => {
|
||||
const res = await problem.getList(ctx.args.domainId, arg.ids, ctx.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || ctx.user._id,
|
||||
ctx.user.group, undefined, undefined, true);
|
||||
return Object.keys(res).map((id) => res[+id]);
|
||||
}, 'Get a list of problem by ids');
|
||||
registerResolver(
|
||||
'Problem', 'manage', 'ProblemManage',
|
||||
(arg, ctx) => {
|
||||
|
||||
@@ -488,7 +488,8 @@ export async function get(domainId: string, tid: ObjectID): Promise<Tdoc<30>> {
|
||||
}
|
||||
|
||||
export async function getRelated(domainId: string, pid: number) {
|
||||
return await document.getMulti(domainId, document.TYPE_CONTEST, { pids: pid }).toArray();
|
||||
const rules = Object.keys(RULES).filter((i) => !RULES[i].hidden);
|
||||
return await document.getMulti(domainId, document.TYPE_CONTEST, { pids: pid, rule: { $in: rules } }).toArray();
|
||||
}
|
||||
|
||||
export async function getStatus(domainId: string, tid: ObjectID, uid: number) {
|
||||
|
||||
Reference in new issue
Block a user