9
9
package application.service
10
10
11
11
import entity.zone.Room
12
+ import entity.zone.RoomID
12
13
import usecase.repository.RoomRepository
14
+ import java.util.Date
13
15
14
16
/* *
15
17
* Module that wraps all the services that orchestrate the application logic (not domain one).
@@ -29,9 +31,31 @@ object Service {
29
31
}
30
32
31
33
/* *
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].
33
35
*/
34
36
class CreateRoom (private val room : Room , private val roomRepository : RoomRepository ) : ApplicationService<Room?> {
35
37
override fun execute (): Room ? = this .roomRepository.createRoom(room)
36
38
}
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
+ }
37
61
}
0 commit comments