forked from wangziqi/gongxue-base
fix: refactor notification display logic and add format function
This commit is contained in:
@@ -29,6 +29,7 @@ import { extractRequestInfo } from '../common/request-utils';
|
||||
import { RequirePermission } from '../auth/decorators/permission.decorator';
|
||||
import { NotificationsService } from '../notifications/notifications.service';
|
||||
import { NotificationType } from '../entities/notification.entity';
|
||||
import { TeacherRoleType } from '../entities';
|
||||
import * as ExcelJS from 'exceljs';
|
||||
import { AuthorizationService, CaslAction, SubjectName, AuthenticatedUser } from '../authorization';
|
||||
|
||||
@@ -36,6 +37,13 @@ interface AuthenticatedRequest {
|
||||
user: AuthenticatedUser;
|
||||
}
|
||||
|
||||
const teacherRoleLabels: Record<string, string> = {
|
||||
[TeacherRoleType.SUBJECT_TEACHER]: '任课老师',
|
||||
[TeacherRoleType.HEAD_TEACHER]: '班主任',
|
||||
[TeacherRoleType.LIFE_TEACHER]: '生活老师',
|
||||
[TeacherRoleType.ACADEMIC_TEACHER]: '学服老师',
|
||||
};
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Controller('classes')
|
||||
export class ClassesController {
|
||||
@@ -302,7 +310,7 @@ export class ClassesController {
|
||||
recipientIds: [dto.userId],
|
||||
type: NotificationType.CLASS_CHANGE,
|
||||
title: '班级分配',
|
||||
content: `您已被分配到班级担任${dto.roleType}角色`,
|
||||
content: `您已被分配到班级担任${teacherRoleLabels[dto.roleType] ?? dto.roleType}角色`,
|
||||
});
|
||||
} catch {}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user