mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
onsite-toolkit: add displayName option
This commit is contained in:
1 parent
edc00782a3
commit
99ce691d8a
1 file changed
+2
@@ -29,6 +29,7 @@ function normalizeIp(ip: string) {
|
|||||||
const QuickImportSchema = Schema.array(Schema.object({
|
const QuickImportSchema = Schema.array(Schema.object({
|
||||||
id: Schema.union([Schema.string().required(), Schema.number().required()]),
|
id: Schema.union([Schema.string().required(), Schema.number().required()]),
|
||||||
name: Schema.string().required(),
|
name: Schema.string().required(),
|
||||||
|
displayName: Schema.string(),
|
||||||
password: Schema.string(),
|
password: Schema.string(),
|
||||||
school: Schema.string(),
|
school: Schema.string(),
|
||||||
members: Schema.array(Schema.string()).default([]),
|
members: Schema.array(Schema.string()).default([]),
|
||||||
@@ -315,6 +316,7 @@ export function apply(ctx: Context, config: ReturnType<typeof Config>) {
|
|||||||
if (line.school) set.avatar = `url:/avatars/${line.school.replace(/[ ()]/g, '')}.${format}`;
|
if (line.school) set.avatar = `url:/avatars/${line.school.replace(/[ ()]/g, '')}.${format}`;
|
||||||
set.contestMode = domainId;
|
set.contestMode = domainId;
|
||||||
await UserModel.setById(team._id, set);
|
await UserModel.setById(team._id, set);
|
||||||
|
if (line.displayName) await DomainModel.setUserInDomain(domainId, team._id, { displayName: line.displayName });
|
||||||
for (const tdoc of tdocs) {
|
for (const tdoc of tdocs) {
|
||||||
const tsdoc = await ContestModel.getStatus(domainId, tdoc.docId, team._id);
|
const tsdoc = await ContestModel.getStatus(domainId, tdoc.docId, team._id);
|
||||||
if (!tsdoc?.attend) await ContestModel.attend(domainId, tdoc.docId, team._id, 'rank' in line ? { unrank: !line.rank, subscribe: 1 } : { subscribe: 1 });
|
if (!tsdoc?.attend) await ContestModel.attend(domainId, tdoc.docId, team._id, 'rank' in line ? { unrank: !line.rank, subscribe: 1 } : { subscribe: 1 });
|
||||||
|
|||||||
Reference in new issue
Block a user