Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.wespot.comment

import com.wespot.comment.port.`in`.PostCommentDeletedUseCase
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/api/v1/post/comment")
class PostCommentDeletedController(
private val postCommentDeletedUseCase: PostCommentDeletedUseCase
) {

@DeleteMapping("/{commentId}")
fun deletePostComment(
@PathVariable commentId: Long
): ResponseEntity<Void> {
postCommentDeletedUseCase.deleteComment(commentId)

return ResponseEntity.noContent()
.build()
}


}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.wespot.comment

import com.wespot.comment.port.`in`.PostCommentLikeUseCase
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PatchMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

Expand All @@ -13,11 +15,11 @@ class PostCommentLikeController(
private val postCommentLikeUseCase: PostCommentLikeUseCase
) {

@PatchMapping("/{commentId}/like")
@PostMapping("/{commentId}/like")
fun likePostComment(@PathVariable commentId: Long): ResponseEntity<Unit> {
postCommentLikeUseCase.likeComment(commentId)

return ResponseEntity.noContent()
return ResponseEntity.status(HttpStatus.CREATED)
.build()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.wespot.comment

import com.wespot.comment.port.`in`.PostCommentReportUseCase
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PatchMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

Expand All @@ -13,11 +14,11 @@ class PostCommentReportController(
private val postCommentReportUseCase: PostCommentReportUseCase
) {

@PatchMapping("/{commentId}/report")
fun likePostComment(@PathVariable commentId: Long): ResponseEntity<Unit> {
@PostMapping("/{commentId}/report")
fun reportPostComment(@PathVariable commentId: Long): ResponseEntity<Unit> {
postCommentReportUseCase.reportComment(commentId)

return ResponseEntity.noContent()
return ResponseEntity.status(HttpStatus.CREATED)
.build()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.wespot.post

import com.wespot.post.dto.request.ModifyPostNotificationSettingRequest
import com.wespot.post.port.`in`.ModifyPostNotificationSettingUseCase
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PatchMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/api/v2/post")
class ModifyPostNotificationSettingController(
private val modifyPostNotificationSettingUseCase: ModifyPostNotificationSettingUseCase
) {

@PatchMapping("/notification-setting")
fun modifyPostNotificationSetting(
@RequestBody modifyPostNotificationSettingRequest: ModifyPostNotificationSettingRequest
): ResponseEntity<Unit> {
modifyPostNotificationSettingUseCase.changeSetting(modifyPostNotificationSettingRequest = modifyPostNotificationSettingRequest)

return ResponseEntity.noContent()
.build()
}

}
4 changes: 3 additions & 1 deletion app/src/main/kotlin/com/wespot/post/PostBlockController.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.wespot.post

import com.wespot.post.port.`in`.PostBlockUseCase
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
Expand All @@ -17,7 +18,8 @@ class PostBlockController(
fun blockPost(@PathVariable postId: Long): ResponseEntity<Unit> {
postBlockUseCase.blockPost(postId)

return ResponseEntity.noContent().build()
return ResponseEntity.status(HttpStatus.CREATED)
.build()
}

}
8 changes: 4 additions & 4 deletions app/src/main/kotlin/com/wespot/post/PostCategoryController.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.wespot.post

import com.wespot.post.dto.response.PostCategoryDetailResponses
import com.wespot.post.dto.response.PostCategoryResponse
import com.wespot.post.dto.response.FilterChipResponse
import com.wespot.post.dto.response.PostCategoryItemsResponse
import com.wespot.post.port.`in`.PostCategoryUseCase
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
Expand All @@ -15,14 +15,14 @@ class PostCategoryController(
) {

@GetMapping("/details")
fun getPostCategoryDetailResponse(): ResponseEntity<List<PostCategoryDetailResponses>> {
fun getPostCategoryDetailResponse(): ResponseEntity<List<PostCategoryItemsResponse>> {
val response = postCategoryUseCase.getCategoriesDetail()

return ResponseEntity.ok(response)
}

@GetMapping
fun getPostCategoryResponse(): ResponseEntity<List<PostCategoryResponse>> {
fun getPostCategoryResponse(): ResponseEntity<List<FilterChipResponse>> {
val response = postCategoryUseCase.getCategories()

return ResponseEntity.ok(response)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/kotlin/com/wespot/post/PostEditController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.wespot.post

import com.wespot.post.dto.request.UpdatedPostRequest
import com.wespot.post.port.`in`.PostEditUseCase
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*

Expand Down
68 changes: 43 additions & 25 deletions app/src/main/kotlin/com/wespot/post/PostInquiryController.kt
Original file line number Diff line number Diff line change
@@ -1,64 +1,82 @@
package com.wespot.post

import com.wespot.post.dto.response.PostResponse
import com.wespot.post.port.`in`.PostInquiryByCategoryUseCase
import com.wespot.common.dto.PostPagingResponse
import com.wespot.post.dto.response.PostComponentResponse
import com.wespot.post.port.`in`.PostInquiryUseCase
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/api/v1/post")
class PostInquiryController(
private val postInquiryByCategoryUseCase: PostInquiryByCategoryUseCase
private val postInquiryByCategoryUseCase: PostInquiryUseCase
) {

@GetMapping("/all")
fun findAllPosts(): ResponseEntity<List<PostResponse>> {
val responses = postInquiryByCategoryUseCase.findAllPosts()

return ResponseEntity.ok(responses)
}

@GetMapping("/details")
fun findPostsByCategoryId(categoryId: Long): ResponseEntity<List<PostResponse>> {
val responses = postInquiryByCategoryUseCase.findPostsByCategoryId(categoryId)
fun findPostsByCategoryId(
@RequestParam categoryId: Long,
@RequestParam(required = false, defaultValue = "10") inquirySize: Long,
@RequestParam(required = false) cursorId: Long? = null,
): ResponseEntity<PostPagingResponse> {
val responses = postInquiryByCategoryUseCase.findPostsByCategoryId(
categoryId,
inquirySize = inquirySize,
cursorId = cursorId
)

return ResponseEntity.ok(responses)
}

@GetMapping
fun findPostsByMajorCategoryName(majorCategoryName: String): ResponseEntity<List<PostResponse>> {
val responses = postInquiryByCategoryUseCase.findPostsByMajorCategoryName(majorCategoryName)
fun findPostsByMajorCategoryName(
@RequestParam majorCategoryName: String,
@RequestParam(required = false, defaultValue = "0") countOfPostsViewed: Long,
@RequestParam(required = false, defaultValue = "10") inquirySize: Long,
@RequestParam(required = false) cursorId: Long? = null,
): ResponseEntity<PostPagingResponse> {
val responses = postInquiryByCategoryUseCase.findPostsByMajorCategoryName(
majorCategoryName = majorCategoryName,
countOfPostsViewed = countOfPostsViewed,
inquirySize = inquirySize,
cursorId = cursorId
)

return ResponseEntity.ok(responses)
}

@GetMapping("/{postId}")
fun findDetailPost(@PathVariable postId: Long): ResponseEntity<PostResponse> {
fun findDetailPost(@PathVariable postId: Long): ResponseEntity<PostComponentResponse> {
val responses = postInquiryByCategoryUseCase.findPostById(postId)

return ResponseEntity.ok(responses)
}

@GetMapping("/commented")
fun findCommentedPosts(): ResponseEntity<List<PostResponse>> {
val responses = postInquiryByCategoryUseCase.findCommentedPosts()
fun findCommentedPosts(
@RequestParam(required = false, defaultValue = "10") inquirySize: Long,
@RequestParam(required = false) cursorId: Long? = null,
): ResponseEntity<PostPagingResponse> {
val responses = postInquiryByCategoryUseCase.findCommentedPosts(inquirySize = inquirySize, cursorId = cursorId)

return ResponseEntity.ok(responses)
}

@GetMapping("/scrapped")
fun findScrappedPosts(): ResponseEntity<List<PostResponse>> {
val responses = postInquiryByCategoryUseCase.findScrappedPosts()
fun findScrappedPosts(
@RequestParam(required = false, defaultValue = "10") inquirySize: Long,
@RequestParam(required = false) cursorId: Long? = null,
): ResponseEntity<PostPagingResponse> {
val responses = postInquiryByCategoryUseCase.findScrappedPosts(inquirySize = inquirySize, cursorId = cursorId)

return ResponseEntity.ok(responses)
}

@GetMapping("/written")
fun findWrittenPosts(): ResponseEntity<List<PostResponse>> {
val responses = postInquiryByCategoryUseCase.findWrittenPosts()
fun findWrittenPosts(
@RequestParam(required = false, defaultValue = "10") inquirySize: Long,
@RequestParam(required = false) cursorId: Long? = null,
): ResponseEntity<PostPagingResponse> {
val responses = postInquiryByCategoryUseCase.findWrittenPosts(inquirySize = inquirySize, cursorId = cursorId)

return ResponseEntity.ok(responses)
}
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/kotlin/com/wespot/post/PostLikeController.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.wespot.post

import com.wespot.post.port.`in`.PostLikeUseCase
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PatchMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

Expand All @@ -14,11 +15,11 @@ class PostLikeController(
private val postLikeUseCase: PostLikeUseCase
) {

@PatchMapping("/{postId}/like")
@PostMapping("/{postId}/like")
fun likePost(@PathVariable postId: Long): ResponseEntity<Unit> {
postLikeUseCase.likePost(postId)

return ResponseEntity.noContent()
return ResponseEntity.status(HttpStatus.CREATED)
.build()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.wespot.post

import com.wespot.post.port.`in`.PostNotificationUseCase
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PatchMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

Expand All @@ -14,11 +15,11 @@ class PostNotificationSettingController(
private val postNotificationUseCase: PostNotificationUseCase
) {

@PatchMapping("/{postId}/notification/comment")
@PostMapping("/{postId}/notification/comment")
fun updatePostNotificationSettingForComment(@PathVariable postId: Long): ResponseEntity<Unit> {
postNotificationUseCase.toggleNotification(postId)

return ResponseEntity.noContent()
return ResponseEntity.status(HttpStatus.CREATED)
.build()
}

Expand Down
10 changes: 8 additions & 2 deletions app/src/main/kotlin/com/wespot/post/PostReportController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ package com.wespot.post

import com.wespot.post.dto.request.PostReportRequest
import com.wespot.post.port.`in`.PostReportUseCase
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/api/v1/post")
Expand All @@ -14,7 +18,9 @@ class PostReportController(
@PostMapping("/{postId}/report")
fun reportPost(@PathVariable postId: Long, request: PostReportRequest): ResponseEntity<Unit> {
postReportUseCase.reportPost(postId, request)
return ResponseEntity.noContent().build()

return ResponseEntity.status(HttpStatus.CREATED)
.build()
}

}
10 changes: 6 additions & 4 deletions app/src/main/kotlin/com/wespot/post/PostScrapController.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.wespot.post

import com.wespot.post.port.`in`.PostScrapUseCase
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PatchMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

Expand All @@ -12,11 +14,11 @@ class PostScrapController(
private val postScrapUseCase: PostScrapUseCase
) {

@PatchMapping("/{postId}/scrap")
fun scrapPost(postId: Long): ResponseEntity<Unit> {
@PostMapping("/{postId}/scrap")
fun scrapPost(@PathVariable postId: Long): ResponseEntity<Unit> {
postScrapUseCase.scrapPost(postId)

return ResponseEntity.noContent()
return ResponseEntity.status(HttpStatus.CREATED)
.build()
}

Expand Down
Loading
Loading