forked from wangziqi/gongxue-base
refactor(classes): remove CampusScope dependency
This commit is contained in:
@@ -3,7 +3,6 @@ import { InjectRepository } from '@nestjs/typeorm';
|
|||||||
import { Repository, In, Like } from 'typeorm';
|
import { Repository, In, Like } from 'typeorm';
|
||||||
import { Class, ClassStudent, ClassTeacher, ClassSchedule, AttendanceRecord, Department, Classroom } from '../entities';
|
import { Class, ClassStudent, ClassTeacher, ClassSchedule, AttendanceRecord, Department, Classroom } from '../entities';
|
||||||
import { CreateClassDto, UpdateClassDto, QueryClassDto, AddTeacherDto, QueryClassScheduleDto, QueryClassAttendanceSummaryDto } from './dto/class.dto';
|
import { CreateClassDto, UpdateClassDto, QueryClassDto, AddTeacherDto, QueryClassScheduleDto, QueryClassAttendanceSummaryDto } from './dto/class.dto';
|
||||||
import { CampusScope } from '../common/campus-scope';
|
|
||||||
|
|
||||||
interface RawStudentCount {
|
interface RawStudentCount {
|
||||||
classId: string;
|
classId: string;
|
||||||
@@ -25,7 +24,6 @@ export class ClassesService {
|
|||||||
private attendanceRepo: Repository<AttendanceRecord>,
|
private attendanceRepo: Repository<AttendanceRecord>,
|
||||||
@InjectRepository(Department)
|
@InjectRepository(Department)
|
||||||
private deptRepo: Repository<Department>,
|
private deptRepo: Repository<Department>,
|
||||||
private readonly scope: CampusScope,
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async findAll(query: QueryClassDto) {
|
async findAll(query: QueryClassDto) {
|
||||||
@@ -36,7 +34,6 @@ export class ClassesService {
|
|||||||
if (query.keyword) where.name = Like(`%${query.keyword}%`);
|
if (query.keyword) where.name = Like(`%${query.keyword}%`);
|
||||||
// Default: hide archived, unless explicitly requested
|
// Default: hide archived, unless explicitly requested
|
||||||
where.isArchived = query.isArchived ?? false;
|
where.isArchived = query.isArchived ?? false;
|
||||||
where = await this.scope.filter(where);
|
|
||||||
|
|
||||||
const classes = await this.classRepo.find({
|
const classes = await this.classRepo.find({
|
||||||
where,
|
where,
|
||||||
|
|||||||
Reference in New Issue
Block a user