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

Create buildings table #125

Merged
merged 28 commits into from
Nov 5, 2023
Merged

Create buildings table #125

merged 28 commits into from
Nov 5, 2023

Conversation

helenellyx
Copy link
Contributor

@helenellyx helenellyx commented Jun 27, 2023

Helen's PR

GitHub Issue link

Create Buildings Table

Implementation description

  • Create Buildings table
  • Update the Residents and Log_records table to have building_id as a foreign key for the buildings table
  • Update the Residents and Log_records APIs to reflect this change
  • Add the three buildings on the SHOW website to the Buildings table whenever we initialize the database

Steps to test

  1. Check that Buildings table has the three building instances
  2. Check that Residents API still works (please refer to the notion docs)
  3. Check that Log_records API still works (please refer to the notion docs)

What should reviewers focus on?

  • preexisting API

Kelly's Edits

  • on backend, fixed apis to return building_id instead of building
  • in frontend, fixed API calls to use building_id instead of building
  • fixed adding, editing, filtering, counting log records to have parameter of building_id
  • fixed adding and editing resident to have parameter of building_id
  • edit existing scripts and added new one to create buildings

Steps to test

  1. Drop your database and create it again (so you can get the new buildings table)
  2. Run the scripts in repo read.me AND this new script bash ./seeding/create-buildings.sh
  3. Add residents
  4. Edit residents
  5. Filter log records
  6. Add log records
  7. Edit log records

What should reviewers focus on?

  • check functionality
  • check if script works

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR
  • If I have made API changes, I have updated the REST API Docs
  • IF I have made changes to the db/models, I have updated the Data Models Page
  • I have updated other Docs as needed

@Safewaan Safewaan added the back-end involves back-end work label Jun 27, 2023
@Safewaan Safewaan self-requested a review June 30, 2023 02:08
Copy link
Collaborator

@Safewaan Safewaan left a comment

Choose a reason for hiding this comment

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

still need to review the API changes but putting up review for the pre-population of building data

backend/app/models/__init__.py Outdated Show resolved Hide resolved
backend/app/rest/residents_routes.py Outdated Show resolved Hide resolved
@helenellyx helenellyx requested a review from Safewaan July 18, 2023 01:23
@helenellyx helenellyx requested a review from Safewaan July 20, 2023 22:58
Copy link
Collaborator

@Safewaan Safewaan left a comment

Choose a reason for hiding this comment

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

LGTM 🔥

There are 2 changes you need to make to the GET service for log_records, but other than that everything looks correct :D

Before merging, I would also just double-check that all changes services are working correctly.

helenellyx and others added 3 commits July 24, 2023 20:26
Co-authored-by: Safwaan Chowdhury <57375371+Safewaan@users.noreply.github.com>
…supportive-housing into helen/create-building-table
Copy link
Contributor

@phamkelly17 phamkelly17 left a comment

Choose a reason for hiding this comment

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

yas queen helen slay lgtm asf girlypop

@github-actions
Copy link

github-actions bot commented Oct 7, 2023

Visit the preview URL for this PR (updated for commit 0e9f68c):

https://blueprintsupportivehousing--pr125-helen-create-buildin-yw22mu1h.web.app

(expires Sun, 12 Nov 2023 19:30:45 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f6bcdba7452bf82a6ec1a299c37d1bdff7870d09

Copy link
Contributor

@phamkelly17 phamkelly17 left a comment

Choose a reason for hiding this comment

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

JK SO MANY THINGS ARE BROKEN... I'm working on it...

Copy link
Contributor

@phamkelly17 phamkelly17 left a comment

Choose a reason for hiding this comment

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

idk why i just approved my own pr lol

@phamkelly17
Copy link
Contributor

some things I noticed while doing this PR (future tickets):

  1. we hardcode BUILDINGS in front but do we want an API route to get all buildings? If so, need to make those endpoints
  2. in this PR, i tried to make it consistent and use building_id instead of building (which is a string). For example, LogRecords now have a building_id field instead of a building field. As a result, we don't readily have access to the building names.
Screen Shot 2023-10-08 at 10 57 54 PM so for example, this column in the table only has the resident building id instead of the building name. similar issue for the CSV so we'll have to address those. I think that we should be storing `building_id` in the tables but lmk what you guys think.

Copy link
Collaborator

@connor-bechthold connor-bechthold left a comment

Choose a reason for hiding this comment

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

sorry for the amount of comments 😅 helen was defo plotting so thanks for cleaning this up!!

with regards to your comments

  • you're right, we'll need a GET endpoint for getting all the buildings from the DB, but that can be done in a separate ticket
  • leaving as displaying the ID in the residents table is fine for now, but all we need to do is also get the building name when we're fetching a resident (similar to what we do when we're getting log records). however this can also be done in a separate ticket, and is apart of the reason why i want you to set up those relationship columns in the models

backend/app/models/buildings.py Show resolved Hide resolved
backend/app/models/log_records.py Show resolved Hide resolved
backend/app/models/residents.py Show resolved Hide resolved
frontend/src/components/pages/HomePage/HomePage.tsx Outdated Show resolved Hide resolved
frontend/src/components/pages/HomePage/HomePage.tsx Outdated Show resolved Hide resolved
seeding/create-buildings.sh Outdated Show resolved Hide resolved
seeding/create-buildings.sh Outdated Show resolved Hide resolved
seeding/create-buildings.sh Outdated Show resolved Hide resolved
Copy link
Collaborator

@connor-bechthold connor-bechthold left a comment

Choose a reason for hiding this comment

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

whoops running the linter blew the number of files changed but this is GOOD TO GO 🧑‍🍳

@phamkelly17 phamkelly17 self-requested a review November 5, 2023 19:29
@phamkelly17 phamkelly17 merged commit 211dc99 into main Nov 5, 2023
@phamkelly17 phamkelly17 deleted the helen/create-building-table branch November 5, 2023 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end involves back-end work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants