Skip to content

#73 Booking Availability and Endpoints#129

Merged
cj-ballesteros merged 3 commits intomainfrom
#73-Booking_Availability_and_Endpoints
Apr 15, 2025
Merged

#73 Booking Availability and Endpoints#129
cj-ballesteros merged 3 commits intomainfrom
#73-Booking_Availability_and_Endpoints

Conversation

@cj-ballesteros
Copy link
Contributor

Booking Availability and Endpoints


Overview

What does this PR do?

Adds an availability model that works alongside the bookings model as well as simple GET and POST operations.


Key Features & Changes

What has been added or changed?

  • Added Availability model to work hand in hand with Bookings model.
  • Modified Bookings model to compensate for Availability model changes
  • Refactored and cleaned up logic for several methods in Bookings and Reviews Model, moving what I could to managers.py
  • managers.py is populated with methods moved from models.py
  • Added Availaibility admin view and made necessary refactoring to other admin views to accomodate.
  • Appended AvailabilitySerializer to serializers.py
  • Implemented GET view for Availability to get openings by tutor and date.
  • Implemented POST view for Availability to book a session based on availabilities fetched with GET
  • Minor modification to users/models.py to properly display profile username in admin model and any developer tools. Before if the first name/last name wasn't populated, it would not show anything.

Why This Is Needed

What problem does this solve?

Implements #73


How to Test This PR

Step-by-step testing guide

  1. Navigate to admin panel and test model from there or if one wants to test based off curl or using django's rest framework interface follow steps as follows.
  2. in views.py, uncomment around line 73, which will show you all the availabilities that you created.
  3. As well as that, make sure you disable the authentication in settings.py, as you won't be able to access anything.
  4. Otherwise, just test and have fun :)

AI Code Usage

🤖 Was AI-generated code used in this PR?

  • Yes, AI assisted in guiding my coding.
  • No

Checklist for Reviewers

Things to check before approving this PR:

  • Does the feature work as expected?
  • Are the UI and animations smooth?
  • Do the session buttons and controls function properly?
  • Is the code clean, modular, and well-documented?
  • Does the feature work on different screen sizes (desktop, mobile, tablet)?

Final Notes

Thank you for reviewing! Please leave feedback if you have any suggestions or concerns. Let’s make this feature even better!

@cj-ballesteros cj-ballesteros added the Backend Issue is primarily backend related label Apr 8, 2025
@cj-ballesteros cj-ballesteros self-assigned this Apr 8, 2025
@cj-ballesteros cj-ballesteros force-pushed the #73-Booking_Availability_and_Endpoints branch from a40dc29 to 405578a Compare April 9, 2025 03:10
Copy link
Contributor

@omgdory omgdory left a comment

Choose a reason for hiding this comment

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

✅ Approval Overview

Admin panel updated and has appropriate fields. Managers added for more easy database handling related to this model. Migrations applied. Model fields look appropriate. Serializers look good. URLs make sense. GET and POST views seem appropriate.

🧠 Details

This model's design considers the necessary fields to capture availability details accurately. One thing to note is that the existing Booking model must be added as a field under the model. However, this can be done in a future PR, as we now have the foundation for the model established.

The API endpoints enable basic CRUD operations. All that is left on this front is adding appropriate authentication. Once again, this can be done later, as we have a foundation.

The modifications on the Booking model should include unit and integration tests, as this would help to validate that existing functionality is not hindered. As mentioned in the meeting, though, testing can be done in a separate PR.

Overall, this PR provides a good foundation for implementing the Availability model into existing systems.

🎯 Next Steps

Add booking field as defined in the issue. Add authentication for CRUD operations. Implement unit testing.

Copy link
Contributor

@ashley-arellano ashley-arellano left a comment

Choose a reason for hiding this comment

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

🔍 Peer Review: Great Job on This PR!

Hey CJ 👋 — just finished reviewing your PR titled "#73 Booking Availability and Endpoints". Here’s my feedback:


✅ What Looks Great

  • The GET and POST views for bookings are working perfectly

    • Just had to add a create/ URL to urls.py to get POST working
  • The new Availability model is great. Good use of constraints, clean validation logic, and ordering!

  • It great that you moved some logic into managers.py. That refactoring makes the codebase more maintainable.


💡 Suggestions for Improvement (if any)

These are ideas for future improvements or things to address before merging.

  • As mentioned, I had to add a url to urls.py to get POST to work. So I would suggest adding a new POST URL to urls.py (e.g., path('create/', views.create_booking, name='create_booking')) to make sure the endpoint is accessible.

  • Could include unit tests for the new Availability model and views if not already there.


🧪 Tested This Feature

I ran the following test steps:

  • ✅ Ran the GET /bookings/availability/ endpoint via CURL and it returned correct results.

  • ✅ Ran the POST /bookings/create/ endpoint with test data via CURL and it created the booking successfully.

  • ✅ Confirmed that the new views and model integrate cleanly with the rest of the system.


🔄 Next Steps

  • Add a url path to urls.py
  • Adding unit tests later on to boost our test coverage

🚀 Final Thoughts

Great job with this implementation! It’s a great addition to our project. Therefore, I will approve : D

@cj-ballesteros cj-ballesteros merged commit d7069a0 into main Apr 15, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Issue is primarily backend related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants