mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: add default value to pdoc.data & pdoc.additional_file
This commit is contained in:
2 files changed
+9
-1
No files matched your search
@@ -157,7 +157,14 @@ export class ProblemModel {
|
|||||||
) {
|
) {
|
||||||
const ddoc = await DomainModel.get(domainId);
|
const ddoc = await DomainModel.get(domainId);
|
||||||
const args: Partial<ProblemDoc> = {
|
const args: Partial<ProblemDoc> = {
|
||||||
title, tag, hidden: meta.hidden || false, nSubmit: 0, nAccept: 0, sort: sortable(pid || `P${docId}`, ddoc?.namespaces),
|
title,
|
||||||
|
tag,
|
||||||
|
hidden: meta.hidden || false,
|
||||||
|
nSubmit: 0,
|
||||||
|
nAccept: 0,
|
||||||
|
sort: sortable(pid || `P${docId}`, ddoc?.namespaces),
|
||||||
|
data: [],
|
||||||
|
additional_file: [],
|
||||||
};
|
};
|
||||||
if (pid) args.pid = pid;
|
if (pid) args.pid = pid;
|
||||||
if (meta.difficulty) args.difficulty = meta.difficulty;
|
if (meta.difficulty) args.difficulty = meta.difficulty;
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ export class StorageModel {
|
|||||||
{ $set: { lastUsage: new Date() } },
|
{ $set: { lastUsage: new Date() } },
|
||||||
{ returnDocument: 'after' },
|
{ returnDocument: 'after' },
|
||||||
);
|
);
|
||||||
|
if (!value) throw new Error(`Original file ${src} not found`);
|
||||||
const meta = {};
|
const meta = {};
|
||||||
await StorageModel.del([dst]);
|
await StorageModel.del([dst]);
|
||||||
meta['Content-Type'] = mime(dst);
|
meta['Content-Type'] = mime(dst);
|
||||||
|
|||||||
Reference in new issue
Block a user