Skip to content

Commit 865cc71

Browse files
giacomoaccursiandrea-acampora
authored andcommitted
chore: edit surgertReportEntryDto class with right parameters
1 parent 865983a commit 865cc71

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

src/main/kotlin/application/presenter/api/report/SurgeryReportEntryDto.kt

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,57 @@
88

99
package application.presenter.api.report
1010

11-
import entity.surgeryreport.PatientInfo
12-
import entity.surgeryreport.ProcessDate
11+
import entity.surgeryreport.PatientId
12+
import entity.surgeryreport.PatientName
13+
import entity.surgeryreport.PatientSurname
1314
import entity.surgeryreport.ProcessId
14-
import entity.surgeryreport.ProcessType
15+
import entity.surgeryreport.SurgeryDate
1516
import entity.surgeryreport.SurgeryReportEntry
16-
import kotlinx.serialization.Contextual
17+
import entity.surgeryreport.SurgicalProcessDescription
1718
import kotlinx.serialization.Serializable
1819
import java.time.Instant
1920

2021
/**
2122
* Class that model the principal information of a surgery report in the surgery report archive.
22-
* @param processId the id of the surgery process.
23-
* @param patientInfo the name and the surname of the patient.
24-
* @param processType the type of the surgery.
25-
* @param processDate the date of the surgery.
23+
* @param surgicalProcessID the id of the surgical process.
24+
* @param patientId the id of the patient.
25+
* @param patientName the name of the patient.
26+
* @param patientSurname the surname of the patient.
27+
* @param surgicalProcessDescription the description of the surgical process.
28+
* @param surgeryDate the date of the surgical process.
2629
*/
2730
@Serializable
2831
data class SurgeryReportEntryDto(
29-
val processId: String,
30-
val patientInfo: String,
31-
val processType: String,
32-
@Contextual val processDate: Instant,
32+
val surgicalProcessID: String,
33+
val patientId: String,
34+
val patientName: String?,
35+
val patientSurname: String?,
36+
val surgicalProcessDescription: String,
37+
val surgeryDate: String,
3338
)
3439

3540
/**
3641
* Extension function to convert a SurgeryReportEntryDto into a SurgeryReportEntry.
3742
*/
3843
fun SurgeryReportEntryDto.toSurgeryReportEntry(): SurgeryReportEntry =
3944
SurgeryReportEntry(
40-
ProcessId(this.processId),
41-
PatientInfo(this.patientInfo),
42-
ProcessType(this.processType),
43-
ProcessDate(this.processDate),
45+
ProcessId(this.surgicalProcessID),
46+
PatientId(this.patientId),
47+
this.patientName?.let { PatientName(it) },
48+
this.patientSurname?.let { PatientSurname(it) },
49+
SurgicalProcessDescription(this.surgicalProcessDescription),
50+
SurgeryDate(Instant.parse(this.surgeryDate)),
4451
)
4552

4653
/**
4754
* Extension function to convert a SurgeryReportEntry into a SurgeryReportEntryDto.
4855
*/
4956
fun SurgeryReportEntry.toSurgeryReportEntryDto(): SurgeryReportEntryDto =
5057
SurgeryReportEntryDto(
51-
this.processId.id,
52-
this.patientInfo.patientInfo,
53-
this.processType.processType,
54-
this.processDate.processDate,
58+
this.surgicalProcessID.id,
59+
this.patientId.id,
60+
this.patientName?.patientName,
61+
this.patientSurname?.surname,
62+
this.surgicalProcessDescription.description,
63+
this.surgeryDate.date.toString(),
5564
)

0 commit comments

Comments
 (0)