fix(grades,term): 封闭实时成绩泄露并完善并发升级审计
This commit is contained in:
1 parent
b990701cde
commit
57069a9a75
8 files changed
+152
-57
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { activeStudentWhere } from '../../lib/students.js';
|
||||
import type { DashboardSummary, HomeworkDto, NotificationDto } from '@classhelper/shared';
|
||||
import {
|
||||
assertClassAccess,
|
||||
@@ -64,12 +65,12 @@ export async function getDashboardSummary(user: TokenPayload): Promise<Dashboard
|
||||
] = await Promise.all([
|
||||
// 学生数只算在读的:已毕业/转出的学生不属于"本班现在有多少人"
|
||||
prisma.class.count({ where: classWhere }),
|
||||
prisma.student.count({ where: { ...where, status: 'active', archivedYearId: null } }),
|
||||
prisma.student.count({ where: { ...where, ...activeStudentWhere(), archivedYearId: null } }),
|
||||
prisma.course.count({ where }),
|
||||
prisma.classPlan.count({ where }),
|
||||
prisma.homework.count({ where }),
|
||||
prisma.notification.count({ where }),
|
||||
prisma.grade.count({ where }),
|
||||
prisma.grade.count({ where: { ...where, student: activeStudentWhere() } }),
|
||||
prisma.notification.count({ where: { ...where, reads: { none: personalWhere } } }),
|
||||
device
|
||||
? prisma.homework.count({
|
||||
@@ -87,7 +88,7 @@ export async function getDashboardSummary(user: TokenPayload): Promise<Dashboard
|
||||
include: {
|
||||
course: courseSelect,
|
||||
creator: creatorSelect,
|
||||
statuses: device ? { where: personalWhere } : true,
|
||||
statuses: { where: device ? personalWhere : { student: activeStudentWhere() } },
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: 5,
|
||||
|
||||
Reference in new issue
Block a user