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

WIP: Add v1 data API #1138

Draft
wants to merge 64 commits into
base: develop
Choose a base branch
from
Draft

WIP: Add v1 data API #1138

wants to merge 64 commits into from

Conversation

michplunkett
Copy link
Collaborator

@michplunkett michplunkett commented Dec 18, 2024

Fixes issue

#385

Description of Changes

Add the baseline features for a data-focused API.

Tests and Linting

  • This branch is up-to-date with the develop branch.
  • pytest passes on my local development environment.
  • pre-commit passes on my local development environment.

@michplunkett michplunkett self-assigned this Dec 18, 2024
@michplunkett michplunkett linked an issue Dec 18, 2024 that may be closed by this pull request
Comment on lines 18 to 19
@v1.route("/departments/<int:department_id>/officers", methods=[HTTPMethod.GET])
def download_dept_officers(department_id: int):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Using one of the formats here: #385 (comment)

Thoughts, @sea-kelp @abandoned-prototype @b-meson @AetherUnbound?

Comment on lines 1 to 6
from flask import Blueprint


main = Blueprint("main", __name__)

from OpenOversight.app.main import views # noqa: E402,F401
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved this to ./main/views.py.

Comment on lines 1 to 6
from flask import Blueprint


auth = Blueprint("auth", __name__)

from . import views # noqa: E402,F401
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved this to ./auth/views.py.

@michplunkett michplunkett changed the title Add data API Add v1 data API Dec 19, 2024
@@ -136,23 +175,14 @@ class Department(BaseModel, TrackUpdates):
__table_args__ = (UniqueConstraint("name", "state", name="departments_name_state"),)

def __repr__(self):
return f"<Department ID {self.id}: {self.name} {self.state}>"

def to_custom_dict(self):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This isn't needed anymore with the addition of the Serializable class.

@michplunkett michplunkett changed the title Add v1 data API WIP: Add v1 data API Dec 21, 2024
michplunkett added a commit that referenced this pull request Jan 2, 2025
## Description of Changes
Addressed inconsistencies with the model `__repr__` functions.

Mostly making this because this PR got a bit out of control:
#1138

## Tests and Linting
- [x] This branch is up-to-date with the `develop` branch.
- [x] `pytest` passes on my local development environment.
- [x] `pre-commit` passes on my local development environment.
michplunkett added a commit that referenced this pull request Jan 6, 2025
## Fixes issue
Sets the groundwork for this issue:
#385

## Description of Changes
Simplifying the import logic for the `auth` and `main` routes of the
application. This also sets up the work for this PR:
#1138

## Tests and Linting
- [x] This branch is up-to-date with the `develop` branch.
- [x] `pytest` passes on my local development environment.
- [x] `pre-commit` passes on my local development environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build API
1 participant