Skip to content

feat(duties-acknowledgement): records, states and the sheet of each worker's SSM duties, and document 13 kept from hand edits - #1215

Open
PCRinus wants to merge 8 commits into
mainfrom
feat/duties-acknowledgement-data
Open

PCRinus wants to merge 8 commits into
mainfrom
feat/duties-acknowledgement-data

Conversation

@PCRinus

@PCRinus PCRinus commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Step 4 of ADR 046, server side: each worker's acknowledgement sheet of their SSM duties (Legea 319/2006 art. 13 lit. d), H.G. 1425/2006 art. 15 alin. (1) pct. 4), signed on paper for now.

  • Records: table employee_duty_acknowledgements, migration 20261126100000_duty_acknowledgements.sql. A record holds the document 13 revision, the post and its annex number, the annex fingerprint, the roles with their fingerprints, the signing day, an optional scan (a client file) and who recorded it. Records are scoped to the organization, never updated (only deleted), and refused for archived clients.
  • State: view employee_duty_acknowledgement_states, compared against the latest issued document 13. The values are not_issued, no_annex, to_sign, signed and sign_again; sign_again carries the reason annex_changed or roles_changed. The API and both workers lists read this same view, through a new employee_list column and the dutiesAcknowledgement filter.
  • Who holds which role: the snapshot of document 13 now stores each role holder's employee id. The ids are never printed and are not in the fingerprints. A document 13 issued before this change reads as nobody holding a role until it is generated and issued again (accepted, since there are no real clients yet).
  • The sheet: template fisa_atributii_ssm.docx (per employee), built from the same wording as document 13 and drawn from the issued revision's snapshot. It is downloadable as PDF and Word.
  • Document 13 is no longer edited by hand: editable: false; Word upload, editor saves and "Modifică documentul emis" answer 409 document_not_editable; regenerating stays. Issue Remove Word upload from the client's documentation #1214 removes Word upload everywhere.

Merge together with the UI PR stacked on this one. On its own, the documents menu would still offer editing document 13 and the server would refuse it.

Evidence

  • A sample sheet for a workplace manager who is also designated for imminent danger (rendered locally).
  • Tests:
    • api: 3713 passing;
    • document-engine with the converter: 3181 passing;
    • app: 3059 passing;
    • pgTAP duty_acknowledgements: 26 passing;
    • typecheck, lint and the generated-files check are clean.
  • For a client with 300 employees and 30 posts, a list page computes the states in about 3 ms.

…et, its records, the list status and document 13 not editable
…'s state against the latest issued document 13, and the holders' ids in its snapshot
…ne worker's annex of document 13 with the roles they hold
…owledgements, draws up the sheet, lists and filters the state, and keeps document 13 from hand edits
…es' states, and the generated types hold only this branch's tables

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant