Declarations Repository
Component Detail
Data Layer
low complexity
backend
0
Dependencies
1
Dependents
0
Entities
0
Integrations
Description
Data access layer for signed declaration records. Provides CRUD operations against the declarations table in PostgreSQL, enforcing the association between a signed record and its user, organisation, and linked activity or assignment. Also exposes read access to organisation-specific declaration templates stored in organisation_settings.
declarations-repository
Responsibilities
- Persist signed declaration records with userId, orgId, activityId or assignmentId, and UTC timestamp
- Query declaration status per user and per activity or assignment
- Retrieve the active declaration template for a given organisation
- Support coordinator and admin queries for declaration audit trails
Interfaces
insertSignedDeclaration(declaration: SignedDeclaration): Future<String>
findByUserAndActivity(userId, activityId): Future<SignedDeclaration?>
findByUserAndAssignment(userId, assignmentId): Future<SignedDeclaration?>
getTemplateByOrg(orgId): Future<DeclarationTemplate>
listDeclarationsByOrg(orgId, page, pageSize): Future<List<SignedDeclaration>>