(udoc: User)
| 42 | export const parseCategory = (value: string) => value.replace(/,/g, ',').split(',').map((e) => e.trim()); |
| 43 | |
| 44 | function 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 | |
| 56 | const defaultSearch = async (domainId: string, q: string, options?: ProblemSearchOptions) => { |
| 57 | const escaped = escapeRegExp(q.toLowerCase()); |