Skip to content

Add FastAPI backend for Form a Pauper#5

Open
waymbers wants to merge 1 commit intomainfrom
codex/complete-backend-for-waymbers/formapauper
Open

Add FastAPI backend for Form a Pauper#5
waymbers wants to merge 1 commit intomainfrom
codex/complete-backend-for-waymbers/formapauper

Conversation

@waymbers
Copy link
Owner

@waymbers waymbers commented Nov 3, 2025

Summary

  • implement a FastAPI backend with configuration, database session management, and form/submission models backed by SQLModel
  • add health and template APIs including validation for submissions and template rendering helpers
  • document setup steps and provide pytest coverage for the new backend endpoints

Testing

  • pytest

https://chatgpt.com/codex/tasks/task_e_68f39bdae85883248de1cf11f6de994a

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +23 to +27
@router.post("/templates", response_model=FormTemplateRead, status_code=status.HTTP_201_CREATED)
def create_template(template_in: FormTemplateCreate, db: Session = Depends(get_db)) -> FormTemplate:
template = FormTemplate(**template_in.model_dump(by_alias=True))
db.add(template)
db.commit()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Badge Convert template field models before persisting JSON

The POST handler for /templates instantiates FormTemplate directly from the incoming payload and persists it, but FormTemplate.fields is a list[FieldDefinition] backed by a JSON column. Committing a model that still contains FieldDefinition instances causes SQLAlchemy to run json.dumps on pydantic objects and raise TypeError: Object of type FieldDefinition is not JSON serializable, so template creation fails for all requests. The fields need to be converted to plain dicts (or run through jsonable_encoder) before storing them in the JSON column.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant