mcab / hiber

API for Bat House SDP
GNU General Public License v3.0
0 stars 1 forks source link

Expose endpoint for API #18

Closed mcab closed 5 years ago

mcab commented 5 years ago

Addresses #8.

Since we'll be using this with mcab/flightplan, we need a way to communicate the data.

This is the scaffolding for such.

mcab commented 5 years ago

2019-02-26_14_ba6ovp8k

We're actually pretty close.

/api/v1/schema isn't returning the proper routes, though. This can be bypassed with a static generation, but probably understanding why it's not generating in the first place is more important.

Additionally, this is ReadOnly for now.

mcab commented 5 years ago

chrome_2019-02-26_16_cfgsbtzq

I've been working on this for a bit.

The bottom two would probably be fixed if we used Wagtail's API, but I'm iffy on the declaration on how to get data from it. Since Bat is a Django model, we should stick to using that instead of going through Wagtail's API.

Also, the ArrayField and mapping seems a bit weird. Internally, DRF sees it as a ListField, but there's no way to link the items in the List to their human-readable equivalent. It still probably uses get_FOO_display(), it's a matter of calling it properly.

mcab commented 5 years ago

chrome_2019-02-26_16_8xeuxn5y

We ended up being able to serialize values back to their human-readable counterparts. Definitely not DRY, but since there is no way to pass which field needs the proper counterpart, I guess this is okay™.

mcab commented 5 years ago

In order to at least have a basis for the API endpoint / structure, I'm changing this to at least have one model exposed over API.

This is so we can address #11, knowing we have an endpoint for our API.