-
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.
* feat : ourShoot 조회 API 구현 * feat : default tab yet으로 지정 * feat : yet, doing, done 상수 처리 * feat : querydsl으로 전환 * feat : querydsl으로 전환 * feat : 에러 수정 * fix : dto of->from으로 수정 * fix : if-else문 object mapping으로 수정
- Loading branch information
Showing
7 changed files
with
126 additions
and
1 deletion.
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
13 changes: 13 additions & 0 deletions
13
src/main/java/gigedi/dev/domain/shoot/dao/ShootRepositoryCustom.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,13 @@ | ||
package gigedi.dev.domain.shoot.dao; | ||
|
||
import java.util.List; | ||
|
||
import gigedi.dev.domain.auth.domain.Figma; | ||
import gigedi.dev.domain.shoot.domain.Shoot; | ||
import gigedi.dev.domain.shoot.domain.Status; | ||
|
||
public interface ShootRepositoryCustom { | ||
List<Shoot> findByFigmaAndStatusAndDeletedAtIsNull(Figma figma, Status status); | ||
|
||
List<Shoot> findMentionedShootsByFigma(Figma figma); | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/gigedi/dev/domain/shoot/dao/ShootRepositoryImpl.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 gigedi.dev.domain.shoot.dao; | ||
|
||
import static gigedi.dev.domain.shoot.domain.QShoot.shoot; | ||
import static gigedi.dev.domain.shoot.domain.QShootStatus.shootStatus; | ||
import static gigedi.dev.domain.shoot.domain.QShootTag.shootTag; | ||
|
||
import java.util.List; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
|
||
import gigedi.dev.domain.auth.domain.Figma; | ||
import gigedi.dev.domain.shoot.domain.Shoot; | ||
import gigedi.dev.domain.shoot.domain.Status; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
public class ShootRepositoryImpl implements ShootRepositoryCustom { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
@Override | ||
public List<Shoot> findByFigmaAndStatusAndDeletedAtIsNull(Figma figma, Status status) { | ||
return queryFactory | ||
.selectFrom(shoot) | ||
.join(shootStatus) | ||
.on(shoot.shootId.eq(shootStatus.shoot.shootId)) | ||
.where( | ||
shoot.figma.eq(figma), | ||
shootStatus.status.eq(status), | ||
shoot.deletedAt.isNull()) | ||
.fetch(); | ||
} | ||
|
||
@Override | ||
public List<Shoot> findMentionedShootsByFigma(Figma figma) { | ||
return queryFactory | ||
.select(shootTag.shoot) | ||
.from(shootTag) | ||
.where(shootTag.figma.eq(figma), shootTag.shoot.deletedAt.isNull()) | ||
.fetch(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/gigedi/dev/domain/shoot/dto/response/GetOurShootResponse.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,16 @@ | ||
package gigedi.dev.domain.shoot.dto.response; | ||
|
||
import gigedi.dev.domain.shoot.domain.Shoot; | ||
import gigedi.dev.global.util.TimeUtil; | ||
|
||
public record GetOurShootResponse( | ||
Long shootId, String BlockTitle, String authorName, String content, String timeAgo) { | ||
public static GetOurShootResponse from(Shoot shoot) { | ||
return new GetOurShootResponse( | ||
shoot.getShootId(), | ||
shoot.getBlock().getTitle(), | ||
shoot.getFigma().getFigmaName(), | ||
shoot.getContent(), | ||
TimeUtil.calculateTimeAgo(shoot.getCreatedAt())); | ||
} | ||
} |
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