diff --git a/packages/hydrooj/src/model/document.ts b/packages/hydrooj/src/model/document.ts index 5f5c3870a..0e566d0d0 100644 --- a/packages/hydrooj/src/model/document.ts +++ b/packages/hydrooj/src/model/document.ts @@ -5,7 +5,7 @@ import { } from 'mongodb'; import { Pdoc, Ddoc, Drdoc, Tdoc, TrainingDoc, - ProblemStatusDoc, User, Content, + ProblemStatusDoc, Content, } from '../interface'; import { buildProjection } from '../utils'; import { NumberKeys, ArrayKeys, Projection, MaybeArray } from '../typeutils'; @@ -44,11 +44,6 @@ export interface DocStatusType { [key: number]: any } -export async function canView(doc: DocType[T], user: User): Promise { - if (doc.owner === user._id || doc.maintainers.includes(user._id) || doc.participants.includes(user._id)) return true; - if () -} - export async function add( domainId: string, content: Content, owner: number, docType: T, docId: K, diff --git a/packages/hydrooj/src/model/system.ts b/packages/hydrooj/src/model/system.ts index 4efb0bfb3..9c1a41327 100644 --- a/packages/hydrooj/src/model/system.ts +++ b/packages/hydrooj/src/model/system.ts @@ -15,22 +15,22 @@ export function get(key: string): any { export function getMany< A extends keyof SystemKeys, B extends keyof SystemKeys, - >(keys: [A, B]): [SystemKeys[A], SystemKeys[B]]; +>(keys: [A, B]): [SystemKeys[A], SystemKeys[B]]; export function getMany< A extends keyof SystemKeys, B extends keyof SystemKeys, C extends keyof SystemKeys, - >(keys: [A, B, C]): [SystemKeys[A], SystemKeys[B], SystemKeys[C]]; +>(keys: [A, B, C]): [SystemKeys[A], SystemKeys[B], SystemKeys[C]]; export function getMany< A extends keyof SystemKeys, B extends keyof SystemKeys, C extends keyof SystemKeys, D extends keyof SystemKeys, - >(keys: [A, B, C, D]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D]]; +>(keys: [A, B, C, D]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D]]; export function getMany< A extends keyof SystemKeys, B extends keyof SystemKeys, C extends keyof SystemKeys, D extends keyof SystemKeys, E extends keyof SystemKeys, - >(keys: [A, B, C, D, E]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D], SystemKeys[E]]; +>(keys: [A, B, C, D, E]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D], SystemKeys[E]]; export function getMany< A extends keyof SystemKeys, B extends keyof SystemKeys, C extends keyof SystemKeys, D extends keyof SystemKeys, E extends keyof SystemKeys, F extends keyof SystemKeys, - >(keys: [A, B, C, D, E, F]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D], SystemKeys[E], SystemKeys[F]]; +>(keys: [A, B, C, D, E, F]): [SystemKeys[A], SystemKeys[B], SystemKeys[C], SystemKeys[D], SystemKeys[E], SystemKeys[F]]; export function getMany(keys: (keyof SystemKeys)[]): any[]; export function getMany(keys: string[]): any[] { return keys.map((key) => cache[key]);