-
Notifications
You must be signed in to change notification settings - Fork 1
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
248 start report #1876
248 start report #1876
Conversation
c18031b
to
55fe0b4
Compare
3daae01
to
1917b44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests pass and the reports endpoint shows up in Django Ninja with everything as expected.
Everything looks solid! 🌮
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤩
def operation_baker(operator_id: uuid.UUID = None, **properties) -> Operation: | ||
if "type" not in properties: | ||
properties["type"] = cycle(["sfo", "lfo"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we could still keep *args, **kwargs
and have something like:
if "type" not in kwargs:
kwargs["type"] = cycle(["sfo", "lfo"])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*args
makes little sense as the model baker doesn't take positional arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a helper class named TestUtils
in utils/helpers.py
customized for testing endpoints; Could be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is going to see heavy refactor when we add authentication and everything else, so we'll make sure to refactor at that time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: To avoid having to refactor this later, as we did in the registration app, I recommend breaking this into separate functions now. like def _create_report_facilities
and def _create_report_operation
and ...
An API endpoint on POST
/api/reporting/reports
Card: bcgov/cas-reporting#248
Models created:
Services
API routes
POST: /api/reporting/reports
creates a report with the above mentioned service and return its ID