refactor: resolve remaining field audit issues
This commit is contained in:
@@ -124,7 +124,7 @@ export class DashboardService {
|
||||
const pendingDeposits = parseFloat(pendingResult?.total || '0');
|
||||
|
||||
const activeRentals = await this.rentalRepo.count({
|
||||
where: { endDate: MoreThanOrEqual(todayStr) },
|
||||
where: { status: 'active' as const, endDate: MoreThanOrEqual(todayStr) },
|
||||
});
|
||||
|
||||
const occByBldQb = this.occRepo
|
||||
@@ -365,7 +365,7 @@ export class DashboardService {
|
||||
|
||||
async getClassroomOccupancy() {
|
||||
const classrooms = await this.classroomRepo.find({
|
||||
where: { status: Not('archived') },
|
||||
where: { status: 'available' as const },
|
||||
order: { building: 'ASC', name: 'ASC' },
|
||||
});
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
@@ -382,7 +382,7 @@ export class DashboardService {
|
||||
.createQueryBuilder('r')
|
||||
.select('r.classroomId', 'classroomId')
|
||||
.addSelect('COUNT(*)', 'rentalCount')
|
||||
.where('r.status != :cancelled', { cancelled: 'cancelled' })
|
||||
.where('r.status = :active', { active: 'active' })
|
||||
.andWhere('r.startDate <= :today AND r.endDate >= :today', { today })
|
||||
.groupBy('r.classroomId');
|
||||
const rentals = await rentalQb.getRawMany();
|
||||
@@ -402,7 +402,7 @@ export class DashboardService {
|
||||
|
||||
async getClassroomUtilizationStats() {
|
||||
const totalClassrooms = await this.classroomRepo.count({
|
||||
where: { status: Not('archived') },
|
||||
where: { status: 'available' as const },
|
||||
});
|
||||
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
@@ -420,7 +420,7 @@ export class DashboardService {
|
||||
const rentalQb = this.rentalRepo
|
||||
.createQueryBuilder('r')
|
||||
.select('COUNT(DISTINCT r.classroomId)', 'cnt')
|
||||
.where('r.status != :cancelled', { cancelled: 'cancelled' })
|
||||
.where('r.status = :active', { active: 'active' })
|
||||
.andWhere('r.startDate <= :today AND r.endDate >= :today', { today });
|
||||
const rentalResult = await rentalQb.getRawOne();
|
||||
|
||||
@@ -437,7 +437,7 @@ export class DashboardService {
|
||||
const combinedRentalQb = this.rentalRepo
|
||||
.createQueryBuilder('r')
|
||||
.select('r.classroomId')
|
||||
.where('r.status != :cancelled', { cancelled: 'cancelled' })
|
||||
.where('r.status = :active', { active: 'active' })
|
||||
.andWhere('r.startDate <= :today AND r.endDate >= :today', { today })
|
||||
.groupBy('r.classroomId');
|
||||
const rentalIds = await combinedRentalQb.getRawMany();
|
||||
|
||||
Reference in New Issue
Block a user