This commit is contained in:
2025-11-22 11:38:07 +03:30
parent 6905fb2cdc
commit cab0c75158
4 changed files with 38 additions and 7 deletions
@@ -4,6 +4,7 @@ import { Schedule } from '../entities/schedule.entity';
import { ScheduleRepository } from '../repositories/schedule.repository';
import { CreateScheduleDto } from '../dto/create-schedule.dto';
import { UpdateScheduleDto } from '../dto/update-schedule.dto';
import { FindSchedulesDto } from '../dto/find-schedules.dto';
import { RestRepository } from '../repositories/rest.repository';
// import { RestMessage } from 'src/common/enums/message.enum';
@@ -34,8 +35,13 @@ export class ScheduleService {
return schedule;
}
async findAll(restId?: string): Promise<Schedule[]> {
const where = restId ? { restId } : {};
async findAll(restId?: string, query?: FindSchedulesDto): Promise<Schedule[]> {
const where: any = restId ? { restId } : {};
if (query?.weekDay) {
where.weekDay = query.weekDay;
}
return this.scheduleRepository.find(where, { orderBy: { weekDay: 'asc' } });
}