-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add check for conflicting events before creation #129
Conversation
7200116
to
079bddd
Compare
I think this looks good. When my comments above are solved I will approve. |
079bddd
to
6100203
Compare
if overlapping_events: | ||
raise HTTPException( | ||
status_code=HTTPStatus.CONFLICT.value, | ||
detail=f"Conflict with already existing event in the same time period. Events with id: {','.join(str(event.id) for event in overlapping_events)}", |
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.
Will all users be authorized to see all events for a given robot?
If not, this might be giving out too much information, maybe the first statement is enough?
I'm not sure, open for discussion
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.
I would say that if the user is authorized to post events (which I believe should have a "higher" access level than just read events) they will be allowed to see all events.
@@ -62,11 +63,24 @@ async def post_event( | |||
) -> Event: | |||
"""Add a new event to the robot schedule""" | |||
try: | |||
end_time = event_request.start_time + DEFAULT_EVENT_DURATION |
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.
Will we always use the default duration? Maybe the user should have an event_duration optional field to this post endpoint so they can define it themselves?
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.
Currently a default value is enough in my opinion. I don't think the user should be able to set the event_duration, but rather be based on the number of tags and/or based on data from previous missions with the same id. Can make a card for setting the event_duration based on number of tags.
6100203
to
c8d0925
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.
LGTM 👍
Closes #95