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 and APIs #83

Open
4 of 6 tasks
Safewaan opened this issue Jun 4, 2023 · 0 comments
Open
4 of 6 tasks

Create Buildings Table and APIs #83

Safewaan opened this issue Jun 4, 2023 · 0 comments
Assignees
Labels
Resident Directory Features related to the resident dir

Comments

@Safewaan
Copy link
Collaborator

Safewaan commented Jun 4, 2023

Summary

Currently, we have our buildings hard-coded across the application. Ideally, these should be stored in the db.

Goals

  • Create a new model called buildings, here is what the schema should look like

    building_id: # ObjectId
    address: # String
    building_name: # String
    

    This is just a rough schema, open to suggestions. The difference between address and building_name is that the address is the location of the building, and the building_name is the nickname of the building. For example, an address of a building may be "144 Erb St. East" and the building_name may be "144".

  • Make sure the buildings SHOW currently uses belongs in the model as well (meaning, when the migration is run, the table will also have the three buildings)

  • Update the residents table to use the building_id from the new table

  • Create CRUD endpoints for the buildings table
    Delete might be tricky since if a resident is assigned to a building, you won't be able to delete that building due to foreign key constraints. I'm open to what a feasible approach to this is, here are my thoughts:
    Approach 1: Delete the building if there are no residents linked to it. If there are residents linked to it, throw some error where the user is informed that the delete failed as residents are linked to the building. This would involve a lot of error handling and front-end work.
    Approach 2: Add a status column to the table, to "deactivate" the building. I don't like this approach, because we have to also add an "activate" building setting. Also, some residents may be living in a deactivated building, which doesn't make sense.

  • Update the log_records model to use the building table

  • Add documentation for the model and endpoints

Implementation

  • Refer to our models and APIs in the codebase
@Safewaan Safewaan added the Resident Directory Features related to the resident dir label Jun 4, 2023
@helenellyx helenellyx self-assigned this Jun 7, 2023
@helenellyx helenellyx mentioned this issue Jun 27, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resident Directory Features related to the resident dir
Projects
None yet
Development

No branches or pull requests

2 participants