-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/109-mission-record-image-upload-e…
…xception-case
- Loading branch information
Showing
16 changed files
with
404 additions
and
22 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
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
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
10 changes: 10 additions & 0 deletions
10
src/main/java/com/depromeet/domain/missionRecord/dao/MissionRecordRepositoryCustom.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,10 @@ | ||
package com.depromeet.domain.missionRecord.dao; | ||
|
||
import com.depromeet.domain.missionRecord.domain.MissionRecord; | ||
import java.time.YearMonth; | ||
import java.util.List; | ||
|
||
public interface MissionRecordRepositoryCustom { | ||
|
||
List<MissionRecord> findAllByMissionIdAndYearMonth(Long missionId, YearMonth yearMonth); | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/com/depromeet/domain/missionRecord/dao/MissionRecordRepositoryImpl.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,42 @@ | ||
package com.depromeet.domain.missionRecord.dao; | ||
|
||
import static com.depromeet.domain.missionRecord.domain.QMissionRecord.*; | ||
|
||
import com.depromeet.domain.missionRecord.domain.MissionRecord; | ||
import com.querydsl.core.types.dsl.BooleanExpression; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import java.time.YearMonth; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class MissionRecordRepositoryImpl implements MissionRecordRepositoryCustom { | ||
|
||
private final JPAQueryFactory jpaQueryFactory; | ||
|
||
@Override | ||
public List<MissionRecord> findAllByMissionIdAndYearMonth(Long missionId, YearMonth yearMonth) { | ||
return jpaQueryFactory | ||
.selectFrom(missionRecord) | ||
.where( | ||
missionIdEq(missionId), | ||
yearEq(yearMonth.getYear()), | ||
monthEq(yearMonth.getMonthValue())) | ||
.orderBy(missionRecord.startedAt.asc()) | ||
.fetch(); | ||
} | ||
|
||
private BooleanExpression missionIdEq(Long missionId) { | ||
return missionRecord.mission.id.eq(missionId); | ||
} | ||
|
||
private BooleanExpression yearEq(int year) { | ||
return missionRecord.startedAt.year().eq(year); | ||
} | ||
|
||
private BooleanExpression monthEq(int month) { | ||
return missionRecord.startedAt.month().eq(month); | ||
} | ||
} |
Empty file.
22 changes: 22 additions & 0 deletions
22
src/main/java/com/depromeet/domain/missionRecord/dto/response/MissionRecordFindResponse.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,22 @@ | ||
package com.depromeet.domain.missionRecord.dto.response; | ||
|
||
import com.depromeet.domain.missionRecord.domain.MissionRecord; | ||
import java.time.LocalDateTime; | ||
|
||
public record MissionRecordFindResponse( | ||
Long recordId, | ||
String remark, | ||
String imageUrl, | ||
int missionDay, | ||
LocalDateTime startedAt, | ||
LocalDateTime finishedAt) { | ||
public static MissionRecordFindResponse from(MissionRecord missionRecord) { | ||
return new MissionRecordFindResponse( | ||
missionRecord.getId(), | ||
missionRecord.getRemark(), | ||
missionRecord.getImageUrl(), | ||
missionRecord.getStartedAt().getDayOfMonth(), | ||
missionRecord.getStartedAt(), | ||
missionRecord.getFinishedAt()); | ||
} | ||
} |
Empty file.
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
Empty file.
Oops, something went wrong.