-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π :: Api-v0.0.4-1
- Loading branch information
Showing
22 changed files
with
291 additions
and
159 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,6 @@ out/ | |
### VS Code ### | ||
.vscode/ | ||
.env | ||
.env.* | ||
.env.* | ||
|
||
DuDoong-Domain/src/main/generated/**/*.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
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
25 changes: 18 additions & 7 deletions
25
...ain/java/band/gosrock/api/issuedTicket/dto/response/RetrieveIssuedTicketListResponse.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,22 +1,33 @@ | ||
package band.gosrock.api.issuedTicket.dto.response; | ||
|
||
|
||
import band.gosrock.domain.domains.issuedTicket.domain.IssuedTicket; | ||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import org.springframework.data.domain.Page; | ||
|
||
@Getter | ||
@Builder | ||
public class RetrieveIssuedTicketListResponse { | ||
|
||
private final Long page; | ||
private final int page; | ||
|
||
private final Long totalPage; | ||
private final int totalPage; | ||
|
||
private final List<RetrieveIssuedTicketDTO> issuedTickets; | ||
|
||
public RetrieveIssuedTicketListResponse( | ||
Long page, Long totalPage, List<RetrieveIssuedTicketDTO> issuedTickets) { | ||
this.page = page; | ||
this.totalPage = totalPage; | ||
this.issuedTickets = issuedTickets; | ||
public static RetrieveIssuedTicketListResponse of(Page<IssuedTicket> issuedTickets) { | ||
return RetrieveIssuedTicketListResponse.builder() | ||
.page(issuedTickets.getPageable().getPageNumber()) | ||
.totalPage(issuedTickets.getTotalPages()) | ||
.issuedTickets( | ||
issuedTickets.stream() | ||
.map( | ||
issuedTicket -> | ||
RetrieveIssuedTicketDTO.of( | ||
issuedTicket, issuedTicket.getUser())) | ||
.toList()) | ||
.build(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
DuDoong-Api/src/main/java/band/gosrock/api/issuedTicket/mapper/IssuedTicketMapper.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,31 @@ | ||
package band.gosrock.api.issuedTicket.mapper; | ||
|
||
|
||
import band.gosrock.api.issuedTicket.dto.response.RetrieveIssuedTicketDetailResponse; | ||
import band.gosrock.api.issuedTicket.dto.response.RetrieveIssuedTicketListResponse; | ||
import band.gosrock.common.annotation.Mapper; | ||
import band.gosrock.domain.domains.issuedTicket.adaptor.IssuedTicketAdaptor; | ||
import band.gosrock.domain.domains.issuedTicket.dto.condtion.IssuedTicketCondition; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Mapper | ||
@RequiredArgsConstructor | ||
public class IssuedTicketMapper { | ||
|
||
private final IssuedTicketAdaptor issuedTicketAdaptor; | ||
|
||
@Transactional(readOnly = true) | ||
public RetrieveIssuedTicketListResponse toIssuedTicketPageResponse( | ||
Long page, IssuedTicketCondition condition) { | ||
return RetrieveIssuedTicketListResponse.of( | ||
issuedTicketAdaptor.searchIssuedTicket(page, condition)); | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
public RetrieveIssuedTicketDetailResponse toIssuedTicketDetailResponse( | ||
Long currentUserId, Long issuedTicketId) { | ||
return RetrieveIssuedTicketDetailResponse.of( | ||
issuedTicketAdaptor.find(currentUserId, issuedTicketId)); | ||
} | ||
} |
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
19 changes: 19 additions & 0 deletions
19
DuDoong-Domain/src/main/java/band/gosrock/domain/config/QueryDslConfig.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,19 @@ | ||
package band.gosrock.domain.config; | ||
|
||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import javax.persistence.EntityManager; | ||
import javax.persistence.PersistenceContext; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class QueryDslConfig { | ||
|
||
@PersistenceContext private EntityManager entityManager; | ||
|
||
@Bean | ||
public JPAQueryFactory jpaQueryFactory() { | ||
return new JPAQueryFactory(entityManager); | ||
} | ||
} |
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
Oops, something went wrong.