修复
This commit is contained in:
+11
-13
@@ -5,6 +5,7 @@ export function createSeedDatabase({ nowIso, hashPassword }) {
|
||||
const candidateId = 'usr_demo';
|
||||
const examId = 'exam_autumn_2026';
|
||||
const registrationId = 'reg_demo_2026';
|
||||
const testPasswordHash = hashPassword('12345678');
|
||||
const database = {
|
||||
meta: { version: 15, createdAt: nowIso() },
|
||||
settings: { selfRegistrationEnabled: false },
|
||||
@@ -24,13 +25,13 @@ export function createSeedDatabase({ nowIso, hashPassword }) {
|
||||
{ id: 'class_hz3_301', schoolId: 'school_hz3', name: '高三(1)班', grade: '高三', active: true }
|
||||
],
|
||||
users: [
|
||||
{ id: adminId, username: 'admin', passwordHash: hashPassword('Admin123!'), role: 'admin', adminLevel: 'super', displayName: '林老师', active: true, createdAt: nowIso() },
|
||||
{ id: 'usr_supervisor', username: 'supervisor', passwordHash: hashPassword('Admin123!'), role: 'admin', adminLevel: 'super', displayName: '赵督导', active: true, createdAt: nowIso() },
|
||||
{ id: schoolAdminId, username: 'school_admin', passwordHash: hashPassword('School123!'), role: 'admin', adminLevel: 'school', schoolId: 'school_hz1', displayName: '王校管', active: true, createdAt: nowIso() },
|
||||
{ id: schoolAdmin2Id, username: 'school_admin_2', passwordHash: hashPassword('School123!'), role: 'admin', adminLevel: 'school', schoolId: 'school_hz1', displayName: '陈校管', active: true, createdAt: nowIso() },
|
||||
{ id: 'usr_class_admin', username: 'class_admin', passwordHash: hashPassword('Class123!'), role: 'admin', adminLevel: 'class', schoolId: 'school_hz1', classId: 'class_hz1_302', displayName: '孙班管', active: true, createdAt: nowIso() },
|
||||
{ id: 'usr_class_admin_2', username: 'class_admin_2', passwordHash: hashPassword('Class123!'), role: 'admin', adminLevel: 'class', schoolId: 'school_hz1', classId: 'class_hz1_302', displayName: '李班管', active: true, createdAt: nowIso() },
|
||||
{ id: candidateId, username: '2026-HZ01-F-0001', candidateNumber: '2026-HZ01-F-0001', passwordHash: hashPassword('Candidate123!'), role: 'candidate', displayName: '周雨桐', active: true, mustChangePassword: true, createdAt: nowIso() }
|
||||
{ id: adminId, username: 'admin', passwordHash: testPasswordHash, role: 'admin', adminLevel: 'super', displayName: '林老师', active: true, createdAt: nowIso() },
|
||||
{ id: 'usr_supervisor', username: 'supervisor', passwordHash: testPasswordHash, role: 'admin', adminLevel: 'super', displayName: '赵督导', active: true, createdAt: nowIso() },
|
||||
{ id: schoolAdminId, username: 'school_admin', passwordHash: testPasswordHash, role: 'admin', adminLevel: 'school', schoolId: 'school_hz1', displayName: '王校管', active: true, createdAt: nowIso() },
|
||||
{ id: schoolAdmin2Id, username: 'school_admin_2', passwordHash: testPasswordHash, role: 'admin', adminLevel: 'school', schoolId: 'school_hz1', displayName: '陈校管', active: true, createdAt: nowIso() },
|
||||
{ id: 'usr_class_admin', username: 'class_admin', passwordHash: testPasswordHash, role: 'admin', adminLevel: 'class', schoolId: 'school_hz1', classId: 'class_hz1_302', displayName: '孙班管', active: true, createdAt: nowIso() },
|
||||
{ id: 'usr_class_admin_2', username: 'class_admin_2', passwordHash: testPasswordHash, role: 'admin', adminLevel: 'class', schoolId: 'school_hz1', classId: 'class_hz1_302', displayName: '李班管', active: true, createdAt: nowIso() },
|
||||
{ id: candidateId, username: '2026-HZ01-F-0001', candidateNumber: '2026-HZ01-F-0001', passwordHash: testPasswordHash, role: 'candidate', displayName: '周雨桐', active: true, mustChangePassword: false, createdAt: nowIso() }
|
||||
],
|
||||
candidateProfiles: [
|
||||
{
|
||||
@@ -187,20 +188,17 @@ export function createSeedDatabase({ nowIso, hashPassword }) {
|
||||
}
|
||||
}
|
||||
|
||||
const schoolPasswordHash = hashPassword('School123!');
|
||||
const classPasswordHash = hashPassword('Class123!');
|
||||
const candidatePasswordHash = hashPassword('Candidate123!');
|
||||
for (const school of schoolDefinitions) {
|
||||
const generatedSchoolAdminId = `usr_test_school_admin_${school.key}`;
|
||||
database.users.push({
|
||||
id: generatedSchoolAdminId, username: `test_school_admin_${school.key}`, passwordHash: schoolPasswordHash,
|
||||
id: generatedSchoolAdminId, username: `test_school_admin_${school.key}`, passwordHash: testPasswordHash,
|
||||
role: 'admin', adminLevel: 'school', schoolId: school.id, displayName: `${school.name}测试校管`, active: true, createdAt: nowIso()
|
||||
});
|
||||
for (let classIndex = 1; classIndex <= 3; classIndex += 1) {
|
||||
const classId = `class_${school.key}_30${classIndex}`;
|
||||
database.users.push({
|
||||
id: `usr_test_class_admin_${school.key}_${classIndex}`, username: `test_class_admin_${school.key}_${classIndex}`,
|
||||
passwordHash: classPasswordHash, role: 'admin', adminLevel: 'class', schoolId: school.id, classId,
|
||||
passwordHash: testPasswordHash, role: 'admin', adminLevel: 'class', schoolId: school.id, classId,
|
||||
displayName: `${school.name}高三${classIndex}班测试班管`, active: true, createdAt: nowIso()
|
||||
});
|
||||
}
|
||||
@@ -256,7 +254,7 @@ export function createSeedDatabase({ nowIso, hashPassword }) {
|
||||
const idNumber = `3207002008${String(index % 12 + 1).padStart(2, '0')}${String(index % 28 + 1).padStart(2, '0')}${String(index + 1).padStart(4, '0')}`;
|
||||
const phone = `138${String(10000000 + index).padStart(8, '0')}`;
|
||||
database.users.push({
|
||||
id: userId, username: candidateNumber, candidateNumber, passwordHash: candidatePasswordHash, role: 'candidate',
|
||||
id: userId, username: candidateNumber, candidateNumber, passwordHash: testPasswordHash, role: 'candidate',
|
||||
displayName: name, active: true, mustChangePassword: false, createdAt
|
||||
});
|
||||
database.candidateProfiles.push({
|
||||
|
||||
Reference in New Issue
Block a user