Skip to content

Commit aad6d74

Browse files
feat: add application service to delete and get a room
1 parent 669540c commit aad6d74

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

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

+25-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
package application.service
1010

1111
import entity.zone.Room
12+
import entity.zone.RoomID
1213
import usecase.repository.RoomRepository
14+
import java.util.Date
1315

1416
/**
1517
* Module that wraps all the services that orchestrate the application logic (not domain one).
@@ -29,9 +31,31 @@ object Service {
2931
}
3032

3133
/**
32-
* Application Service that has the objective of creating a [room] using the [roomRepository] passed.
34+
* Application Service that has the objective of creating a [room] using the provided [roomRepository].
3335
*/
3436
class CreateRoom(private val room: Room, private val roomRepository: RoomRepository) : ApplicationService<Room?> {
3537
override fun execute(): Room? = this.roomRepository.createRoom(room)
3638
}
39+
40+
/**
41+
* Application Service that has the objective of deleting a room using the provided [roomRepository].
42+
*/
43+
class DeleteRoom(
44+
private val roomID: RoomID,
45+
private val roomRepository: RoomRepository
46+
) : ApplicationService<Boolean> {
47+
override fun execute(): Boolean = this.roomRepository.deleteRoom(roomID)
48+
}
49+
50+
/**
51+
* Application Service that has the objective of getting the information about a specific room identified
52+
* by a [roomID] that - if specified - are respect a specific [dateTime] using the provided [roomRepository].
53+
*/
54+
class GetRoom(
55+
private val roomID: RoomID,
56+
private val roomRepository: RoomRepository,
57+
private val dateTime: Date? = null
58+
) : ApplicationService<Room?> {
59+
override fun execute(): Room? = this.roomRepository.findBy(roomID, dateTime)
60+
}
3761
}

0 commit comments

Comments
 (0)