“我的域”功能

This commit is contained in:
undefined committed 2020-07-14 19:02:19 +08:00
1 parent d4e849a133
commit eaed0e84f5
11 files changed
+122 -27

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ export async function add(domainId: string, owner: number, name: string, bulleti
return domainId;
}
export function get(domainId: string): Promise<DomainDoc> {
export function get(domainId: string): Promise<DomainDoc | null> {
return coll.findOne({ _id: domainId });
}
+2 -2
View File
@@ -28,7 +28,7 @@ export async function add(
domainId: string, pid: string = null, title: string, content: string, owner: number,
tag: string[] = [], category: string[] = [], data: ObjectID = null, hidden = false,
) {
const d = await domain.inc(domainId, 'pidCounter', 1);
const d = await domain.inc(domainId, 'pid_counter', 1);
if (!pid) pid = d.pidCounter.toString();
return await document.add(
domainId, content, owner, document.TYPE_PROBLEM, d.pidCounter, null, null,
@@ -153,7 +153,7 @@ export function setStar(domainId: string, pid: number, uid: number, star: boolea
export async function setTestdata(domainId: string, _id: number, filePath: string) {
const pdoc = await get(domainId, _id);
const config = await readConfig(filePath);
const id = await file.add(filePath, 'data.zip');
const id = await file.add(filePath, 'data.zip', 1);
if (pdoc.data && typeof pdoc.data === 'object') file.dec(pdoc.data);
return await edit(domainId, _id, { data: id, config });
}
+2 -1
View File
@@ -99,6 +99,7 @@ DomainSetting(
Setting('setting_domain', 'name', null, 'New domain', 'text', 'name'),
Setting('setting_domain', 'gravatar', null, '', 'text', 'gravatar', 'Will be used as the domain icon.'),
Setting('setting_domain', 'bulletin', null, '', 'markdown', 'Bulletin'),
Setting('storage', 'pid_counter', null, 0, 'number', 'Problem ID Counter', null, FLAG_HIDDEN | FLAG_DISABLED),
Setting('storage', 'nAccept', null, 0, 'number', 'nAccept', null, FLAG_HIDDEN | FLAG_DISABLED),
Setting('storage', 'nSubmit', null, 0, 'number', 'nSubmit', null, FLAG_HIDDEN | FLAG_DISABLED),
Setting('storage', 'nLike', null, 0, 'number', 'nLike', null, FLAG_HIDDEN | FLAG_DISABLED),
@@ -126,7 +127,7 @@ SystemSetting(
Setting('setting_ui', 'ui.header_logo', null, '/components/header/header-logo.png', 'text', 'Header Logo'),
Setting('setting_ui', 'ui.header_logo_2x', null, '/components/header/header-logo@2x.png', 'text', 'Header Logo@2x'),
Setting('setting_ui', 'ui.header_background', null, '/components/header/header-background.png', 'text', 'Header Background'),
Setting('setting_ui', 'ui.header_background_2x', null, '/components/header/header-background@2x.png', 'text', 'Header Logo@2x'),
Setting('setting_ui', 'ui.header_background_2x', null, '/components/header/header-background@2x.png', 'text', 'Header Background@2x'),
Setting('setting_ui', 'ui.nav_logo_light', null, '/components/navigation/nav-logo-small_light.png', 'text', 'Nav Logo(Light)'),
Setting('setting_ui', 'ui.nav_logo_dark', null, '/components/navigation/nav-logo-small_dark.png', 'text', 'Nav Logo(Dark)'),
Setting('setting_ui', 'ui.nav_logo_light_2x', null, '/components/navigation/nav-logo-small@2x_light.png', 'text', 'Nav Logo@2x(Light)'),
+1 -1
View File
@@ -10,7 +10,7 @@ export async function get(_id: string) {
return null;
}
export async function getMany(keys: string[]): Promise<Dictionary<any>> {
export async function getMany(keys: string[]): Promise<any[]> {
const docs = await coll.find({ _id: { $in: keys } }).toArray();
const dict = {};
const res = [];