diff --git a/care/facility/api/serializers/patient.py b/care/facility/api/serializers/patient.py index 5ba675a734..e94fa0d25c 100644 --- a/care/facility/api/serializers/patient.py +++ b/care/facility/api/serializers/patient.py @@ -452,11 +452,11 @@ class PatientTransferSerializer(serializers.ModelSerializer): class Meta: model = PatientRegistration - fields = ("facility", "date_of_birth", "patient", "facility_object") + fields = ("facility", "year_of_birth", "patient", "facility_object") - def validate_date_of_birth(self, value): - if self.instance and self.instance.date_of_birth != value: - raise serializers.ValidationError("Date of birth does not match") + def validate_year_of_birth(self, value): + if self.instance and self.instance.year_of_birth != value: + raise serializers.ValidationError("Year of birth does not match") return value def create(self, validated_data): diff --git a/care/facility/tests/test_patient_api.py b/care/facility/tests/test_patient_api.py index c3621e66eb..01b017c34d 100644 --- a/care/facility/tests/test_patient_api.py +++ b/care/facility/tests/test_patient_api.py @@ -448,7 +448,7 @@ def test_patient_transfer(self): response = self.client.post( f"/api/v1/patient/{self.patient.external_id}/transfer/", { - "date_of_birth": "1992-04-01", + "year_of_birth": 1992, "facility": self.destination_facility.external_id, }, ) @@ -477,7 +477,7 @@ def test_transfer_with_active_consultation_same_facility(self): response = self.client.post( f"/api/v1/patient/{self.patient.external_id}/transfer/", { - "date_of_birth": "1992-04-01", + "year_of_birth": 1992, "facility": self.facility.external_id, }, ) @@ -496,7 +496,7 @@ def test_transfer_disallowed_by_facility(self): response = self.client.post( f"/api/v1/patient/{self.patient.external_id}/transfer/", { - "date_of_birth": "1992-04-01", + "year_of_birth": 1992, "facility": self.destination_facility.external_id, }, )