Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View one form page #39

Merged
merged 8 commits into from
Apr 13, 2023
Merged

View one form page #39

merged 8 commits into from
Apr 13, 2023

Conversation

megandouli
Copy link
Contributor

@megandouli megandouli commented Apr 12, 2023

ℹ️ Issue

Part one of two for #34

📝 Description

Big changes:

  • Changed backend and frontend schema so zipcode is a string (if it's a number, it strips out leading 0's)

  • Added a top-level id field to each document - this is generated by uuid prior to insertion of the document in the database

  • Added a top-level adminNotes field on the schema (for future work on Create PATCH endpoint to update a single form #36 tbh I just got lazy about separating commits) - this defaults to an empty array on the frontend form page

  • Added a get endpoint on the backend to fetch form details using the ID of a document - @Mo-sissoko this endpoint will also have to be protected!

  • Updated the formData type to match the validation schema used on the frontend - this required a small change to @reardon-co 's work on the hook in useSortingAndFiltering.ts

  • Created a new frontend page at /form/{documentID}

✔️ Verification

  1. Deploy the backend: in apps/backend run npm run build && sam deploy --guided --capabilities CAPABILITY_NAMED_IAM
  2. Update the BASE_URL in endpoints.ts to be the URL of the newly deployed backend.
  3. Run the frontend: nx serve frontend from the root project directory
  4. Visit localhost:4200/form and submit a form
  5. Visit the AWS console and query QLDB to obtain the ID of the newly inserted document: select * from TestTable;
  6. Visit localhost:4200/form/{id}

image

image

Page when the document ID doesn't exist / something goes wrong with fetching the data:

image

🏕️ (Optional) Future Work / Notes

  • Lots of duplicated code in the backend endpoints - should probably be abstracted

jackielincroft
jackielincroft previously approved these changes Apr 13, 2023
Copy link
Contributor

@jackielincroft jackielincroft left a comment

Choose a reason for hiding this comment

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

YAYYYYYY 🥳

Copy link
Contributor

@jackielincroft jackielincroft left a comment

Choose a reason for hiding this comment

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

🥳

@megandouli megandouli merged commit 66f4792 into main Apr 13, 2023
@megandouli megandouli deleted the ml-view-one-form branch April 13, 2023 22:55
@megandouli megandouli mentioned this pull request Apr 15, 2023
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