-
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.
* fix: 미션 기록 일지 수정 * fix: spotlessApply * feat: 미션 기록 소유권 검증 * fix: 미션, 미션 기록 수정 API return 객체 정적 팩토리 메서드로 변경 * fix: updateMissionRecord 인자 변경 * fix: MissionVisibility 검증 부분 수정 * fix: spotlessApply * fix: spotlessApply * fix: update return 타입 변경 및 변수 할당 * fix: 미션 수정도 동일한 response 형식 * fix: 수정 API 변경으로 인한 테스트 코드 수정 * fix: spotlessApply
- Loading branch information
Showing
11 changed files
with
60 additions
and
77 deletions.
There are no files selected for viewing
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
28 changes: 3 additions & 25 deletions
28
src/main/java/com/depromeet/domain/mission/dto/response/MissionUpdateResponse.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 |
---|---|---|
@@ -1,33 +1,11 @@ | ||
package com.depromeet.domain.mission.dto.response; | ||
|
||
import com.depromeet.domain.mission.domain.Mission; | ||
import com.depromeet.domain.mission.domain.MissionCategory; | ||
import com.depromeet.domain.mission.domain.MissionVisibility; | ||
import com.depromeet.global.error.exception.CustomException; | ||
import com.depromeet.global.error.exception.ErrorCode; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
public record MissionUpdateResponse( | ||
@Schema(description = "미션 ID", defaultValue = "1") Long missionId, | ||
@Schema(description = "미션 이름", defaultValue = "default name") String name, | ||
@Schema(description = "미션 내용", defaultValue = "default content") String content, | ||
@Schema(description = "미션 카테고리", defaultValue = "STUDY") MissionCategory category, | ||
@Schema(description = "미션 공개여부", defaultValue = "ALL") MissionVisibility visibility) { | ||
public MissionUpdateResponse(Mission mission) { | ||
this( | ||
mission.getId(), | ||
mission.getName(), | ||
mission.getContent(), | ||
mission.getCategory(), | ||
mission.getVisibility()); | ||
validateVisibility(); | ||
} | ||
|
||
@NotNull(message = "미션 공개여부는 null이 될 수 없습니다.") | ||
private void validateVisibility() { | ||
if (visibility == null) { | ||
throw new CustomException(ErrorCode.MISSION_VISIBILITY_NULL); | ||
} | ||
@Schema(description = "미션 ID", defaultValue = "1") Long missionId) { | ||
public static MissionUpdateResponse from(Mission mission) { | ||
return new MissionUpdateResponse(mission.getId()); | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
src/main/java/com/depromeet/domain/missionRecord/dto/request/MissionRecordUpdateRequest.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,9 @@ | ||
package com.depromeet.domain.missionRecord.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.Size; | ||
|
||
public record MissionRecordUpdateRequest( | ||
@Size(min = 0, max = 200, message = "미션 기록 일지는 200자까지") | ||
@Schema(description = "미션 기록 일지", defaultValue = "default missionRecord remark") | ||
String remark) {} |
11 changes: 11 additions & 0 deletions
11
...ain/java/com/depromeet/domain/missionRecord/dto/response/MissionRecordUpdateResponse.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,11 @@ | ||
package com.depromeet.domain.missionRecord.dto.response; | ||
|
||
import com.depromeet.domain.missionRecord.domain.MissionRecord; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
public record MissionRecordUpdateResponse( | ||
@Schema(description = "미션 기록 ID", defaultValue = "1") Long recordId) { | ||
public static MissionRecordUpdateResponse from(MissionRecord missionRecord) { | ||
return new MissionRecordUpdateResponse(missionRecord.getId()); | ||
} | ||
} |
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