MarisiaS / SMM

0 stars 0 forks source link

BE-SwimMeet model, serializer and view #53

Closed MarisiaS closed 6 months ago

MarisiaS commented 6 months ago

This PR addresses issue #27

Implementation

  1. backend/api/models.py Implemented the SwimMeet model with the following fields:
  1. backend/api/migrations/0011_swimmeet.py After creating the model, I ran the makemigrations command and the migration for the SwimMeet model was created.

  2. backend/api/serializers/SwimMeetSerializer.py Created a Model serializer for the SwimMeet model. Included all the fields plus the site name.

  3. backend/api/views/EventTypeView.py Created a basic Model View set for SwimMeet. The data is order by date. Search by name is allow

  4. backend/api/urls.py Added a router to generate the endpoints for SwimMeet.

  5. backend/api/fixtures/swim_meet.json

Added 2 swim meets

Swagger

The endpoints are accessible through Swagger.

I tried each of the new endpoints successfully. I was able to create, delete, patch and get an swim meet. When posting and patching, I got the expected error for entering invalid data.

MarisiaS commented 6 months ago

Just a couple of observations: Issue #27 calls for fixtures, those are not included in this PR. I see you added search and sort functionality, should we add then the insensitive collation in the model?

I just added sorting by date, so the insensitive collation is not needed.

viriponce commented 6 months ago

Just a couple of observations: Issue #27 calls for fixtures, those are not included in this PR. I see you added search and sort functionality, should we add then the insensitive collation in the model?

I just added sorting by date, so the insensitive collation is not needed.

Sorry, I got confuse with name but name is a search filter. :)