라이브 메뉴판
- 불필요한 API 제거
This commit is contained in:
		| @@ -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)) | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user