mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 11:21:18 +00:00
25 lines
756 B
TypeScript
25 lines
756 B
TypeScript
import { BaseRepository } from '@edr/api-common';
|
|
import { Injectable } from '@nestjs/common';
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
import { Repository } from 'typeorm';
|
|
|
|
import { TrainCheckpointEvent } from './entities/train-checkpoint-event.entity';
|
|
|
|
@Injectable()
|
|
export class TrainCheckpointEventsRepository extends BaseRepository<TrainCheckpointEvent> {
|
|
constructor(
|
|
@InjectRepository(TrainCheckpointEvent)
|
|
repository: Repository<TrainCheckpointEvent>,
|
|
) {
|
|
super(repository);
|
|
}
|
|
|
|
findBySchedule(trainScheduleId: string): Promise<TrainCheckpointEvent[]> {
|
|
return this.findAll({
|
|
where: { trainScheduleId },
|
|
relations: { yard: true },
|
|
order: { sequenceNo: 'ASC', occurredAt: 'ASC' },
|
|
});
|
|
}
|
|
}
|