Service Layer medium complexity backend
1
Dependencies
1
Dependents
2
Entities
0
Integrations

Description

Backend service (Next.js REST endpoint) that stores and serves per-organization form schemas as JSON configuration objects, defining which report fields are visible and which are mandatory. Handles creation and retrieval of completed activity_report records, serializing the submitted form payload as a JSON blob into the database and linking it one-to-one to the parent activity.

Feature: Formalized Home-Visit Report

report-template-service

Sources & reasoning

The implementation notes specify a backend JSON configuration that determines which fields appear and which are mandatory per organization - supporting Blindeforbundet's epikrise context and Barnekreftforeningen's family-situation focus without code branches. A dedicated service component is required to own this schema delivery and report persistence contract separately from the general Activity Service.

No source references — this artifact was included based on reasoning alone (see above).

Responsibilities

  • Serve organization-specific report schema JSON keyed by org ID
  • Persist completed report form data as JSON blob in activity_reports
  • Enforce one-to-one constraint between activity and activity_report at write time
  • Validate submitted payload against the active org schema before saving
  • Expose report records for future coordinator review workflow in Admin Web Portal

Interfaces

GET /api/v1/report-templates/:orgId -> ReportSchema
POST /api/v1/activities/:activityId/report -> ActivityReport
GET /api/v1/activities/:activityId/report -> ActivityReport
PUT /api/v1/report-templates/:orgId -> ReportSchema

Relationships

Dependencies (1)

Components this component depends on

Dependents (1)

Components that depend on this component

Related Data Entities (2)

Data entities managed by this component