mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 15:58:18 +00:00
fix
This commit is contained in:
@@ -37,6 +37,8 @@ export class RatesRepository implements IRatesRepository {
|
||||
containerTypeId?: string | null;
|
||||
cargoTypeId?: string | null;
|
||||
tradeDirection?: string | null;
|
||||
originYardId?: string | null;
|
||||
destinationYardId?: string | null;
|
||||
}): Promise<Rate | null> {
|
||||
const qb = this.repo
|
||||
.createQueryBuilder('rate')
|
||||
@@ -59,6 +61,18 @@ export class RatesRepository implements IRatesRepository {
|
||||
} else {
|
||||
qb.andWhere('rate.trade_direction IS NULL');
|
||||
}
|
||||
if (pattern.originYardId) {
|
||||
qb.andWhere('rate.origin_yard_id = :originYardId', { originYardId: pattern.originYardId });
|
||||
} else {
|
||||
qb.andWhere('rate.origin_yard_id IS NULL');
|
||||
}
|
||||
if (pattern.destinationYardId) {
|
||||
qb.andWhere('rate.destination_yard_id = :destinationYardId', {
|
||||
destinationYardId: pattern.destinationYardId,
|
||||
});
|
||||
} else {
|
||||
qb.andWhere('rate.destination_yard_id IS NULL');
|
||||
}
|
||||
|
||||
return qb.getOne();
|
||||
}
|
||||
@@ -75,6 +89,10 @@ export class RatesRepository implements IRatesRepository {
|
||||
findPaged(query: ListRatesQueryDto): Promise<PaginatedResponse<Rate>> {
|
||||
const qb = this.repo
|
||||
.createQueryBuilder('rate')
|
||||
// The admin table shows the leg a base-freight rate prices — without the
|
||||
// yards joined the route columns have only ids to render.
|
||||
.leftJoinAndSelect('rate.originYard', 'originYard')
|
||||
.leftJoinAndSelect('rate.destinationYard', 'destinationYard')
|
||||
.orderBy('rate.createdAt', query.sortOrder ?? 'DESC');
|
||||
|
||||
if (query.status) {
|
||||
|
||||
Reference in New Issue
Block a user