diff --git a/lib/api/patient/patient.dart b/lib/api/patient/patient.dart index 4524837..153b1b9 100644 --- a/lib/api/patient/patient.dart +++ b/lib/api/patient/patient.dart @@ -6,6 +6,7 @@ class Patient { final String? name; final String? fatherName; final String? location; // TODO Rename to "residentialAddress" + final String? gender; // TODO Use enum instead of String final DateTime? lastVisit; Patient({ @@ -14,6 +15,7 @@ class Patient { this.name, this.fatherName, this.location, + this.gender, this.lastVisit, }); @@ -23,5 +25,6 @@ class Patient { name = payload.name, fatherName = null, location = payload.residentialAddress, + gender = payload.gender, lastVisit = null; } diff --git a/lib/api/patient/patient_service.dart b/lib/api/patient/patient_service.dart index 992c77f..9b4e137 100644 --- a/lib/api/patient/patient_service.dart +++ b/lib/api/patient/patient_service.dart @@ -28,7 +28,7 @@ class PatientServiceImpl implements PatientService { response = await _api.patients.create(CreatePatientRequestPayload( name: patient.name, residentialAddress: patient.location, - gender: null, // FIXME + gender: patient.gender, )); } return Patient.from(response); diff --git a/test/api/patient/patient_service_test.dart b/test/api/patient/patient_service_test.dart index defa7d0..967a388 100644 --- a/test/api/patient/patient_service_test.dart +++ b/test/api/patient/patient_service_test.dart @@ -36,6 +36,9 @@ class MinimalPatientResponse extends PatientResponsePayload { MinimalPatientResponse(String id) : super( id: id, + name: null, + residentialAddress: null, + gender: null, links: Links(self: Link(href: 'http://localhost/api/patients/$id')), ); } diff --git a/test/api/patient/patient_test.dart b/test/api/patient/patient_test.dart index 220606c..56a6789 100644 --- a/test/api/patient/patient_test.dart +++ b/test/api/patient/patient_test.dart @@ -9,6 +9,7 @@ void main() { var response = PatientResponsePayload( id: const Uuid().v4(), name: 'Jonny Doe', + gender: 'MALE', residentialAddress: 'Guesthouse', links: Links( self: Link(href: 'http://localhost'), @@ -30,6 +31,7 @@ class TestPatient extends Equatable implements Patient { final String? id; final DateTime? lastVisit; final String? location; + final String? gender; final String? opdNumber; TestPatient.fromPayload(PatientResponsePayload payload) @@ -38,6 +40,7 @@ class TestPatient extends Equatable implements Patient { id = payload.id, lastVisit = null, location = payload.residentialAddress, + gender = payload.gender, opdNumber = null; TestPatient.fromModel(Patient patient) @@ -46,6 +49,7 @@ class TestPatient extends Equatable implements Patient { id = patient.id, lastVisit = patient.lastVisit, location = patient.location, + gender = patient.gender, opdNumber = patient.opdNumber; @override @@ -55,6 +59,7 @@ class TestPatient extends Equatable implements Patient { id, lastVisit, location, + gender, opdNumber, ]; }