Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Expose House (and others) over API #29

Merged
merged 16 commits into from
Apr 3, 2019
Merged

Expose House (and others) over API #29

merged 16 commits into from
Apr 3, 2019

Conversation

mcab
Copy link
Owner

@mcab mcab commented Mar 31, 2019

No description provided.

@mcab
Copy link
Owner Author

mcab commented Mar 31, 2019

Seems like this requires a lot of knowledge about serialization.

Allows us to serialize House from DB, and at least C / R it from
database. Also has conditional logic applied so that if property_type ==
"OT" (Other), then other_property_type must be specified, along with
additional field checks.
@mcab
Copy link
Owner Author

mcab commented Mar 31, 2019

In order for this to work, we probably will need another Serializer for HouseInformation.

This can be used as an optional parameter passed with the House one, or standalone on a different path (house/information?)

Something of the sorts. For now, we have it at least Authenticated, and need to have a Permission that is AuthenticatedAndOwnerOrAdmin or something like that.

@mcab
Copy link
Owner Author

mcab commented Apr 1, 2019

HouseEnvironmentFeatures got a ViewSet, but the problem is routing properly for it.

We need to be able to:

  • GET the most recent environment features for that house (nested in House ViewSet)
  • GET a LIST of all the environment features for that house (list view on HouseEnvironmentFeatureViewSet, probably GET /api/v1/house/{pk}/environment)
  • POST to /api/v1/house/{pk}/environment to create a HouseEnvironmentFeatures, tied to that PK.
  • PUT/PATCH? to /api/v1/house/{house pk}/environment/{environment pk} with some revision add-on so that we can view / edit certain traits.

Maybe we don't even need to implement DELETE. Ideally, we keep the records, so that we can map changes to the environment / physical bathouse.


We want to probably do this by nesting ViewSets [1] [2]. This then extends to physical features, and we can then start mocking out what Flightplan expects.

@mcab mcab changed the title WIP: Expose House (and others) over API Expose House (and others) over API Apr 3, 2019
@mcab mcab merged commit f172639 into develop Apr 3, 2019
@mcab mcab deleted the 28-expose-more-models branch April 3, 2019 04:19
mcab added a commit that referenced this pull request May 9, 2019
This PR allows us to GET / POST data over the API, namely:
    House
    House Environmental Features
    House Physical Features
    Observations

They're located at:
    /api/v1/house
           /house/{pk}/environment
           /house/{pk}/physical
           /house/{pk}/observations
    
Where {pk} stands for Primary Key; features and observations are
tied to a specific house, so they belong underneath those API routes.

With this change, certain migrations needed to be deleted in order to
update some ForeignKeys that were invalid.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant