Skip to content

Commit fc376b7

Browse files
andrea-acamporamergify[bot]
authored andcommitted
style: format code due to kotlin-qa plugin update
1 parent 7cda2c4 commit fc376b7

File tree

11 files changed

+28
-27
lines changed

11 files changed

+28
-27
lines changed

src/main/kotlin/application/controller/PatientController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import usecase.repository.PatientRepository
1818
* It contains the logic to access and update patients data.
1919
*/
2020
class PatientController(
21-
private val dbManager: PatientDatabaseManager
21+
private val dbManager: PatientDatabaseManager,
2222
) : PatientRepository {
2323

2424
override fun createPatient(patient: Patient): Boolean = dbManager.insertPatient(patient)

src/main/kotlin/application/presenter/api/model/PatientApiDto.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ data class PatientApiDto(
3131

3232
val birthdate: String,
3333

34-
val bloodGroup: BloodGroup
34+
val bloodGroup: BloodGroup,
3535
)
3636

3737
/** Extension method to convert a [Patient] into its [PatientApiDto]. */
@@ -42,7 +42,7 @@ fun Patient.toPatientApiDto(): PatientApiDto = PatientApiDto(
4242
birthdate = this.birthdate,
4343
height = this.height.value,
4444
weight = this.weight.value,
45-
bloodGroup = this.bloodGroup
45+
bloodGroup = this.bloodGroup,
4646
)
4747

4848
/** Extension method to convert a [PatientApiDto] into a [Patient]. */
@@ -53,5 +53,5 @@ fun PatientApiDto.toPatient(): Patient = Patient(
5353
birthdate = this.birthdate,
5454
height = PatientData.Height(this.height, PatientData.LengthUnit.CENTIMETER),
5555
weight = PatientData.Weight(this.weight, PatientData.MassUnit.KILOGRAM),
56-
bloodGroup = this.bloodGroup
56+
bloodGroup = this.bloodGroup,
5757
)

src/main/kotlin/application/service/PatientServices.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,21 @@ object PatientServices {
1818
/** Application service to create a [patient] using a [patientRepository]. */
1919
class CreatePatient(
2020
private val patient: Patient,
21-
private val patientRepository: PatientRepository
21+
private val patientRepository: PatientRepository,
2222
) : ApplicationService<Boolean> {
2323

2424
override fun execute(): Boolean =
2525
if (patientRepository.getPatient(patient.taxCode) == null) {
2626
patientRepository.createPatient(patient)
27-
} else false
27+
} else {
28+
false
29+
}
2830
}
2931

3032
/** Application service to delete a [Patient] given the [taxCode] using a [patientRepository]. */
3133
class DeletePatient(
3234
private val taxCode: TaxCode,
33-
private val patientRepository: PatientRepository
35+
private val patientRepository: PatientRepository,
3436
) : ApplicationService<Boolean> {
3537

3638
override fun execute(): Boolean =
@@ -40,7 +42,7 @@ object PatientServices {
4042
/** Application service to det a [Patient] given the [taxCode] using a [patientRepository]. */
4143
class GetPatient(
4244
private val taxCode: TaxCode,
43-
private val patientRepository: PatientRepository
45+
private val patientRepository: PatientRepository,
4446
) : ApplicationService<Patient?> {
4547

4648
override fun execute(): Patient? =

src/main/kotlin/entity/Patient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ data class Patient(
3939
val weight: Weight,
4040

4141
/** The [BloodGroup] of the patient. */
42-
val bloodGroup: BloodGroup
42+
val bloodGroup: BloodGroup,
4343
) {
4444
init {
4545
check(taxCode.code.isNotEmpty()) {

src/main/kotlin/entity/PatientData.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ object PatientData {
5858
ZERO_NEGATIVE,
5959
ZERO_POSITIVE,
6060
AB_NEGATIVE,
61-
AB_POSITIVE
61+
AB_POSITIVE,
6262
}
6363

6464
/** The gender enum. */

src/main/kotlin/infrastructure/api/routes/PatientAPI.kt

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,29 @@ import io.ktor.server.routing.post
2929

3030
/** The [Patient] API implementation. */
3131
fun Route.patientAPI(patientDatabaseManager: PatientDatabaseManager) {
32-
3332
get("/api/v1/patients/{taxCode}") {
3433
GetPatient(
3534
TaxCode(call.parameters["taxCode"].orEmpty()),
36-
PatientController(patientDatabaseManager)
35+
PatientController(patientDatabaseManager),
3736
).execute().apply {
38-
if (this != null)
37+
if (this != null) {
3938
call.respond(HttpStatusCode.OK, this.toPatientApiDto())
40-
else
39+
} else
4140
call.respond(HttpStatusCode.NotFound)
4241
}
4342
}
4443

4544
delete("/api/v1/patients/{taxCode}") {
4645
DeletePatient(
4746
TaxCode(call.parameters["taxCode"].orEmpty()),
48-
PatientController(patientDatabaseManager)
47+
PatientController(patientDatabaseManager),
4948
).execute().let { result ->
50-
if (result)
49+
if (result) {
5150
call.respond(HttpStatusCode.NoContent)
52-
else
51+
} else
5352
call.respond(
5453
HttpStatusCode.NotFound,
55-
"Patient not found: " + call.parameters["taxCode"].toString()
54+
"Patient not found: " + call.parameters["taxCode"].toString(),
5655
)
5756
}
5857
}
@@ -61,11 +60,11 @@ fun Route.patientAPI(patientDatabaseManager: PatientDatabaseManager) {
6160
val patient: Patient = call.receive<PatientApiDto>().toPatient()
6261
CreatePatient(
6362
patient,
64-
PatientController(patientDatabaseManager)
63+
PatientController(patientDatabaseManager),
6564
).execute().let { result ->
66-
if (result)
65+
if (result) {
6766
call.respond(HttpStatusCode.Created)
68-
else
67+
} else
6968
call.respond(HttpStatusCode.Conflict)
7069
}
7170
}

src/main/kotlin/infrastructure/database/MongoClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import org.litote.kmongo.getCollection
2121
* The Mongo client.
2222
*/
2323
class MongoClient(
24-
connectionString: String
24+
connectionString: String,
2525
) : PatientDatabaseManager {
2626

2727
init {

src/test/kotlin/application/service/TestApplicationService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class TestApplicationService : StringSpec({
2626
"1990-05-10",
2727
PatientData.Height(180.5, PatientData.LengthUnit.CENTIMETER),
2828
PatientData.Weight(75.2, PatientData.MassUnit.KILOGRAM),
29-
PatientData.BloodGroup.A_POSITIVE
29+
PatientData.BloodGroup.A_POSITIVE,
3030
)
3131

3232
beforeEach {

src/test/kotlin/architecture/TestCleanArchitecture.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class TestCleanArchitecture : StringSpec({
2727
.check(
2828
ClassFileImporter()
2929
.withImportOption { !it.contains("/test/") } // ignore tests classes
30-
.importPackages("entity", "usecase", "application", "infrastructure")
30+
.importPackages("entity", "usecase", "application", "infrastructure"),
3131
)
3232
}
3333
})

src/test/kotlin/entity/TestEntity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TestEntity : StringSpec({
2929
"1990-05-10",
3030
PatientData.Height(180.5, PatientData.LengthUnit.CENTIMETER),
3131
PatientData.Weight(75.2, PatientData.MassUnit.KILOGRAM),
32-
PatientData.BloodGroup.A_POSITIVE
32+
PatientData.BloodGroup.A_POSITIVE,
3333
)
3434

3535
"A patient should correctly be created" {
@@ -45,7 +45,7 @@ class TestEntity : StringSpec({
4545
"1990-05-10",
4646
PatientData.Height(180.5, PatientData.LengthUnit.CENTIMETER),
4747
PatientData.Weight(75.2, PatientData.MassUnit.KILOGRAM),
48-
PatientData.BloodGroup.A_POSITIVE
48+
PatientData.BloodGroup.A_POSITIVE,
4949
)
5050
}
5151
}

0 commit comments

Comments
 (0)