(
domainId: string, docType: number, docId: DocID, key: string,
arg0: any, arg1?: any, arg2?: any,
)
| 189 | key: keyof DocType[K], content: string, owner: number, args?: DocType[K][T][0], |
| 190 | ): Promise<[DocType[K], ObjectId]>; |
| 191 | export async function push( |
| 192 | domainId: string, docType: number, docId: DocID, key: string, |
| 193 | arg0: any, arg1?: any, arg2?: any, |
| 194 | ) { |
| 195 | const _id = arg2?._id || arg0?._id || new ObjectId(); |
| 196 | const v = arg1 |
| 197 | ? { _id, ...arg2, content: arg0, owner: arg1 } |
| 198 | : { _id, ...arg0 }; |
| 199 | const doc = await coll.findOneAndUpdate( |
| 200 | { domainId, docType, docId }, |
| 201 | // @ts-ignore |
| 202 | { $push: { [key]: v } }, |
| 203 | { returnDocument: 'after' }, |
| 204 | ); |
| 205 | return [doc, _id]; |
| 206 | } |
| 207 | |
| 208 | export async function pull<K extends keyof DocType, T extends ArrayKeys<DocType[K]>>( |
| 209 | domainId: string, docType: K, docId: DocType[K]['docId'], |
nothing calls this directly
no outgoing calls
no test coverage detected