Skip to content

Commit

Permalink
feat: apply PreventDuplicateRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
KimDoubleB committed Sep 19, 2024
1 parent 0dd80e5 commit a769641
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.piikii.application.port.input.dto.request.AddPlaceRequest
import com.piikii.application.port.input.dto.request.ModifyPlaceRequest
import com.piikii.application.port.input.dto.response.PlaceResponse
import com.piikii.application.port.input.dto.response.ScheduleTypeGroupResponse
import com.piikii.input.http.aspect.PreventDuplicateRequest
import com.piikii.input.http.controller.docs.PlaceDocs
import com.piikii.input.http.controller.dto.ResponseForm
import jakarta.validation.Valid
Expand All @@ -35,6 +36,7 @@ class PlaceApi(
private val placeUseCase: PlaceUseCase,
private val imageUploadUseCase: ImageUploadUseCase,
) : PlaceDocs {
@PreventDuplicateRequest("#roomUid + #addPlaceRequest.name")
@ResponseStatus(HttpStatus.CREATED)
@PostMapping(consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
override fun addPlace(
Expand All @@ -54,6 +56,7 @@ class PlaceApi(
return ResponseForm(placeUseCase.findAllByRoomUidGroupByPlaceType(UuidTypeId(roomUid)))
}

@PreventDuplicateRequest("#roomUid + #placeId")
@ResponseStatus(HttpStatus.OK)
@PatchMapping("/{placeId}", consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
override fun modifyPlace(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.piikii.application.port.input.dto.request.RoomSaveRequestForm
import com.piikii.application.port.input.dto.request.RoomUpdateRequestForm
import com.piikii.application.port.input.dto.response.RoomResponse
import com.piikii.application.port.input.dto.response.SaveRoomResponse
import com.piikii.input.http.aspect.PreventDuplicateRequest
import com.piikii.input.http.controller.docs.RoomApiDocs
import com.piikii.input.http.controller.dto.ResponseForm
import jakarta.validation.Valid
Expand Down Expand Up @@ -34,17 +35,18 @@ class RoomApi(
) : RoomApiDocs {
@ResponseStatus(HttpStatus.CREATED)
@PostMapping
override fun create(
override fun createRoom(
@Valid @NotNull @RequestBody request: RoomSaveRequestForm,
): ResponseForm<SaveRoomResponse> {
return ResponseForm(
data = roomUseCase.create(request),
)
}

@PreventDuplicateRequest("#request.roomUid")
@ResponseStatus(HttpStatus.OK)
@PutMapping
override fun modifyInformation(
override fun modifyRoom(
@Valid @NotNull @RequestBody request: RoomUpdateRequestForm,
): ResponseForm<Unit> {
roomUseCase.modify(request)
Expand All @@ -53,7 +55,7 @@ class RoomApi(

@ResponseStatus(HttpStatus.OK)
@DeleteMapping("/{roomUid}")
override fun remove(
override fun deleteRoom(
@NotNull @PathVariable roomUid: UUID,
): ResponseForm<Unit> {
roomUseCase.remove(UuidTypeId(roomUid))
Expand All @@ -62,7 +64,7 @@ class RoomApi(

@ResponseStatus(HttpStatus.OK)
@GetMapping("/{roomUid}")
override fun search(
override fun retrieveRoom(
@NotNull @PathVariable roomUid: UUID,
): ResponseForm<RoomResponse> {
return ResponseForm(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.piikii.application.port.input.dto.request.VoteSaveRequest
import com.piikii.application.port.input.dto.response.VoteResultResponse
import com.piikii.application.port.input.dto.response.VoteStatusResponse
import com.piikii.application.port.input.dto.response.VotedPlacesResponse
import com.piikii.input.http.aspect.PreventDuplicateRequest
import com.piikii.input.http.controller.docs.VoteApiDocs
import com.piikii.input.http.controller.dto.ResponseForm
import jakarta.validation.Valid
Expand All @@ -31,6 +32,7 @@ class VoteApi(
private val voteUseCase: VoteUseCase,
private val roomUseCase: RoomUseCase,
) : VoteApiDocs {
@PreventDuplicateRequest("#roomUid")
@ResponseStatus(HttpStatus.NO_CONTENT)
@PatchMapping("/deadline")
override fun changeVoteDeadline(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface RoomApiDocs {
),
],
)
fun create(
fun createRoom(
@Parameter(
description = "방 생성 요청 정보",
required = true,
Expand All @@ -58,7 +58,7 @@ interface RoomApiDocs {
),
],
)
fun modifyInformation(
fun modifyRoom(
@Parameter(
description = "방 수정 요청 정보",
required = true,
Expand All @@ -80,7 +80,7 @@ interface RoomApiDocs {
),
],
)
fun remove(
fun deleteRoom(
@Parameter(
name = "roomUid",
description = "삭제하고자 하는 방 id",
Expand All @@ -99,7 +99,7 @@ interface RoomApiDocs {
),
],
)
fun search(
fun retrieveRoom(
@Parameter(
name = "roomUid",
description = "조회하고자 하는 방 id",
Expand Down

0 comments on commit a769641

Please sign in to comment.