mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-06 05:48:00 +03:00
Move scripts into src/
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import deepmerge from "deepmerge";
|
||||
import { ICollection } from "monk";
|
||||
import { ChartDocument, IDStrings } from "tachi-common";
|
||||
import { Random20Hex } from "utils/misc";
|
||||
|
||||
export async function QuickInsert<I extends IDStrings>(
|
||||
base: Omit<ChartDocument<I>, "chartID">,
|
||||
content: Partial<ChartDocument<I>>[],
|
||||
coll: ICollection
|
||||
) {
|
||||
const docs = [];
|
||||
|
||||
for (const c of content) {
|
||||
const doc = deepmerge(base, c);
|
||||
|
||||
doc.chartID = Random20Hex();
|
||||
docs.push(doc);
|
||||
}
|
||||
|
||||
await coll.insert(docs);
|
||||
}
|
||||
Reference in New Issue
Block a user