Skip to content

Commit

Permalink
chore: add method to update medical technology historical data about …
Browse files Browse the repository at this point in the history
…usage
  • Loading branch information
AndreaGiulianelli committed Mar 7, 2023
1 parent eb17d90 commit d3d01fd
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,12 @@ class MedicalTechnologyController(
override fun mapTechnologyTo(medicalTechnologyId: MedicalTechnologyID, roomId: RoomID): Boolean {
TODO("Not yet implemented")
}

override fun updateMedicalTechnologyUsage(
medicalTechnologyId: MedicalTechnologyID,
usage: Boolean,
dateTime: Instant,
): Boolean {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,14 @@ interface MedicalTechnologyDatabaseManager {
* @return true if successfully mapped, false otherwise
*/
fun mapTo(medicalTechnologyId: MedicalTechnologyID, roomId: RoomID): Boolean

/**
* Update the status of [usage] in a specified [dateTime] of a medical technology
* identified by its [medicalTechnologyId].
*/
fun updateMedicalTechnologyUsage(
medicalTechnologyId: MedicalTechnologyID,
usage: Boolean,
dateTime: Instant
): Boolean
}
8 changes: 8 additions & 0 deletions src/main/kotlin/infrastructure/database/DatabaseManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ class DatabaseManager(customConnectionString: String? = null) : RoomDatabaseMana
TODO("Not yet implemented")
}

override fun updateMedicalTechnologyUsage(
medicalTechnologyId: MedicalTechnologyID,
usage: Boolean,
dateTime: Instant,
): Boolean {
TODO("Not yet implemented")
}

private fun <T, R> MongoCollection<T>.safeMongoDbWrite(defaultResult: R, operation: MongoCollection<T>.() -> R): R =
try {
operation()
Expand Down
10 changes: 10 additions & 0 deletions src/main/kotlin/usecase/repository/MedicalTechnologyRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,14 @@ interface MedicalTechnologyRepository {
* @return false if the medical technology does not exist, true otherwise.
*/
fun mapTechnologyTo(medicalTechnologyId: MedicalTechnologyID, roomId: RoomID): Boolean

/**
* Update the status of [usage] in a specified [dateTime] of a medical technology
* identified by its [medicalTechnologyId].
*/
fun updateMedicalTechnologyUsage(
medicalTechnologyId: MedicalTechnologyID,
usage: Boolean,
dateTime: Instant
): Boolean
}

0 comments on commit d3d01fd

Please sign in to comment.