File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
src/main/kotlin/application/service Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2023. Smart Operating Block
3
+ *
4
+ * Use of this source code is governed by an MIT-style
5
+ * license that can be found in the LICENSE file or at
6
+ * https://opensource.org/licenses/MIT.
7
+ */
8
+
9
+ package application.service
10
+
11
+ import entity.zone.Room
12
+ import usecase.repository.RoomRepository
13
+
14
+ /* *
15
+ * Module that wraps all the services that orchestrate the application logic (not domain one).
16
+ */
17
+ object Service {
18
+ /* *
19
+ * Interface that models an Application Service.
20
+ * An Application Service handle application logic without business elements.
21
+ * @param[T] the type returned by the service.
22
+ */
23
+ interface ApplicationService <out T > {
24
+ /* *
25
+ * Method to execute the application service.
26
+ * @return the result of type [T]
27
+ */
28
+ fun execute (): T
29
+ }
30
+
31
+ /* *
32
+ * Application Service that has the objective of creating a [room] using the [roomRepository] passed.
33
+ */
34
+ class CreateRoom (private val room : Room , private val roomRepository : RoomRepository ) : ApplicationService<Room?> {
35
+ override fun execute (): Room ? = this .roomRepository.createRoom(room)
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments