UpstreamDataInc / goosebit

A simplistic, opinionated remote update server implementing hawkBit™'s DDI API.
https://goosebit.rtfd.io
Apache License 2.0
12 stars 2 forks source link

refactor: cleanup API and add pydantic models for typing #58

Closed b-rowan closed 3 weeks ago

b-rowan commented 1 month ago

General API and auth fixes, as well as pydantic models for most of the endpoints (except for download, because I moved it around in #47, and it cant use the models anyway). Moves things around to make it more clear what parts of the code do what.

tsagadar commented 1 month ago

Why not splitting the code by operation? E.g. that we rather have a devices/delete.py that contains request, response and logic of the delete request? In the new org, one has to look at three files to understand a single request.

b-rowan commented 1 month ago

Why not splitting the code by operation? E.g. that we rather have a devices/delete.py that contains request, response and logic of the delete request? In the new org, one has to look at three files to understand a single request.

I opted to mirror the way that FastAPI structures its directories. This is fine too, if we prefer that I can swap to that.

tsagadar commented 1 month ago

Why not splitting the code by operation? E.g. that we rather have a devices/delete.py that contains request, response and logic of the delete request? In the new org, one has to look at three files to understand a single request.

I opted to mirror the way that FastAPI structures its directories. This is fine too, if we prefer that I can swap to that.

If this new way is documented somewhere then that is ok as well. On a quick search I found these practices which are close to the new structure: https://github.com/zhanymkanov/fastapi-best-practices?tab=readme-ov-file#project-structure

This would be another approach: https://stackoverflow.com/a/64987404