Skip to content

Commit

Permalink
๐Ÿ”€ :: (#212) ํ…Œ์ŠคํŠธ ์•Œ๋ฆผ ๋ฐœ์†ก API
Browse files Browse the repository at this point in the history
๐Ÿ”€ :: (#212) ํ…Œ์ŠคํŠธ ์•Œ๋ฆผ ๋ฐœ์†ก API
  • Loading branch information
lyutvs authored Apr 14, 2023
2 parents ee14273 + 05be361 commit d341171
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DetailApiImpl(
private val queryCategoryRepositorySpi: QueryCategoryRepositorySpi,
private val postDetailFcmSpi: PostDetailFcmSpi,
private val postDetailUserSpi: PostDetailUserSpi,
private val queryDetailRepositorySpi: QueryDetailRepositorySpi
private val queryDetailRepositorySpi: QueryDetailRepositorySpi,
): DetailApi {

override fun postGroupNotification(categoryId: UUID, title: String, content: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ package io.github.v1servicenotification.domain.detail.presentation
import io.github.v1servicenotification.detail.api.DetailApi
import io.github.v1servicenotification.detail.api.dto.response.DetailResponse
import io.github.v1servicenotification.detail.api.dto.response.NotificationCountResponse
import io.github.v1servicenotification.domain.detail.presentation.dto.request.PostTestNotificationRequset
import io.github.v1servicenotification.global.extension.getUserId
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController
import javax.validation.Valid

@Tag(name = "์•Œ๋ฆผ ์ƒ์„ธ", description = "์•Œ๋ฆผ ์ƒ์„ธ Api์ž…๋‹ˆ๋‹ค.")
@RestController
Expand All @@ -26,4 +30,10 @@ class DetailController(
fun queryUnreadNotificationCount(): NotificationCountResponse {
return detailApi.queryUnreadNotificationCount(getUserId())
}

@Operation(summary = "ํ…Œ์ŠคํŠธ ์•Œ๋ฆผ ์ „์†ก")
@PostMapping("/test")
fun postNotification(@RequestBody @Valid request: PostTestNotificationRequset) {
detailApi.postNotification(request.userId, request.categoryId, request.title, request.content)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.github.v1servicenotification.domain.detail.presentation.dto.request

import java.util.UUID
import javax.validation.constraints.NotBlank

data class PostTestNotificationRequset(

@field:NotBlank
val userId: UUID,

@field:NotBlank
val categoryId: UUID,

@field:NotBlank
val title: String,

@field:NotBlank
val content: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ class QueueController(
fun notification(@Payload @Valid personal: Personal) {
detailApi.postNotification(personal.userId, personal.categoryId, personal.title, personal.content)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class CustomPostDetailUserImpl(

override fun getDeviceToken(userId: UUID): String {
val result = userClient.token(listOf(userId)).tokens

if(result.isEmpty()) {
throw FeignBadRequestException.EXCEPTION
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestParam
import java.util.UUID

@FeignClient(name = "UserClient", url = "\${user.url}")
@FeignClient(name = "UserClient", url = "\${service.scheme}://\${service.user.host}")
interface UserClient {

@GetMapping("/device-token")
@GetMapping("/users/device-token")
fun token(@RequestParam("users") userList: List<UUID>): TokenResponse

@GetMapping("/exclude")
@GetMapping("/users/exclude")
fun getExcludeUserIdList(@RequestParam("users") userList: List<UUID>): UserIdListResponse
}

0 comments on commit d341171

Please sign in to comment.