Nonprofit-Exchange-Hub/web-app

create user<>category many to many relationship

jd2rogers2 opened this issue · 0 comments

https://typeorm.io/many-to-many-relations
https://www.figma.com/file/K7DT5jYcLKRc9epmNrO0N7/UX---Dev-Handoff?node-id=1%3A5&t=KBL3uAJiic12yMlD-0
Image

when a user signs up they pick their "interests"
this is basically what kinds of initiatives/orgs they're interested in helping
we have a categories module/table

acceptance criteria:

  1. (using the category ids you get back from /api/categories) i can make a create user request and pass in a property of categories (your choice) and it will create user-category row(s), cols should be the user_id and category_id
    to do this add a many-to-many relationship to users and categories
    test that the row is being made either by completing step 2 or by using psql/pgadmin/beekeeperstudio and seeing the data in the db

  2. when i make a get request for the user, i also get back their categories in a list (this is what the categories property value should be [{ id: 1, name: 'disaster relief' }, ...])