From d7b279ffaf235b004929369452587bbd6351a344 Mon Sep 17 00:00:00 2001 From: Chan531 Date: Sun, 12 Jan 2025 01:54:54 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=ED=83=80=EC=9E=84=20=EB=B8=94?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=20dto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/request/TimeBlockUpdateRequest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/com/tiki/server/timeblock/dto/request/TimeBlockUpdateRequest.java diff --git a/src/main/java/com/tiki/server/timeblock/dto/request/TimeBlockUpdateRequest.java b/src/main/java/com/tiki/server/timeblock/dto/request/TimeBlockUpdateRequest.java new file mode 100644 index 00000000..761ca742 --- /dev/null +++ b/src/main/java/com/tiki/server/timeblock/dto/request/TimeBlockUpdateRequest.java @@ -0,0 +1,12 @@ +package com.tiki.server.timeblock.dto.request; + +import java.time.LocalDate; + +import jakarta.validation.constraints.NotNull; + +public record TimeBlockUpdateRequest( + @NotNull String name, + @NotNull LocalDate startDate, + @NotNull LocalDate endDate +) { +} From 31859b40f6e2b293dd76abaa1b9019331abddb3a Mon Sep 17 00:00:00 2001 From: Chan531 Date: Sun, 12 Jan 2025 01:55:08 +0900 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=ED=83=80=EC=9E=84=EB=B8=94?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=20=EC=84=B1=EA=B3=B5=20=EB=A9=94?= =?UTF-8?q?=EC=84=B8=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/tiki/server/timeblock/message/SuccessMessage.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/tiki/server/timeblock/message/SuccessMessage.java b/src/main/java/com/tiki/server/timeblock/message/SuccessMessage.java index 2e7b01b7..2eadc1b1 100644 --- a/src/main/java/com/tiki/server/timeblock/message/SuccessMessage.java +++ b/src/main/java/com/tiki/server/timeblock/message/SuccessMessage.java @@ -11,6 +11,7 @@ public enum SuccessMessage { SUCCESS_GET_TIMELINE("타임라인 조회 성공"), SUCCESS_GET_ALL_TIME_BLOCK("전체 타임블록 조회 성공"), SUCCESS_GET_TIME_BLOCK_DETAIL("타임 블록 상세 정보 조회 성공"), + SUCCESS_UPDATE_TIME_BLOCK("타임 블록 정보 수정 성공"), SUCCESS_CREATE_DOCUMENT_TAG("파일 태그 성공"); private final String message; From 026dc2aed81576a45c9f527ca87ed214c6542ed3 Mon Sep 17 00:00:00 2001 From: Chan531 Date: Sun, 12 Jan 2025 01:55:20 +0900 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20=ED=83=80=EC=9E=84=EB=B8=94?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/tiki/server/timeblock/entity/TimeBlock.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/tiki/server/timeblock/entity/TimeBlock.java b/src/main/java/com/tiki/server/timeblock/entity/TimeBlock.java index e4ed1b63..cd54d010 100644 --- a/src/main/java/com/tiki/server/timeblock/entity/TimeBlock.java +++ b/src/main/java/com/tiki/server/timeblock/entity/TimeBlock.java @@ -11,6 +11,7 @@ import com.tiki.server.common.entity.Position; import com.tiki.server.team.entity.Team; import com.tiki.server.timeblock.dto.request.TimeBlockCreateRequest; +import com.tiki.server.timeblock.dto.request.TimeBlockUpdateRequest; import jakarta.persistence.Column; import jakarta.persistence.Entity; @@ -69,4 +70,10 @@ public static TimeBlock of(final Team team, final Position accessiblePosition, .type(request.blockType()) .build(); } + + public void updateNameAndDate(final TimeBlockUpdateRequest request) { + this.name = request.name(); + this.startDate = request.startDate(); + this.endDate = request.endDate(); + } } From 82533d7120ff2c1b0fbf7ed02792e0a0c919beed Mon Sep 17 00:00:00 2001 From: Chan531 Date: Sun, 12 Jan 2025 01:55:32 +0900 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20=ED=83=80=EC=9E=84=EB=B8=94?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=20=EB=A1=9C=EC=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/timeblock/service/TimeBlockService.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/tiki/server/timeblock/service/TimeBlockService.java b/src/main/java/com/tiki/server/timeblock/service/TimeBlockService.java index 60d03ab4..a5d1082a 100644 --- a/src/main/java/com/tiki/server/timeblock/service/TimeBlockService.java +++ b/src/main/java/com/tiki/server/timeblock/service/TimeBlockService.java @@ -1,5 +1,6 @@ package com.tiki.server.timeblock.service; +import com.tiki.server.timeblock.dto.request.TimeBlockUpdateRequest; import com.tiki.server.timeblock.service.dto.response.AllTimeBlockServiceResponse; import java.util.List; @@ -101,6 +102,19 @@ public TimeBlockDetailGetResponse getTimeBlockDetail( return TimeBlockDetailGetResponse.from(documents, notes); } + @Transactional + public void updateTimeBlock( + final long memberId, + final long teamId, + final long timeBlockId, + final TimeBlockUpdateRequest request + ) { + MemberTeamManager memberTeamManager = memberTeamManagerFinder.findByMemberIdAndTeamId(memberId, teamId); + TimeBlock timeBlock = timeBlockFinder.findByIdAndTeamId(timeBlockId, teamId); + memberTeamManager.checkMemberAccessible(timeBlock.getAccessiblePosition()); + timeBlock.updateNameAndDate(request); + } + @Transactional public void deleteTimeBlock(final long memberId, final long teamId, final long timeBlockId) { MemberTeamManager memberTeamManager = memberTeamManagerFinder.findByMemberIdAndTeamId(memberId, teamId); From d7d40d70d181158a542959ecb69716fa7d4a695a Mon Sep 17 00:00:00 2001 From: Chan531 Date: Sun, 12 Jan 2025 01:55:44 +0900 Subject: [PATCH 5/6] =?UTF-8?q?feat:=20=ED=83=80=EC=9E=84=EB=B8=94?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TimeBlockController.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/com/tiki/server/timeblock/controller/TimeBlockController.java b/src/main/java/com/tiki/server/timeblock/controller/TimeBlockController.java index 83eae518..61cfafb1 100644 --- a/src/main/java/com/tiki/server/timeblock/controller/TimeBlockController.java +++ b/src/main/java/com/tiki/server/timeblock/controller/TimeBlockController.java @@ -5,7 +5,9 @@ import static com.tiki.server.timeblock.message.SuccessMessage.SUCCESS_GET_ALL_TIME_BLOCK; import static com.tiki.server.timeblock.message.SuccessMessage.SUCCESS_GET_TIMELINE; import static com.tiki.server.timeblock.message.SuccessMessage.SUCCESS_GET_TIME_BLOCK_DETAIL; +import static com.tiki.server.timeblock.message.SuccessMessage.SUCCESS_UPDATE_TIME_BLOCK; +import com.tiki.server.timeblock.dto.request.TimeBlockUpdateRequest; import com.tiki.server.timeblock.service.dto.response.AllTimeBlockServiceResponse; import java.security.Principal; import java.util.List; @@ -13,6 +15,7 @@ import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; +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.RequestBody; @@ -91,6 +94,20 @@ public SuccessResponse getTimeBlockDetail( return SuccessResponse.success(SUCCESS_GET_TIME_BLOCK_DETAIL.getMessage(), response); } + @Override + @ResponseStatus(HttpStatus.OK) + @PatchMapping("/teams/{teamId}/time-block/{timeBlockId}") + public SuccessResponse updateTimeBlock( + final Principal principal, + @PathVariable final long teamId, + @PathVariable final long timeBlockId, + @RequestBody final TimeBlockUpdateRequest request + ) { + long memberId = Long.parseLong(principal.getName()); + timeBlockService.updateTimeBlock(memberId, teamId, timeBlockId, request); + return SuccessResponse.success(SUCCESS_UPDATE_TIME_BLOCK.getMessage()); + } + @Override @ResponseStatus(HttpStatus.NO_CONTENT) @DeleteMapping("/teams/{teamId}/time-block/{timeBlockId}") From 0bd03afafd31e3ee1018c7cff36b87d77c6a23be Mon Sep 17 00:00:00 2001 From: Chan531 Date: Sun, 12 Jan 2025 01:55:55 +0900 Subject: [PATCH 6/6] =?UTF-8?q?feat:=20=ED=83=80=EC=9E=84=EB=B8=94?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=20api=20=EC=8A=A4=EC=9B=A8?= =?UTF-8?q?=EA=B1=B0=20=EC=84=A4=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docs/TimeBlockControllerDocs.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/main/java/com/tiki/server/timeblock/controller/docs/TimeBlockControllerDocs.java b/src/main/java/com/tiki/server/timeblock/controller/docs/TimeBlockControllerDocs.java index 01ea743b..66547316 100644 --- a/src/main/java/com/tiki/server/timeblock/controller/docs/TimeBlockControllerDocs.java +++ b/src/main/java/com/tiki/server/timeblock/controller/docs/TimeBlockControllerDocs.java @@ -1,5 +1,6 @@ package com.tiki.server.timeblock.controller.docs; +import com.tiki.server.timeblock.dto.request.TimeBlockUpdateRequest; import com.tiki.server.timeblock.service.dto.response.AllTimeBlockServiceResponse; import java.security.Principal; import java.util.List; @@ -195,6 +196,48 @@ SuccessResponse getTimeBlockDetail( @PathVariable final long timeBlockId ); + @Operation( + summary = "타임 블록 정보 수정", + description = "타임 블록 정보를 수정한다.", + responses = { + @ApiResponse(responseCode = "200", description = "성공"), + @ApiResponse( + responseCode = "403", + description = "접근 권한 없음", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "404", + description = "팀에 존재하지 않는 회원, 유효하지 않은 타임 블록", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "4xx", + description = "클라이언트(요청) 오류", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse( + responseCode = "500", + description = "서버 내부 오류", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)))} + ) + SuccessResponse updateTimeBlock( + @Parameter(hidden = true) final Principal principal, + @Parameter( + name = "teamId", + description = "팀 id", + in = ParameterIn.PATH, + example = "1" + ) + @PathVariable final long teamId, + @Parameter( + name = "timeBlockId", + description = "타임 블록 id", + in = ParameterIn.PATH, + example = "1" + ) + @PathVariable final long timeBlockId, + @RequestBody final TimeBlockUpdateRequest request + + ); + @Operation( summary = "타임 블록 삭제", description = "타임 블록을 삭제한다.",