-
Notifications
You must be signed in to change notification settings - Fork 2
Add backend for bookable office hours #332
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
Conversation
dkwncho
commented
Mar 30, 2025
- Created new Booking model, serializer, permission, urls, and viewset
- Bookings can only be created with start times of 5-minute intervals (e.g., :00, :05, :10, :15, etc), would need to reflect this on the frontend
- Created new Booking model, serializer, permission, urls, and viewset
- Removed interval limitations (old change that should not have been here) - Now properly handles when interval is null (i.e. when occurrence is not a bookable event)
- Also added potentially reasonable validation checks for booking times
- Added a default value for params field of Rule object since it can be blank
- Removed automatic Booking object creation upon Occurrence object creation - Split up BookingViewSet and updated booking url patterns for cleaner interaction with booking objects - Refactored BookingPermission for readability and to reflect the above changes
… fields actually exist
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.
Pull Request Overview
This PR adds the backend functionality for bookable office hours by introducing a new Booking model along with its serializers, views, permissions, tests, and corresponding migration.
- Introduces the Booking model with its validations and integration into existing scheduling functionality.
- Adds new viewsets, permissions, and serializers to support booking creation, retrieval, updating, and deletion.
- Updates test suites and URLs to cover the new booking functionality.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
backend/tests/ohq/test_permissions.py | Added booking tests and updated start/end times for consistency. |
backend/tests/ohq/test_models.py | Added tests for booking validations and overlapping bookings. |
backend/ohq/views.py | Introduced BookingDetailViewSet and BookingListCreateViewSet. |
backend/ohq/urls.py | Registered booking viewsets and nested routes for occurrences. |
backend/ohq/serializers.py | Added BookingSerializer and updated OccurrenceSerializer fields. |
backend/ohq/permissions.py | Added BookingPermission for booking access control. |
backend/ohq/models.py | Created the Booking model with time interval and overlap check. |
backend/ohq/migrations/0022_booking.py | Migration file for the new Booking model. |
backend/ohq/admin.py | Registered Booking in the admin interface. |
backend/Pipfile | Updated dependency from django-schedules-ohq to django-scheduler. |
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! Please test everything before merging