core: 支持题目导出

This commit is contained in:
undefined committed 2020-11-07 23:47:35 +08:00
1 parent a5004a7c1b
commit ee0f5deedc
11 files changed
+87 -33

No files matched your search

+3 -3
View File
@@ -187,10 +187,10 @@ export function setStar(domainId: string, pid: number, uid: number, star: boolea
return document.setStatus(domainId, document.TYPE_PROBLEM, pid, uid, { star });
}
export async function setTestdata(domainId: string, _id: number, filePath: string) {
export async function setTestdata(domainId: string, _id: number, f: string | Buffer) {
const pdoc = await get(domainId, _id);
const config = await testdataConfig.readConfig(filePath);
const id = await file.add(filePath, 'data.zip', 1);
const config = await testdataConfig.readConfig(f);
const id = await file.add(f, 'data.zip', 1);
if (pdoc.data instanceof ObjectID) file.del(pdoc.data);
return await edit(domainId, _id, { data: id, config: safeLoad(config) as any });
}