Move Report Writer schemas to backend server
Objective
- Establish one server-managed source of truth for Report Writer report-template and comment-template data models, so web and mobile do not diverge on shape, validation, or defaults.
- Unblock later Report Writer work (sync, permissions, versioning, etc.) by getting schemas and persistence onto the backend before more product logic stacks on client-only definitions.
Background
- Product/engineering direction (May 15 feature sync): Ben called out moving report template and comment template schemas to the backend as an early separation-of-concerns step—Mongoose-backed models with routes served from the API, since both clients will consume them.
- This work is intentionally server-first and separate from the near-complete Report Writer MVP on front-end/mobile so ownership and sequencing stay clear.
- Repo audit note: Under obvious names (
ReportWriter,reportWriter,ReportTemplate,CommentTemplate, path globs for*report*writer*), no Report Writer–specific modules showed up inattik-frontend,attik-backend, orattik-mobilein this workspace snapshot—likely the MVP lives on another branch or uses different naming. Decision needed: point this ticket at the actual current schema files (paths + PR) once identified so implementers are not searching blind.
Scope
Backend
- Add or relocate Mongoose schemas and persistence for report templates and comment templates under the normal backend patterns (e.g. new or moved modules under
attik-backend/src/models/and registration with the app’s model index if the codebase uses one). - Expose HTTP routes for CRUD (or read-only first, per product) consistent with existing
attik-backend/src/routes/patterns—auth, company scoping, andrequestErrorhandling should match neighboring integrations. - Decision needed: API contract shape (JSON fields, IDs, soft delete, versioning) and whether Zod (or similar) remains on clients only as a thin mirror of server responses vs generated types.
Frontend
- Replace any in-repo template/comment template Zod or TS types that duplicate server truth with calls to the new endpoints and types derived from API responses (exact files Decision needed once MVP paths are linked).
- Update any Report Writer UI or hooks that today assume local-only schemas.
Mobile
- Same consumption pattern as web: fetch/mutate via API, no standalone canonical schema for templates if the backend is source of truth.
Cross-cutting
- Align with owners of the in-flight Report Writer MVP so merges do not fork template definitions (coordination only—no step-by-step plan here).
References
- May 15 feature sync (Ben): report/comment template schemas belong on the server first; separation of concerns before more build-out on top.
- Established backend patterns live under
attik-backend/src/models/andattik-backend/src/routes/(concrete Report Writer paths Decision needed after branch locate).
Status: Completed
Log in to comment and vote
No comments yet
Be the first to share your thoughts.