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

Function addToSet

packages/hydrooj/src/model/document.ts:268–278  ·  view source on GitHub ↗
(
    domainId: string, docType: T, docId: DocType[T]['docId'],
    setKey: K, content: string,
)

Source from the content-addressed store, hash-verified

266}
267
268export async function addToSet<T extends keyof DocType, K extends ArrayKeys<DocType[T], string>>(
269 domainId: string, docType: T, docId: DocType[T]['docId'],
270 setKey: K, content: string,
271) {
272 return await coll.findOneAndUpdate(
273 { domainId, docType, docId },
274 // @ts-ignore
275 { $addToSet: { [setKey]: content } },
276 { returnDocument: 'after' },
277 );
278}
279
280export async function getStatus<K extends keyof DocStatusType>(
281 domainId: string, docType: K, docId: DocStatusType[K]['docId'], uid: number,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected