From 31e33d49df1ab7974f125fa30f78a5fe8ea1a9c3 Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 6 Mar 2024 00:55:37 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EB=A9=94?= =?UTF-8?q?=EB=89=B4=ED=8C=90=20-=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20API=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/room/menu/LiveRoomMenuController.kt | 42 +------------------ 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/menu/LiveRoomMenuController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/menu/LiveRoomMenuController.kt index 0531e8f..11e3aa8 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/menu/LiveRoomMenuController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/menu/LiveRoomMenuController.kt @@ -3,13 +3,9 @@ package kr.co.vividnext.sodalive.live.room.menu import kr.co.vividnext.sodalive.common.ApiResponse import kr.co.vividnext.sodalive.common.SodaException import kr.co.vividnext.sodalive.member.Member -import kr.co.vividnext.sodalive.member.MemberRole import org.springframework.security.access.prepost.PreAuthorize import org.springframework.security.core.annotation.AuthenticationPrincipal import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.PostMapping -import org.springframework.web.bind.annotation.PutMapping -import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController @@ -17,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController @RestController @RequestMapping("/live/room/menu") class LiveRoomMenuController(private val service: LiveRoomMenuService) { - @GetMapping("/creator") + @GetMapping("/all") @PreAuthorize("hasRole('CREATOR')") fun getAllLiveMenu( @RequestParam creatorId: Long, @@ -27,40 +23,4 @@ class LiveRoomMenuController(private val service: LiveRoomMenuService) { ApiResponse.ok(service.getAllLiveMenu(creatorId = creatorId, memberId = member.id!!)) } - - @PostMapping - @PreAuthorize("hasRole('CREATOR')") - fun createLiveMenu( - @RequestBody request: CreateLiveMenuRequest, - @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? - ) = run { - if (member == null || member.role != MemberRole.CREATOR) { - throw SodaException("로그인 정보를 확인해주세요.") - } - - ApiResponse.ok(service.createLiveMenu(memberId = member.id!!, request = request)) - } - - @PutMapping - @PreAuthorize("hasRole('CREATOR')") - fun updateLiveMenu( - @RequestBody request: UpdateLiveMenuRequest, - @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? - ) = run { - if (member == null || member.role != MemberRole.CREATOR) { - throw SodaException("로그인 정보를 확인해주세요.") - } - - ApiResponse.ok(service.updateLiveMenu(memberId = member.id!!, request = request)) - } - - @GetMapping - fun getMenu( - @RequestParam creatorId: Long, - @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? - ) = run { - if (member == null) throw SodaException("로그인 정보를 확인해주세요.") - - ApiResponse.ok(service.getLiveMenu(creatorId = creatorId)) - } }