mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-29 01:20:56 +00:00
feat(biometric-enrollment): add biometric enrollment feature with API integration and UI components
This commit is contained in:
@@ -6,6 +6,7 @@ export * from './lib/features/location';
|
||||
export * from './lib/features/seafarer';
|
||||
export * from './lib/features/seafarer-registration';
|
||||
export * from './lib/features/seafarer-document';
|
||||
export * from './lib/features/biometric-enrollment';
|
||||
export * from './lib/features/vessel';
|
||||
export { baseQueryWithReauth, configureTokenRefresh } from './lib/base-api/base-query-with-reauth';
|
||||
export { openAuthedDocument, downloadAuthedFile } from './lib/base-api/download';
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { baseApi } from '../../base-api';
|
||||
import type { BiometricEnrollment, EnrollBiometric } from './biometric-enrollment.types';
|
||||
|
||||
const TAG = 'BiometricEnrollment' as const;
|
||||
const forProfile = (profileId: string) => ({ type: TAG, id: profileId }) as const;
|
||||
|
||||
/**
|
||||
* Scanner capture (fingerprint, face) stored per profile. No applicant-facing
|
||||
* endpoint — enrollment happens at a counter with a scanner.
|
||||
*/
|
||||
export const biometricEnrollmentApi = baseApi
|
||||
.enhanceEndpoints({ addTagTypes: [TAG] })
|
||||
.injectEndpoints({
|
||||
endpoints: (builder) => ({
|
||||
enrollBiometric: builder.mutation<BiometricEnrollment, EnrollBiometric>({
|
||||
query: (body) => ({ url: '/biometric-enrollments', method: 'POST', body }),
|
||||
invalidatesTags: (r, error) => (error || !r ? [] : [forProfile(r.profileId)]),
|
||||
}),
|
||||
|
||||
getBiometricEnrollments: builder.query<BiometricEnrollment[], string>({
|
||||
query: (profileId) => ({ url: `/biometric-enrollments/profile/${profileId}` }),
|
||||
providesTags: (_r, _e, profileId) => [forProfile(profileId)],
|
||||
}),
|
||||
|
||||
revokeBiometricEnrollment: builder.mutation<
|
||||
BiometricEnrollment,
|
||||
{ id: string; profileId: string; reason: string }
|
||||
>({
|
||||
query: ({ id, reason }) => ({
|
||||
url: `/biometric-enrollments/${id}/revoke`,
|
||||
method: 'POST',
|
||||
body: { reason },
|
||||
}),
|
||||
invalidatesTags: (_r, error, { profileId }) => (error ? [] : [forProfile(profileId)]),
|
||||
}),
|
||||
}),
|
||||
overrideExisting: false,
|
||||
});
|
||||
|
||||
export const {
|
||||
useEnrollBiometricMutation,
|
||||
useGetBiometricEnrollmentsQuery,
|
||||
useRevokeBiometricEnrollmentMutation,
|
||||
} = biometricEnrollmentApi;
|
||||
@@ -0,0 +1,32 @@
|
||||
export type BiometricModality = 'FINGERPRINT' | 'FACE';
|
||||
export type BiometricEnrollmentStatus = 'ACTIVE' | 'REVOKED';
|
||||
|
||||
export interface BiometricEnrollment {
|
||||
id: string;
|
||||
profileId: string;
|
||||
modality: BiometricModality;
|
||||
templateFormat: string;
|
||||
qualityScore: number | null;
|
||||
deviceId: string | null;
|
||||
status: BiometricEnrollmentStatus;
|
||||
enrolledById: string;
|
||||
enrolledAt: string;
|
||||
consentAt: string;
|
||||
revokedReason: string | null;
|
||||
revokedById: string | null;
|
||||
revokedAt: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface EnrollBiometric {
|
||||
profileId: string;
|
||||
modality: BiometricModality;
|
||||
/** Vendor SDK template, base64. Never the raw scan image. */
|
||||
template: string;
|
||||
templateFormat: string;
|
||||
qualityScore?: number;
|
||||
deviceId?: string;
|
||||
/** ISO 8601 — when the subject consented to capture. */
|
||||
consentAt: string;
|
||||
}
|
||||
2
libs/api/src/lib/features/biometric-enrollment/index.ts
Normal file
2
libs/api/src/lib/features/biometric-enrollment/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './biometric-enrollment.types';
|
||||
export * from './biometric-enrollment-api';
|
||||
@@ -47,6 +47,8 @@ export const LICENSE_PERMISSIONS = {
|
||||
MANAGE_SEAFARER_STATUS: "can:manage:seafarer-status",
|
||||
VIEW_SEAFARER_REGISTRY: "can:View:seafarer-registry",
|
||||
VERIFY_SEAFARER_RECORDS: "can:verify:seafarer-records",
|
||||
ENROLL_BIOMETRICS: "can:enroll:biometrics",
|
||||
VIEW_BIOMETRICS: "can:View:biometrics",
|
||||
VIEW_VESSEL_REGISTRY: "can:View:vessel-registry",
|
||||
MANAGE_VESSEL_STATUS: "can:manage:vessel-status",
|
||||
APPROVE_QUESTION: "can:approve:exam-question",
|
||||
|
||||
Reference in New Issue
Block a user