feat: DingTalk attendance import + integration config + expense types + UI polish
Server: - Add DingTalk attendance import service with SSE progress streaming - Add IntegrationConfig entity & module for multi-tenant DingTalk setup - Add ExpenseType entity & ExpenseTypesModule - Add SeedModule for DB initialization - Add UserDingMapping entity for DingTalk user linkage - Attendance service: import flow with dedup & student auto-mapping - Rooms service: time-range overlap queries - Sync controller/service: DingTalk integration wiring - Permission guard: refactor to pure re-export - Campus scope middleware: tenant-aware filtering Admin UI: - Attendance page: import UI with progress & result summary - All pages: tableStyle/tablePagination standardization - Login page: responsive styling - Sensitive data: useViewSensitive hook for masked viewing - Vite config: path aliases, build optimization - Test infra: vitest config, test utilities Docs: PRD DingTalk batch 1 & 2 design docs
This commit is contained in:
58
apps/server/src/seed/seed.module.ts
Normal file
58
apps/server/src/seed/seed.module.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { Module, OnModuleInit, Logger } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { SeedDevService } from './seed-dev.service';
|
||||
import {
|
||||
Student, Room, Occupancy, RoomExpense,
|
||||
Bill, BillItem, User, Deposit,
|
||||
Classroom, Tenant, ClassroomRental, Permission, Role,
|
||||
Class, ClassStudent, ClassTeacher, ClassSchedule,
|
||||
AttendanceRecord, Department, UserDepartment,
|
||||
StudentProfile, StudentEnrollment, ExamScore, LearningRecord,
|
||||
ExpenseType,
|
||||
} from '../entities';
|
||||
|
||||
const SEED_ENTITIES = [
|
||||
Department, User, Role, Permission, UserDepartment,
|
||||
Tenant, Student, Room, Classroom, Occupancy,
|
||||
RoomExpense, ExpenseType, Class,
|
||||
ClassStudent, ClassTeacher, ClassSchedule, Bill, BillItem,
|
||||
Deposit, AttendanceRecord,
|
||||
ClassroomRental, StudentProfile, StudentEnrollment,
|
||||
ExamScore, LearningRecord,
|
||||
];
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature(SEED_ENTITIES)],
|
||||
providers: [SeedDevService],
|
||||
})
|
||||
export class SeedModule implements OnModuleInit {
|
||||
private readonly logger = new Logger(SeedModule.name);
|
||||
|
||||
constructor(private readonly seedService: SeedDevService) {}
|
||||
|
||||
async onModuleInit() {
|
||||
const enabled = process.env['SEED_DEV'] === 'true' || process.env['NODE_ENV'] === 'development';
|
||||
const skip = process.env['SEED_DEV_SKIP'] === 'true';
|
||||
|
||||
if (!enabled || skip) {
|
||||
this.logger.log(
|
||||
`Seed skipped: SEED_DEV=${process.env['SEED_DEV']}, NODE_ENV=${process.env['NODE_ENV']}, SKIP=${skip}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const studentCount = await this.seedService.getStudentCount();
|
||||
if (studentCount > 0) {
|
||||
this.logger.log(`Seed skipped: ${studentCount} students already exist`);
|
||||
return;
|
||||
}
|
||||
|
||||
this.logger.log('Starting mock data seeding...');
|
||||
try {
|
||||
await this.seedService.seed();
|
||||
this.logger.log('Mock data seeding completed successfully');
|
||||
} catch (err) {
|
||||
this.logger.error('Mock data seeding failed', err instanceof Error ? err.stack : String(err));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user