changes on transit agent

This commit is contained in:
marshal
2026-09-08 06:58:14 +00:00
parent 92697386e4
commit 850e0753d2
14 changed files with 1528 additions and 115 deletions

View File

@@ -74,6 +74,20 @@ export class TransitAgentsController {
return this.transitAgentsService.findForwarderOptions();
}
/**
* The Djibouti roster, id + name only, for the clearing agent on a booking
* to name the transit officer. Also before `:id` for the same reason.
*/
@Get("djibouti-options")
@PortalCustomer()
@ApiOperation({
summary:
"List active Djibouti transit agents (id + name) an assigned clearing agent can hand the transit leg to",
})
findDjiboutiOptions() {
return this.transitAgentsService.findDjiboutiOptions();
}
@Get(":id")
@RuleEngineView("transit-agents")
@ApiOperation({ summary: "Get a transit agent by ID" })

View File

@@ -41,6 +41,19 @@ export class TransitAgentsRepository extends BaseRepository<TransitAgent> {
});
}
/**
* The Djibouti roster, `{ id, name }` only, for the clearing agent on a
* booking to hand the transit leg to — served to portal customers, so no
* contact details. Suspended officers are left out.
*/
findDjiboutiOptions(): Promise<ForwarderTransitAgentOption[]> {
return this.repository.find({
select: { id: true, name: true },
where: { isActive: true, country: TransitAgentCountry.Djibouti },
order: { name: "ASC" },
});
}
/** The transit agent signed in as `userId`, or null for any other account. */
findByUserId(userId: string): Promise<TransitAgent | null> {
return this.repository.findOne({ where: { userId } });

View File

@@ -114,6 +114,11 @@ export class TransitAgentsService {
return this.transitAgentsRepository.findForwarderOptions();
}
/** The Djibouti roster an assigned clearing agent picks the transit officer from. */
findDjiboutiOptions(): Promise<ForwarderTransitAgentOption[]> {
return this.transitAgentsRepository.findDjiboutiOptions();
}
async findById(id: string): Promise<TransitAgentView> {
const agent = await this.transitAgentsRepository.findById(id);
if (!agent) {