1
1
package com.wespot.admin
2
2
3
- import com.wespot.admin.dto.CreatedVoteOptionRequest
4
- import com.wespot.admin.dto.UpdateVoteOptionRequest
5
- import com.wespot.admin.dto.VoteOptionResponses
3
+ import com.wespot.admin.dto.*
6
4
import com.wespot.admin.port.`in`.AdminVoteOptionUseCase
5
+ import com.wespot.admin.port.`in`.FirebaseUseCase
7
6
import com.wespot.admin.swagger.AdminSwagger
8
7
import com.wespot.notification.dto.NotificationPublishingRequest
8
+ import com.wespot.notification.dto.PublishNotificationTypeResponse
9
9
import com.wespot.notification.port.`in`.PublishNotificationUseCase
10
10
import org.springframework.http.HttpStatus
11
11
import org.springframework.http.ResponseEntity
12
12
import org.springframework.stereotype.Controller
13
+ import org.springframework.web.bind.annotation.DeleteMapping
13
14
import org.springframework.web.bind.annotation.GetMapping
14
15
import org.springframework.web.bind.annotation.PathVariable
15
16
import org.springframework.web.bind.annotation.PostMapping
@@ -21,7 +22,8 @@ import org.springframework.web.bind.annotation.RequestMapping
21
22
@RequestMapping(" /admin" )
22
23
class AdminController (
23
24
private val adminVoteOptionUseCase : AdminVoteOptionUseCase ,
24
- private val publishNotificationUseCase : PublishNotificationUseCase
25
+ private val publishNotificationUseCase : PublishNotificationUseCase ,
26
+ private val firebaseUseCase : FirebaseUseCase ,
25
27
) : AdminSwagger {
26
28
27
29
@GetMapping(" /vote-options" )
@@ -61,6 +63,13 @@ class AdminController(
61
63
return ResponseEntity .ok(response)
62
64
}
63
65
66
+ @GetMapping(" /push-notification/publish" )
67
+ override fun getNotificationPublishingScreen (): ResponseEntity <List <PublishNotificationTypeResponse >> {
68
+ val response = publishNotificationUseCase.viewAllOfPossibleToPublishTypes()
69
+
70
+ return ResponseEntity .ok(response)
71
+ }
72
+
64
73
@PostMapping(" /push-notification/publish" )
65
74
override fun publishNotification (
66
75
@RequestBody notificationPublishingRequest : NotificationPublishingRequest
@@ -71,21 +80,35 @@ class AdminController(
71
80
.build()
72
81
}
73
82
74
- @GetMapping(" " ) // Notific
75
- override fun getRemoteConfigsVariable (): ResponseEntity <List <RemoteConfigVariableResponse >> {
83
+ @GetMapping(" /remote-config" )
84
+ override fun getRemoteConfigsVariables (): ResponseEntity <List <RemoteConfigVariableResponse >> {
85
+ val response = firebaseUseCase.findAllVariableInRemoteConfig()
76
86
77
- publishNotificationUseCase.publishProfileUpdate(notificationPublishingRequest)
87
+ return ResponseEntity .ok(response)
88
+ }
78
89
79
- return ResponseEntity .status(HttpStatus .CREATED )
90
+ @PutMapping(" /remote-config" )
91
+ override fun setRemoteConfigVariables (@RequestBody request : ModifiedRemoteConfigVariableRequest ): ResponseEntity <Unit > {
92
+ firebaseUseCase.modifyRemoteConfigVariables(request)
93
+
94
+ return ResponseEntity .status(HttpStatus .OK )
80
95
.build()
81
96
}
82
97
83
- @PutMapping( " " ) // Notific
84
- override fun getNotification ( ): ResponseEntity <Unit > {
85
- publishNotificationUseCase.publishProfileUpdate(notificationPublishingRequest )
98
+ @PostMapping( " /remote-config " )
99
+ override fun addRemoteConfigVariables (@RequestBody request : SavedRemoteConfigVariableRequest ): ResponseEntity <Unit > {
100
+ firebaseUseCase.addRemoteConfigVariables(request )
86
101
87
102
return ResponseEntity .status(HttpStatus .CREATED )
88
103
.build()
89
104
}
90
105
106
+ @DeleteMapping(" /remote-config/{key}" )
107
+ override fun deleteRemoteConfigVariables (@PathVariable key : String ): ResponseEntity <Unit > {
108
+ firebaseUseCase.remoteRemoteConfigVariables(key)
109
+
110
+ return ResponseEntity .noContent()
111
+ .build()
112
+ }
113
+
91
114
}
0 commit comments