mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 09:58:12 +00:00
enhance contract and booking services with server-side search and validation improvements
- Added parameter to and for server-side free-text search on contract reference, company name, and booking details. - Introduced new validation errors in for container clashes and space issues when creating bookings. - Implemented paginated dropdown settings retrieval in . - Updated to fetch active yards using a new method that handles pagination. - Enhanced with a method to fetch all records by walking through pages. - Refactored to support filtering and pagination in schedule listings. - Improved to return a paginated list of facilities. - Updated UI components in and to utilize debounced search inputs for better performance. - Added alerts in to inform users about booking constraints related to splits and capacity. - Enhanced to display notifications for split bookings and capacity usage.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { BaseRepository } from "@edr/api-common";
|
||||
import { PaginatedResponse } from "@edr/types";
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { InjectRepository } from "@nestjs/typeorm";
|
||||
import { Repository } from "typeorm";
|
||||
|
||||
import { paginateQuery } from "../../common/utils/pagination.util";
|
||||
import { ListDropdownSettingsQueryDto } from "./dto/list-dropdown-settings-query.dto";
|
||||
import { DropdownOption } from "./entities/dropdown-option.entity";
|
||||
import { DropdownSetting } from "./entities/dropdown-setting.entity";
|
||||
import type { IDropdownSettingsRepository } from "./interfaces/dropdown-settings.repository.interface";
|
||||
@@ -44,6 +47,27 @@ export class DropdownSettingsRepository
|
||||
});
|
||||
}
|
||||
|
||||
findPaged(
|
||||
query: ListDropdownSettingsQueryDto,
|
||||
): Promise<PaginatedResponse<DropdownSetting>> {
|
||||
// Soft-deleted rows are excluded automatically by the query builder
|
||||
// (BaseEntity's deletedAt column). Ordering mirrors findAll (label ASC).
|
||||
const qb = this.repository
|
||||
.createQueryBuilder("setting")
|
||||
.leftJoinAndSelect("setting.children", "option")
|
||||
.orderBy("setting.label", query.sortOrder ?? "ASC")
|
||||
.addOrderBy("option.order", "ASC");
|
||||
|
||||
if (query.search) {
|
||||
qb.andWhere(
|
||||
"(setting.code ILIKE :search OR setting.label ILIKE :search OR setting.description ILIKE :search)",
|
||||
{ search: `%${query.search}%` },
|
||||
);
|
||||
}
|
||||
|
||||
return paginateQuery(qb, query);
|
||||
}
|
||||
|
||||
async replaceOptions(
|
||||
settingId: string,
|
||||
options: Array<Partial<DropdownOption>>,
|
||||
|
||||
Reference in New Issue
Block a user