mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 12:28:21 +00:00
changes on transit agent
This commit is contained in:
@@ -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" })
|
||||
|
||||
@@ -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 } });
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user