Skip to content

Commit

Permalink
chore: add surgical process application services
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-acampora committed Mar 28, 2023
1 parent 2deba0c commit 5e98994
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/main/kotlin/application/service/SurgicalProcessServices.kt
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()
}
}

0 comments on commit 5e98994

Please sign in to comment.