up
This commit is contained in:
@@ -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' } });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user