feat(kyc): add DB-level uniqueness for liveness checksFeat/add kyc review dtos
This MR strengthens KYC liveness data integrity by enforcing a strict one-to-one mapping between a KYC request and its liveness session.
What changed
- Updated
LivenessCheckmodel:-
kyc_idset toNOT NULL+UNIQUE -
session_idset toNOT NULL+UNIQUE - Added explicit unique constraints:
uk_liveness_check_kyc_iduk_liveness_check_session_id
-
- Added migration:
V0_0_6__liveness_check_unique_constraints.sql
Migration logic The migration:
- Removes duplicate rows for
kyc_idandsession_id(keeps a single record per key). - Applies
NOT NULLconstraints. - Creates unique constraints if they do not already exist.
Without database-level uniqueness, liveness lookups by kyc_id or session_id can become ambiguous and may trigger runtime issues (e.g. non-unique result errors) or inconsistent behavior.
Impact
- Ensures deterministic lookups for liveness records.
- Improves consistency and reliability of KYC liveness workflows.
- Backward-compatible for consumers using single-record semantics.