core: fix pid sort

pull/23/head
undefined 4 years ago
parent 19ebf5e9a8
commit 65094e53b6

@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.13.53",
"version": "2.13.54",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",

@ -82,7 +82,6 @@ export async function add(
tag: string[] = [], category: string[] = [], data: ProblemDataSource = null, hidden = false,
) {
const pidCounter = await domain.inc(domainId, 'pidCounter', 1);
if (!pid) pid = pidCounter.toString();
return await document.add(
domainId, content, owner, document.TYPE_PROBLEM, pidCounter, null, null,
{

@ -1,6 +1,7 @@
/* eslint-disable no-await-in-loop */
import * as domain from './model/domain';
import * as document from './model/document';
import { db } from './service/db';
type UpgradeScript = () => Promise<void>;
@ -29,6 +30,9 @@ const scripts: UpgradeScript[] = [
if (bulk.length) await bulk.execute();
}
},
async function _2_3() {
await db.collection('document').updateMany({ pid: /^\d+$/i }, { $unset: { pid: '' } });
},
];
export = scripts;

Loading…
Cancel
Save