!UNSTABLE 优化数据库结构,为domain功能准备

This commit is contained in:
masnn committed 2020-05-29 13:05:52 +08:00
1 parent 7d27e56018
commit fff2172c38
40 files changed
+1411 -1012

No files matched your search

+5 -5
View File
@@ -20,7 +20,7 @@ class ProblemImportHandler extends Handler {
}
async post({
url, pid, hidden, remoteType,
domainId, url, pid, hidden, remoteType,
}) {
if (typeof global.Hydro.lib[`import.${remoteType}`] !== 'function') {
throw new ValidationError('remoteType');
@@ -28,10 +28,10 @@ class ProblemImportHandler extends Handler {
const [pdoc, testdata] = await global.Hydro.lib[`import.${remoteType}`](url, this);
if (pid) pdoc.pid = pid;
if (hidden) pdoc.hidden = true;
const _id = await problem.add(pdoc);
await problem.setTestdata(_id, testdata);
this.response.body = { pid: pid || _id };
this.response.redirect = `/p/${pid || _id}/settings`;
const docId = await problem.add(domainId, pdoc.title, pdoc.content, this.user._id, pdoc);
await problem.setTestdata(docId, testdata);
this.response.body = { pid: pid || docId };
this.response.redirect = `/p/${pid || docId}/settings`;
}
}