diff --git a/src/main/kotlin/com/dotori/v2/domain/music/presentation/admin/AdminMusicController.kt b/src/main/kotlin/com/dotori/v2/domain/music/presentation/admin/AdminMusicController.kt index 6742198f..92394c6e 100644 --- a/src/main/kotlin/com/dotori/v2/domain/music/presentation/admin/AdminMusicController.kt +++ b/src/main/kotlin/com/dotori/v2/domain/music/presentation/admin/AdminMusicController.kt @@ -1,10 +1,9 @@ package com.dotori.v2.domain.music.presentation.admin import com.dotori.v2.domain.music.presentation.data.res.MusicListResDto -import com.dotori.v2.domain.music.service.DeleteMusicLikeService import com.dotori.v2.domain.music.service.DeleteMusicService import com.dotori.v2.domain.music.service.FindMusicsService -import com.dotori.v2.domain.music.service.PostMusicLikeService +import com.dotori.v2.domain.music.service.ToggleMusicLikeService import org.springframework.format.annotation.DateTimeFormat import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity @@ -16,8 +15,7 @@ import java.time.LocalDate class AdminMusicController( private val findMusicsService: FindMusicsService, private val deleteMusicService: DeleteMusicService, - private val postMusicLikeService: PostMusicLikeService, - private val deleteMusicLikeService: DeleteMusicLikeService, + private val toggleMusicLikeService: ToggleMusicLikeService ) { @GetMapping fun findMusics( @@ -33,14 +31,8 @@ class AdminMusicController( deleteMusicService.execute(musicId) .run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() } - @PostMapping("/{music_id}/like") - fun postMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = - postMusicLikeService.execute(musicId) + @PatchMapping("/{music_id}/like") + fun toggleMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = + toggleMusicLikeService.execute(musicId) .run { ResponseEntity.status(HttpStatus.OK).build() } - - @DeleteMapping("/{music_id}/like") - fun deleteMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = - deleteMusicLikeService.execute(musicId) - .run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() } - } \ No newline at end of file diff --git a/src/main/kotlin/com/dotori/v2/domain/music/presentation/councillor/CouncillorMusicController.kt b/src/main/kotlin/com/dotori/v2/domain/music/presentation/councillor/CouncillorMusicController.kt index 8caf1c4d..06cdf0f1 100644 --- a/src/main/kotlin/com/dotori/v2/domain/music/presentation/councillor/CouncillorMusicController.kt +++ b/src/main/kotlin/com/dotori/v2/domain/music/presentation/councillor/CouncillorMusicController.kt @@ -3,10 +3,9 @@ package com.dotori.v2.domain.music.presentation.councillor import com.dotori.v2.domain.music.presentation.data.req.ApplyMusicReqDto import com.dotori.v2.domain.music.presentation.data.res.MusicListResDto import com.dotori.v2.domain.music.service.ApplyMusicService -import com.dotori.v2.domain.music.service.DeleteMusicLikeService import com.dotori.v2.domain.music.service.DeleteMusicService import com.dotori.v2.domain.music.service.FindMusicsService -import com.dotori.v2.domain.music.service.PostMusicLikeService +import com.dotori.v2.domain.music.service.ToggleMusicLikeService import org.springframework.format.annotation.DateTimeFormat import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity @@ -20,8 +19,7 @@ class CouncillorMusicController( private val applyMusicService: ApplyMusicService, private val findMusicsService: FindMusicsService, private val deleteMusicService: DeleteMusicService, - private val postMusicLikeService: PostMusicLikeService, - private val deleteMusicLikeService: DeleteMusicLikeService, + private val toggleMusicLikeService: ToggleMusicLikeService ) { @PostMapping fun applyMusic(@RequestBody applyMusicReqDto: ApplyMusicReqDto): ResponseEntity = @@ -42,13 +40,8 @@ class CouncillorMusicController( deleteMusicService.execute(musicId) .run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() } - @PostMapping("/{music_id}/like") - fun postMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = - postMusicLikeService.execute(musicId) + @PatchMapping("/{music_id}/like") + fun toggleMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = + toggleMusicLikeService.execute(musicId) .run { ResponseEntity.status(HttpStatus.OK).build() } - - @DeleteMapping("/{music_id}/like") - fun deleteMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = - deleteMusicLikeService.execute(musicId) - .run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() } } \ No newline at end of file diff --git a/src/main/kotlin/com/dotori/v2/domain/music/presentation/developer/DeveloperMusicController.kt b/src/main/kotlin/com/dotori/v2/domain/music/presentation/developer/DeveloperMusicController.kt index 435e3114..f7b22f77 100644 --- a/src/main/kotlin/com/dotori/v2/domain/music/presentation/developer/DeveloperMusicController.kt +++ b/src/main/kotlin/com/dotori/v2/domain/music/presentation/developer/DeveloperMusicController.kt @@ -3,10 +3,9 @@ package com.dotori.v2.domain.music.presentation.developer import com.dotori.v2.domain.music.presentation.data.req.ApplyMusicReqDto import com.dotori.v2.domain.music.presentation.data.res.MusicListResDto import com.dotori.v2.domain.music.service.ApplyMusicService -import com.dotori.v2.domain.music.service.DeleteMusicLikeService import com.dotori.v2.domain.music.service.DeleteMusicService import com.dotori.v2.domain.music.service.FindMusicsService -import com.dotori.v2.domain.music.service.PostMusicLikeService +import com.dotori.v2.domain.music.service.ToggleMusicLikeService import org.springframework.format.annotation.DateTimeFormat import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity @@ -20,8 +19,7 @@ class DeveloperMusicController( private val applyMusicService: ApplyMusicService, private val findMusicsService: FindMusicsService, private val deleteMusicService: DeleteMusicService, - private val postMusicLikeService: PostMusicLikeService, - private val deleteMusicLikeService: DeleteMusicLikeService, + private val toggleMusicLikeService: ToggleMusicLikeService ) { @PostMapping fun applyMusic(@RequestBody applyMusicReqDto: ApplyMusicReqDto): ResponseEntity = @@ -42,13 +40,8 @@ class DeveloperMusicController( deleteMusicService.execute(musicId) .run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() } - @PostMapping("/{music_id}/like") - fun postMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = - postMusicLikeService.execute(musicId) + @PatchMapping("/{music_id}/like") + fun toggleMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = + toggleMusicLikeService.execute(musicId) .run { ResponseEntity.status(HttpStatus.OK).build() } - - @DeleteMapping("/{music_id}/like") - fun deleteMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = - deleteMusicLikeService.execute(musicId) - .run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() } } \ No newline at end of file diff --git a/src/main/kotlin/com/dotori/v2/domain/music/presentation/member/MemberMusicController.kt b/src/main/kotlin/com/dotori/v2/domain/music/presentation/member/MemberMusicController.kt index 3c25a0f2..38b31481 100644 --- a/src/main/kotlin/com/dotori/v2/domain/music/presentation/member/MemberMusicController.kt +++ b/src/main/kotlin/com/dotori/v2/domain/music/presentation/member/MemberMusicController.kt @@ -3,10 +3,9 @@ package com.dotori.v2.domain.music.presentation.member import com.dotori.v2.domain.music.presentation.data.req.ApplyMusicReqDto import com.dotori.v2.domain.music.presentation.data.res.MusicListResDto import com.dotori.v2.domain.music.service.ApplyMusicService -import com.dotori.v2.domain.music.service.DeleteMusicLikeService import com.dotori.v2.domain.music.service.DeleteMyMusicService import com.dotori.v2.domain.music.service.FindMusicsService -import com.dotori.v2.domain.music.service.PostMusicLikeService +import com.dotori.v2.domain.music.service.ToggleMusicLikeService import org.springframework.format.annotation.DateTimeFormat import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity @@ -20,8 +19,7 @@ class MemberMusicController( private val applyMusicService: ApplyMusicService, private val findMusicsService: FindMusicsService, private val deleteMyMusicService: DeleteMyMusicService, - private val postMusicLikeService: PostMusicLikeService, - private val deleteMusicLikeService: DeleteMusicLikeService, + private val toggleMusicLikeService: ToggleMusicLikeService ) { @PostMapping fun applyMusic(@RequestBody applyMusicReqDto: ApplyMusicReqDto): ResponseEntity = @@ -42,13 +40,8 @@ class MemberMusicController( deleteMyMusicService.execute(musicId) .run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() } - @PostMapping("/{music_id}/like") - fun postMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = - postMusicLikeService.execute(musicId) + @PatchMapping("/{music_id}/like") + fun toggleMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = + toggleMusicLikeService.execute(musicId) .run { ResponseEntity.status(HttpStatus.OK).build() } - - @DeleteMapping("/{music_id}/like") - fun deleteMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity = - deleteMusicLikeService.execute(musicId) - .run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() } } \ No newline at end of file