mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-28 23:00:59 +00:00
Adding more functionalities for all the license types
This commit is contained in:
@@ -308,6 +308,39 @@ export const licensingApi = baseApi
|
||||
}),
|
||||
|
||||
// ------------------------------------------------------------ licences
|
||||
/**
|
||||
* Public QR-code verification (US-PORTAL-008). No auth required —
|
||||
* the endpoint returns only what a verifier needs to trust the
|
||||
* document, never the holder's contact details.
|
||||
*/
|
||||
verifyCertificate: builder.query<
|
||||
{
|
||||
valid: boolean;
|
||||
reason?: string;
|
||||
certificateNumber?: string;
|
||||
licenseType?: string | null;
|
||||
companyName?: string | null;
|
||||
issueDate?: string;
|
||||
expiryDate?: string;
|
||||
status?: string;
|
||||
},
|
||||
string
|
||||
>({
|
||||
query: (code) => ({ url: `/licenses/verify/${code}` }),
|
||||
}),
|
||||
|
||||
/** The licence register for enforcement officers. */
|
||||
getLicenses: builder.query<
|
||||
Paginated<IssuedLicense>,
|
||||
{ search?: string } | void
|
||||
>({
|
||||
query: (args) => ({
|
||||
url: '/licenses',
|
||||
params: args?.search ? { search: args.search } : undefined,
|
||||
}),
|
||||
providesTags: () => [listTag('License')],
|
||||
}),
|
||||
|
||||
getMyLicenses: builder.query<Paginated<IssuedLicense>, void>({
|
||||
query: () => ({ url: '/licenses/mine' }),
|
||||
providesTags: () => [listTag('License')],
|
||||
@@ -693,12 +726,24 @@ export const licensingApi = baseApi
|
||||
|
||||
recordInspectionResult: builder.mutation<
|
||||
Inspection,
|
||||
{ inspectionId: string; applicationId: string; result: 'PASSED' | 'FAILED'; findings: string }
|
||||
{
|
||||
inspectionId: string;
|
||||
applicationId: string;
|
||||
result: 'PASSED' | 'FAILED';
|
||||
findings: string;
|
||||
/** Structured per-item outcomes (office, warehouse, vehicles, …). */
|
||||
checklist?: {
|
||||
key: string;
|
||||
label: string;
|
||||
outcome: 'PASS' | 'FAIL' | 'NEEDS_CORRECTION';
|
||||
note?: string;
|
||||
}[];
|
||||
}
|
||||
>({
|
||||
query: ({ inspectionId, result, findings }) => ({
|
||||
query: ({ inspectionId, result, findings, checklist }) => ({
|
||||
url: `/inspections/${inspectionId}/result`,
|
||||
method: 'PATCH',
|
||||
body: { result, findings },
|
||||
body: { result, findings, ...(checklist?.length ? { checklist } : {}) },
|
||||
}),
|
||||
invalidatesTags: (_r, error, { applicationId }) =>
|
||||
error ? [] : [itemTag('LicenseApplication', applicationId), listTag('Inspection')],
|
||||
@@ -724,6 +769,7 @@ export const licensingApi = baseApi
|
||||
});
|
||||
|
||||
export const {
|
||||
useVerifyCertificateQuery,
|
||||
useGetLicenseTypesQuery,
|
||||
useGetLicenseCategoriesQuery,
|
||||
useUpdateLicenseFeesMutation,
|
||||
@@ -736,6 +782,7 @@ export const {
|
||||
useBypassPaymentMutation,
|
||||
useGetPaymentCapabilitiesQuery,
|
||||
useGetMyLicensesQuery,
|
||||
useGetLicensesQuery,
|
||||
useGetCertificateUrlMutation,
|
||||
useGetApplicationPaymentQuery,
|
||||
usePatchSectionMutation,
|
||||
|
||||
Reference in New Issue
Block a user