Skip to content

update ranked_cards col type to IDs array #133

@InayaY3

Description

@InayaY3

yayy first sprint of the sem!! 🥳

This week (aside from fixing your old sprint), you’ll be updating our ranked_cards column in the adopter_applications_dummy table to be an array of strings with the 4 matched inmate’s IDs.

Currently, it’s a column of JSON arrays that is upserted to the table in findMatches.ts, which was introduced in Jinkang’s PR last sem. To fix this,

  1. Update findMatches.ts to only upsert the IDs.
  2. Update ApplicationState
  3. Create a new function in query.ts called fetchAdopteeCardsInfo that takes in an array of inmate IDs and returns the information needed for rendering each card in the RankedAdopteeMatch[] format. We’ll probably add an age col in the future but just calculate it for now.
  4. Update the components (like MatchingCard.tsx) that rely on the current JSON format for rendering the adoptee cards to now use your new query.
  5. Make the necessary changes to the table, and regenerate the types in database.types.ts to match. If you haven’t regenerated types before: make sure you define PROJECT_ID in your .env file, login with the Supabase CLI, then run pnpm gen-schema.

Feel free to clear the data for that col in adopter_applications_dummy if it gives you errors, and then test those rows by using the app IDs.

Let me know if you have questions!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions