修正权限

This commit is contained in:
2026-07-20 21:27:48 +08:00 Unverified
parent c31602593a
commit 76a1b66f53
12 changed files with 584 additions and 12 deletions
+15 -1
View File
@@ -9,10 +9,12 @@ export const relationalTables = [
'organization',
'schools',
'school_classes',
'school_student_partitions',
'users',
'candidate_profiles',
'notices',
'exams',
'exam_data_partitions',
'exam_subjects',
'registrations',
'registration_subjects',
@@ -57,7 +59,7 @@ export function buildSeedOperations(state) {
const nullable = value => value == null || value === '' ? null : value;
add(
'UPDATE schema_metadata SET schema_version = 15, app_version = ?, self_registration_enabled = ?, created_at = ? WHERE id = 1',
'UPDATE schema_metadata SET schema_version = 16, app_version = ?, self_registration_enabled = ?, created_at = ? WHERE id = 1',
Number(state.meta?.version || 1), state.settings?.selfRegistrationEnabled ? 1 : 0,
state.meta?.createdAt || new Date().toISOString()
);
@@ -1169,6 +1171,18 @@ function createRepository({ client, location, read, transaction, close }) {
auditOperation(log)
]);
},
async saveSchool(school, isNew, log) {
const change = isNew
? operation(
'INSERT INTO schools (id, name, code, address, active) VALUES (?, ?, ?, ?, ?)',
school.id, school.name, school.code, optional(school.address), school.active ? 1 : 0
)
: operation(
'UPDATE schools SET name = ?, code = ?, address = ?, active = ? WHERE id = ?',
school.name, school.code, optional(school.address), school.active ? 1 : 0, school.id
);
await transaction([change, auditOperation(log)]);
},
async saveSchoolClass(schoolClass, isNew, log) {
const change = isNew
? operation(