diff --git a/apps/server/src/sync/sync.controller.ts b/apps/server/src/sync/sync.controller.ts index 7fda1bb..db4e757 100644 --- a/apps/server/src/sync/sync.controller.ts +++ b/apps/server/src/sync/sync.controller.ts @@ -1,4 +1,4 @@ -import { BadRequestException, Body, Controller, Get, Post, Query, UseGuards } from '@nestjs/common'; +import { BadRequestException, Body, Controller, Get, Logger, Post, Query, UseGuards } from '@nestjs/common'; import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard'; import { RequirePermission } from '../auth/decorators/permission.decorator'; import { SyncService } from './sync.service'; @@ -8,6 +8,7 @@ import { ImportUsersDto } from './dto/import-users.dto'; @UseGuards(JwtAuthGuard) @Controller('sync') export class SyncController { + private readonly logger = new Logger(SyncController.name); constructor(private readonly syncService: SyncService) {} @Post('trigger') @@ -54,7 +55,10 @@ export class SyncController { @Post('dingtalk/import-users') @RequirePermission('sync:trigger') async importDingTalkUsers(@Body() body: ImportUsersDto) { + this.logger.log(`[import] users=${body.users.length} classes=${body.classes?.length || 0}`); + this.logger.log(`[import] sample user: ${JSON.stringify(body.users[0])}`); const result = await this.syncService.importDingTalkUsers(body.users, body.classes); + this.logger.log(`[import result] ${JSON.stringify(result)}`); return { success: true, ...result }; }