-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨ [STMT-263] 에러 전역 처리기: 에러 추적 결과 출력 기능 추가 * ✨ [STMT-263] activity 수정 메서드 구현 * ✨ [STMT-263] activity image update 기능 구현 * ✨ [STMT-263] activity participant update 기능 추가 * ♻️ [STMT-263] activity create -> save 이름 변경 * ✨ [STMT-263] activity 수정 API 구현 * ♻️ [STMT-263] activityCreateSource -> activitySource 이름 변경 * ✅ [STMT-263] DEFAULT 유형의 활동의 setup 데이터에서 기한 제거 * ♻️ [STMT-263] modify -> update로 클래스 이름 변경 * ♻️ [STMT-263] period 검증 로직을 Activity 클래스에 공통 메서드로 추출 * ✅ [STMT-263] 활동 수정 API 테스트 케이스 작성 * 🐛 [STMT-263] isAuthor 메서드 접근 제한자 변경
- Loading branch information
Showing
24 changed files
with
669 additions
and
220 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/main/java/com/stumeet/server/activity/adapter/in/ActivityUpdateApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.stumeet.server.activity.adapter.in; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
import com.stumeet.server.activity.application.port.in.ActivityUpdateUseCase; | ||
import com.stumeet.server.activity.application.port.in.command.ActivityUpdateCommand; | ||
import com.stumeet.server.common.annotation.WebAdapter; | ||
import com.stumeet.server.common.auth.model.LoginMember; | ||
import com.stumeet.server.common.model.ApiResponse; | ||
import com.stumeet.server.common.response.SuccessCode; | ||
|
||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@WebAdapter | ||
@RequestMapping("/api/v1") | ||
@RequiredArgsConstructor | ||
public class ActivityUpdateApi { | ||
|
||
private final ActivityUpdateUseCase activityUpdateUseCase; | ||
|
||
@PatchMapping("/studies/{studyId}/activities/{activityId}") | ||
public ResponseEntity<ApiResponse<Void>> update( | ||
@AuthenticationPrincipal LoginMember loginMember, | ||
@PathVariable Long studyId, | ||
@PathVariable Long activityId, | ||
@RequestBody @Valid ActivityUpdateCommand command | ||
) { | ||
activityUpdateUseCase.update(loginMember.getId(), studyId, activityId, command); | ||
|
||
return ResponseEntity.status(HttpStatus.OK) | ||
.body(ApiResponse.success(SuccessCode.UPDATE_SUCCESS)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/com/stumeet/server/activity/application/port/in/ActivityUpdateUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.stumeet.server.activity.application.port.in; | ||
|
||
import com.stumeet.server.activity.application.port.in.command.ActivityUpdateCommand; | ||
|
||
public interface ActivityUpdateUseCase { | ||
|
||
void update(Long memberId, Long studyId, Long activityId, ActivityUpdateCommand command); | ||
} |
52 changes: 52 additions & 0 deletions
52
...n/java/com/stumeet/server/activity/application/port/in/command/ActivityUpdateCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.stumeet.server.activity.application.port.in.command; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
import org.springframework.format.annotation.DateTimeFormat; | ||
|
||
import com.stumeet.server.common.annotation.validator.NullOrNotBlank; | ||
|
||
import jakarta.annotation.Nullable; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record ActivityUpdateCommand( | ||
@NotBlank(message = "활동 카테고리를 입력해주세요") | ||
String category, | ||
|
||
@NotBlank(message = "활동 제목을 입력해주세요") | ||
@Size(max = 100, message = "활동 제목은 100자 이하여야 합니다") | ||
String title, | ||
|
||
@NotBlank(message = "활동 내용을 입력해주세요") | ||
@Size(max = 500, message = "활동 내용은 500자 이하여야 합니다") | ||
String content, | ||
|
||
@NotNull(message = "이미지 리스트를 전달해주세요") | ||
@Size(max = 5, message = "이미지는 5개 이하로 등록할 수 있습니다") | ||
List<String> images, | ||
|
||
boolean isNotice, | ||
|
||
@Nullable | ||
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") | ||
LocalDateTime startDate, | ||
|
||
@Nullable | ||
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") | ||
LocalDateTime endDate, | ||
|
||
@NullOrNotBlank | ||
String location, | ||
|
||
@NullOrNotBlank | ||
String link, | ||
|
||
@NotNull(message = "참여 멤버 리스트를 전달해주세요") | ||
List<Long> participants | ||
) { | ||
} |
Oops, something went wrong.