Skip to content

Commit

Permalink
add :: 컨트롤러 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ta2ye0n committed Sep 12, 2024
1 parent 1841588 commit 7ab700f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(
Expand All @@ -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<Void> =
postMusicLikeService.execute(musicId)
@PatchMapping("/{music_id}/like")
fun toggleMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity<Void> =
toggleMusicLikeService.execute(musicId)
.run { ResponseEntity.status(HttpStatus.OK).build() }

@DeleteMapping("/{music_id}/like")
fun deleteMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity<Void> =
deleteMusicLikeService.execute(musicId)
.run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() }

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Void> =
Expand All @@ -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<Void> =
postMusicLikeService.execute(musicId)
@PatchMapping("/{music_id}/like")
fun toggleMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity<Void> =
toggleMusicLikeService.execute(musicId)
.run { ResponseEntity.status(HttpStatus.OK).build() }

@DeleteMapping("/{music_id}/like")
fun deleteMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity<Void> =
deleteMusicLikeService.execute(musicId)
.run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Void> =
Expand All @@ -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<Void> =
postMusicLikeService.execute(musicId)
@PatchMapping("/{music_id}/like")
fun toggleMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity<Void> =
toggleMusicLikeService.execute(musicId)
.run { ResponseEntity.status(HttpStatus.OK).build() }

@DeleteMapping("/{music_id}/like")
fun deleteMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity<Void> =
deleteMusicLikeService.execute(musicId)
.run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Void> =
Expand All @@ -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<Void> =
postMusicLikeService.execute(musicId)
@PatchMapping("/{music_id}/like")
fun toggleMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity<Void> =
toggleMusicLikeService.execute(musicId)
.run { ResponseEntity.status(HttpStatus.OK).build() }

@DeleteMapping("/{music_id}/like")
fun deleteMusicLike(@PathVariable("music_id") musicId: Long): ResponseEntity<Void> =
deleteMusicLikeService.execute(musicId)
.run { ResponseEntity.status(HttpStatus.NO_CONTENT).build() }
}

0 comments on commit 7ab700f

Please sign in to comment.