mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
!UNSTABLE 优化数据库结构,为domain功能准备
This commit is contained in:
1 parent
7d27e56018
commit
fff2172c38
40 files changed
+1411
-1012
No files matched your search
@@ -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`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user