MarisiaS / SMM

0 stars 0 forks source link

BE-Update field type for time #72

Closed viriponce closed 5 months ago

viriponce commented 6 months ago

This PR addresses issue #71

Implementation

  1. *backend/api/models.py Change the field type for time field in the TimeRecord model. time = models.DurationField()

  2. backend/api/migrations/0015_alter_timerecord_time.py This migration file was crated after running the makemigrations command.

  3. backend/api/serializers/TimeRecordSerializer.py Change the validate_time method to validate that not negative value is allowed for time.

Swagger

I tried the Time Record endpoints and all of them are working as expected. When providing a negative value, the validation error is returned.