MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / buildQuery

Function buildQuery

packages/hydrooj/src/handler/problem.ts:44–54  ·  view source on GitHub ↗
(udoc: User)

Source from the content-addressed store, hash-verified

42export const parseCategory = (value: string) => value.replace(/,/g, ',').split(',').map((e) => e.trim());
43
44function buildQuery(udoc: User) {
45 const q: Filter<ProblemDoc> = {};
46 if (!udoc.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) {
47 q.$or = [
48 { hidden: false },
49 { owner: udoc._id },
50 { maintainer: udoc._id },
51 ];
52 }
53 return q;
54}
55
56const defaultSearch = async (domainId: string, q: string, options?: ProblemSearchOptions) => {
57 const escaped = escapeRegExp(q.toLowerCase());

Callers 2

getMethod · 0.85
getMethod · 0.85

Calls 1

hasPermMethod · 0.80

Tested by

no test coverage detected