콘텐츠 고정, 해제 API 추가

This commit is contained in:
2024-01-26 23:36:17 +09:00
parent 3ea6b5824b
commit 711842f00d
4 changed files with 105 additions and 0 deletions

View File

@@ -196,4 +196,26 @@ class AudioContentController(private val service: AudioContentService) {
fun releaseContent() = run {
ApiResponse.ok(service.releaseContent())
}
@PostMapping("/pin-to-the-top/{id}")
@PreAuthorize("hasRole('CREATOR')")
fun pinToTheTop(
@PathVariable id: Long,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(service.pinToTheTop(contentId = id, member = member))
}
@PutMapping("/unpin-at-the-top/{id}")
@PreAuthorize("hasRole('CREATOR')")
fun unpinAtTheTop(
@PathVariable id: Long,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(service.unpinAtTheTop(contentId = id, member = member))
}
}