generated from SmartOperatingBlock/kotlin-template-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add surgical process application services
- Loading branch information
1 parent
2deba0c
commit 5e98994
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
src/main/kotlin/application/service/SurgicalProcessServices.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) 2023. Smart Operating Block | ||
* | ||
* Use of this source code is governed by an MIT-style | ||
* license that can be found in the LICENSE file or at | ||
* https://opensource.org/licenses/MIT. | ||
*/ | ||
|
||
package application.service | ||
|
||
import entity.process.ProcessData | ||
import entity.process.SurgicalProcess | ||
import usecase.repository.SurgicalProcessRepository | ||
|
||
/** | ||
* Module that contains all [ApplicationService] of surgical processes. | ||
*/ | ||
object SurgicalProcessServices { | ||
|
||
/** | ||
* The Application Service to create a [SurgicalProcess]. | ||
*/ | ||
class CreateSurgicalProcess( | ||
private val surgicalProcess: SurgicalProcess, | ||
private val surgicalProcessRepository: SurgicalProcessRepository | ||
) : ApplicationService<SurgicalProcess?> { | ||
override fun execute(): SurgicalProcess? = surgicalProcessRepository.createSurgicalProcess(surgicalProcess) | ||
} | ||
|
||
/** | ||
* The Application Service to get a [SurgicalProcess] by a [surgicalProcessId]. | ||
*/ | ||
class GetSurgicalProcessById( | ||
private val surgicalProcessId: ProcessData.ProcessId, | ||
private val surgicalProcessRepository: SurgicalProcessRepository | ||
) : ApplicationService<SurgicalProcess?> { | ||
override fun execute(): SurgicalProcess? = surgicalProcessRepository.getSurgicalProcessById(surgicalProcessId) | ||
} | ||
|
||
/** | ||
* The Application Service to get the current [SurgicalProcess] within the Operating Block. | ||
*/ | ||
class GetCurrentSurgicalProcesses( | ||
private val surgicalProcessRepository: SurgicalProcessRepository | ||
) : ApplicationService<Set<SurgicalProcess>> { | ||
override fun execute(): Set<SurgicalProcess> = surgicalProcessRepository.getCurrentSurgicalProcesses() | ||
} | ||
} |