From 9b36284f1ae149f4f06721ff62857a53dc8b6568 Mon Sep 17 00:00:00 2001 From: wangziqi Date: Thu, 9 Jul 2026 15:25:54 +0800 Subject: [PATCH] fix(server): remove CampusScope from StudentsService --- apps/server/src/students/students.service.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/server/src/students/students.service.ts b/apps/server/src/students/students.service.ts index 1b5168e..8955fd1 100644 --- a/apps/server/src/students/students.service.ts +++ b/apps/server/src/students/students.service.ts @@ -1,7 +1,6 @@ import { Injectable, NotFoundException, BadRequestException } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository, Like, Not, In, FindOptionsWhere } from 'typeorm'; -import { CampusScope } from '../common/campus-scope'; import { Student } from '../entities/student.entity'; import { Class } from '../entities/class.entity'; import { ClassStudent } from '../entities/class-student.entity'; @@ -16,7 +15,6 @@ export class StudentsService { @InjectRepository(ClassStudent) private classStudentRepo: Repository, @InjectRepository(Class) private classRepo: Repository, @InjectRepository(AttendanceRecord) private attendanceRepo: Repository, - private readonly scope: CampusScope, ) {} async findAll(query?: { name?: string; status?: string; includeArchived?: boolean; tenantId?: number | string }) { @@ -26,11 +24,9 @@ export class StudentsService { if (query?.status) { where.status = query.status; } else if (!query?.includeArchived) { - // Default: hide archived and staff, unless explicitly queried - where.status = Not(In(['archived', 'staff'])); + where.status = Not(In(['archived'])); } - const filteredWhere = await this.scope.filter(where); - return this.repo.find({ where: filteredWhere, order: { createdAt: 'DESC' }, relations: ['tenant'] }); + return this.repo.find({ where, order: { createdAt: 'DESC' }, relations: ['tenant'] }); } async findOne(id: number) {