Merge pull request #1453 from Tria-plc/freight_feature/usermanagement

Freight feature/usermanagement
This commit is contained in:
marshal
2026-08-29 10:40:53 +03:00
committed by GitHub
66 changed files with 6593 additions and 337 deletions

View File

@@ -993,13 +993,25 @@ export const api = {
),
cancelRemainingWagons: endpoint<
{ bookingId: string; scheduleId: string; reason: string; edrFault?: boolean },
{
bookingId: string;
scheduleId: string;
reason: string;
edrFault?: boolean;
/** Cut only these never-loaded wagons; omit for the whole remainder. */
wagonAllocationIds?: string[];
},
unknown
>(
"train-scheduling",
"cancel-remaining-wagons",
({ bookingId, scheduleId, reason, edrFault }) =>
trainSchedulingService.cancelRemainingWagons(bookingId, { scheduleId, reason, edrFault }),
({ bookingId, scheduleId, reason, edrFault, wagonAllocationIds }) =>
trainSchedulingService.cancelRemainingWagons(bookingId, {
scheduleId,
reason,
edrFault,
wagonAllocationIds,
}),
undefined,
() => TRAIN_SCHEDULING_INVALIDATIONS,
),

View File

@@ -546,7 +546,12 @@ export const trainSchedulingService = {
cancelRemainingWagons: async (
bookingId: string,
payload: { scheduleId: string; reason: string; edrFault?: boolean },
payload: {
scheduleId: string;
reason: string;
edrFault?: boolean;
wagonAllocationIds?: string[];
},
): Promise<unknown> => {
const response = await client.post(
URL_CONSTANTS.TRAIN_SCHEDULING.CANCEL_REMAINING_WAGONS(bookingId),

View File

@@ -1,5 +1,6 @@
import { api } from "../auth/http";
import { api as apiClient } from "../auth/http";
import { URL_CONSTANTS } from "../constants/URLS";
import type { ResetChannel } from "../types/shippingLineCompany";
export interface TransitAgent {
id: string;
@@ -7,14 +8,53 @@ export interface TransitAgent {
validFrom: string;
validTo: string;
isActive: boolean;
/** Null on every agent that exists only as a GL-assignable roster entry. */
email?: string | null;
phoneNumber?: string | null;
/** True once an IAM account backs the agent — i.e. it can sign in. */
hasAccount?: boolean;
}
export interface InviteTransitAgentDto {
email: string;
phoneNumber?: string;
username?: string;
}
/** What the API reports back about an activation send. */
export interface ActivationSendResult {
maskedTarget: string;
channel: string;
expiresAt: string;
}
export const transitAgentsService = {
/** Active + currently inside its validity window — the assignment dropdown. */
async listAssignable() {
const response = await api.get<TransitAgent[]>(
const response = await apiClient.get<TransitAgent[]>(
URL_CONSTANTS.RULE_ENGINE.TRANSIT_AGENTS_ASSIGNABLE,
);
return response.data;
},
/**
* Create the portal account for an agent that has none and send its
* activation link. Separate from the rule-engine CRUD update because it mints
* an IAM user, which a field edit must never do implicitly.
*/
async invite(id: string, dto: InviteTransitAgentDto) {
const response = await apiClient.post<{
agent: TransitAgent;
activationSentTo: string | null;
}>(URL_CONSTANTS.RULE_ENGINE.TRANSIT_AGENT_INVITE(id), dto);
return response.data;
},
async resendActivation(id: string, channel: ResetChannel) {
const response = await apiClient.post<ActivationSendResult>(
URL_CONSTANTS.RULE_ENGINE.TRANSIT_AGENT_RESEND_ACTIVATION(id),
{ channel },
);
return response.data;
},
};