fix: locomotive filtering

This commit is contained in:
Nathnael
2026-08-24 08:21:29 +00:00
parent 2e5dadeee9
commit eba09c73ae

View File

@@ -12,7 +12,10 @@ function baseQuery(ctx: ReportContext): SelectQueryBuilder<ObjectLiteral> {
.createQueryBuilder()
.from(Locomotive, 'l')
.leftJoin(Yard, 'y', 'y.id = l.current_yard_id')
.where('l.deleted_at IS NULL');
.where('l.deleted_at IS NULL')
// Names ending '#' are excluded from the fleet report by request; the
// marker is a roster convention, not a column the schema tracks.
.andWhere("COALESCE(l.name, '') NOT LIKE '%#'");
const statuses = params.statuses as string[] | null;
if (statuses) qb.andWhere('l.status IN (:...statuses)', { statuses });