Skip to content

Apply routes → services → repositories layering to forms (#640, part 1) - #652

Merged
marcvergees merged 1 commit into
fireform-core:development-approach-bfrom
abhishek-8081:issue-640-forms-templates-layering
Aug 8, 2026
Merged

Apply routes → services → repositories layering to forms (#640, part 1)#652
marcvergees merged 1 commit into
fireform-core:development-approach-bfrom
abhishek-8081:issue-640-forms-templates-layering

Conversation

@abhishek-8081

Copy link
Copy Markdown
Collaborator

Part 1 of #640 (forms; templates follow in part 2).

Applies the routes → services → repositories layering to the forms routes:

  • New FormService (app/services/form.py) matching the InputService pattern — holds the
    fill orchestration (resolves transcript, calls the existing Controller unchanged,
    persists via repository), the submissions list, analytics, and purge logic.
  • The 3 inline DB queries moved from forms.py into repository functions (get_submissions,
    get_submissions_with_template, get_submissions_before).
  • forms.py routes are now thin: parse → FormService → return. HTTP concerns (404 template
    check, 500 Controller-exception wrapping, AppError bubbling) stay in the route.
  • Controller is unchanged — the service calls it, doesn't absorb it.

Behavior unchanged — 152 tests pass with only mock-location changes (Controller/PROJECT_ROOT
now patched at their new service location), no response-assertion changes. ruff check app/
clean. No direct DB queries remain in forms.py.

Known follow-up: _resolve_project_file/PROJECT_ROOT is temporarily duplicated between
forms.py (untouched delete endpoint) and form.py (purge) — will consolidate when the delete
endpoint moves to the service.

Templates layering is part 2 (separate PR).

@marcvergees
marcvergees merged commit 27c94f9 into fireform-core:development-approach-b Aug 8, 2026
2 checks passed
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.

2 participants