core: remove useless pidCounter

This commit is contained in:
undefined committed 2021-04-17 23:33:53 +08:00
1 parent d7a6e30743
commit 2539dfa412
5 files changed
+4 -6

No files matched your search

-1
View File
@@ -303,7 +303,6 @@ export interface DomainDoc extends Record<string, any> {
roles: Dictionary<string>,
gravatar: string,
bulletin: string,
pidCounter: number,
_join?: any,
host?: string,
}
-1
View File
@@ -48,7 +48,6 @@ class DomainModel {
bulletin,
roles: {},
gravatar: '',
pidCounter: 0,
};
await bus.serial('domain/create', ddoc);
await coll.insertOne(ddoc);
+4 -2
View File
@@ -48,8 +48,10 @@ export class ProblemModel {
domainId: string, pid: string = null, title: string, content: string, owner: number,
tag: string[] = [], hidden = false,
) {
const pidCounter = await domain.inc(domainId, 'pidCounter', 1);
const result = await ProblemModel.addWithId(domainId, pidCounter, pid, title, content, owner, tag, hidden);
const [doc] = await ProblemModel.getMulti(domainId, {})
.sort({ docId: -1 }).limit(1).project({ docId: 1 })
.toArray();
const result = await ProblemModel.addWithId(domainId, (doc?.docId || 0) + 1, pid, title, content, owner, tag, hidden);
return result;
}
-1
View File
@@ -124,7 +124,6 @@ DomainSetting(
Setting('setting_domain', 'name', 'New domain', 'text', 'name'),
Setting('setting_domain', 'gravatar', '', 'text', 'gravatar', 'Will be used as the domain icon.'),
Setting('setting_domain', 'bulletin', '', 'markdown', 'Bulletin'),
Setting('setting_storage', 'pidCounter', 0, 'number', 'Problem ID Counter', null, FLAG_HIDDEN | FLAG_DISABLED),
Setting('setting_storage', 'host', '', 'text', 'Custom host', null, FLAG_HIDDEN | FLAG_DISABLED),
);
-1
View File
@@ -258,7 +258,6 @@ const tasks = {
},
gravatar: 'gravatar',
bulletin: 'bulletin',
pid_counter: 'pidCounter',
},
'fs.files': async (doc) => doc,
'fs.chunks': async (doc) => doc,