forked from wangziqi/gongxue-base
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:
66
apps/server/src/attendance/dto/dingtalk-import.dto.ts
Normal file
66
apps/server/src/attendance/dto/dingtalk-import.dto.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import {
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsDateString,
|
||||
IsBoolean,
|
||||
IsInt,
|
||||
IsNotEmpty,
|
||||
Min,
|
||||
Max,
|
||||
} from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
/**
|
||||
* Parameters for importing attendance data from DingTalk.
|
||||
* Mirrors `dws attendance check result` flags.
|
||||
*/
|
||||
export class DingTalkImportDto {
|
||||
/** Start date (YYYY-MM-DD), required */
|
||||
@IsNotEmpty()
|
||||
@IsDateString()
|
||||
start: string;
|
||||
|
||||
/** End date (YYYY-MM-DD), required, max 1 month span */
|
||||
@IsNotEmpty()
|
||||
@IsDateString()
|
||||
end: string;
|
||||
|
||||
/** Comma-separated DingTalk user IDs, optional (default: all org users) */
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
users?: string;
|
||||
|
||||
/** Auto-match imported records to students after import */
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
@Type(() => Boolean)
|
||||
autoMatch?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Progress event emitted via SSE stream during import.
|
||||
*/
|
||||
export interface ImportProgressEvent {
|
||||
phase: 'fetching' | 'parsing' | 'saving' | 'matching' | 'complete' | 'error';
|
||||
/** Current progress count */
|
||||
current: number;
|
||||
/** Total expected (estimated, may change) */
|
||||
total: number;
|
||||
/** Human-readable message */
|
||||
message: string;
|
||||
/** Error message (only when phase === 'error') */
|
||||
error?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Result returned after import completes.
|
||||
*/
|
||||
export interface ImportResult {
|
||||
success: boolean;
|
||||
imported: number;
|
||||
skipped: number;
|
||||
matched: number;
|
||||
errors: string[];
|
||||
/** Duration in ms */
|
||||
duration: number;
|
||||
}
|
||||
Reference in New Issue
Block a user