-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] 홈 화면 관련 API #24
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a562b20
[FEAT] QnADao를 이용한 QnA 리스트 조회 #18
jun02160 336b517
[FEAT] 메인페이지 API #18
jun02160 83aacb1
[FEAT] 초대코드 조회 API #18
jun02160 9895404
[FIX] DAO jpql 쿼리 수정 #18
jun02160 af586fb
[MERGE] 충돌 오류 해결
jun02160 94452f5
[FIX] DB 변경사항에 따른 DTO 값 수정 #18
jun02160 8041bf5
[CHORE] 서버 포트 제거
jun02160 35f82f5
[FIX] 리뷰 사항 반영 #18
jun02160 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 8 additions & 0 deletions
8
.../org/umbbaServer/domain/parentchild/controller/dto/response/GetInviteCodeResponseDto.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,10 +1,18 @@ | ||
package sopt.org.umbbaServer.domain.parentchild.controller.dto.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import sopt.org.umbbaServer.domain.parentchild.model.Parentchild; | ||
|
||
@Getter | ||
@Builder | ||
public class GetInviteCodeResponseDto { | ||
|
||
private String inviteCode; | ||
|
||
public static GetInviteCodeResponseDto of(Parentchild parentchild) { | ||
return GetInviteCodeResponseDto.builder() | ||
.inviteCode(parentchild.getInviteCode()) | ||
.build(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/sopt/org/umbbaServer/domain/parentchild/dao/ParentchildDao.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,27 @@ | ||
package sopt.org.umbbaServer.domain.parentchild.dao; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Repository; | ||
import sopt.org.umbbaServer.domain.parentchild.model.Parentchild; | ||
|
||
import javax.persistence.EntityManager; | ||
import javax.persistence.PersistenceContext; | ||
|
||
@Slf4j | ||
@Repository | ||
public class ParentchildDao { | ||
|
||
@PersistenceContext | ||
private EntityManager em; | ||
|
||
public Parentchild findByUserId(Long userId) { | ||
|
||
String jpql = "SELECT pc FROM Parentchild pc " + | ||
"JOIN User u ON u.parentChild = pc " + | ||
"WHERE u.id = :id"; | ||
|
||
return em.createQuery(jpql, Parentchild.class) | ||
.setParameter("id", userId) | ||
.getSingleResult(); | ||
} | ||
} |
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
20 changes: 20 additions & 0 deletions
20
.../java/sopt/org/umbbaServer/domain/qna/controller/dto/response/GetMainViewResponseDto.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,20 @@ | ||
package sopt.org.umbbaServer.domain.qna.controller.dto.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import sopt.org.umbbaServer.domain.qna.model.QnA; | ||
|
||
@Getter | ||
@Builder | ||
public class GetMainViewResponseDto { | ||
|
||
private String section; | ||
private String topic; | ||
|
||
public static GetMainViewResponseDto of (QnA qnA) { | ||
return GetMainViewResponseDto.builder() | ||
.section(qnA.getQuestion().getSection().getValue()) | ||
.topic(qnA.getQuestion().getTopic()) | ||
.build(); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/sopt/org/umbbaServer/domain/qna/dao/QnADao.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,47 @@ | ||
package sopt.org.umbbaServer.domain.qna.dao; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
import org.springframework.stereotype.Repository; | ||
import sopt.org.umbbaServer.domain.qna.model.QnA; | ||
|
||
import javax.persistence.EntityManager; | ||
import javax.persistence.PersistenceContext; | ||
import javax.persistence.TypedQuery; | ||
import javax.sql.DataSource; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Slf4j | ||
@Repository | ||
public class QnADao { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 기존에 있던 것도 이런식으로 참고해서 리팩토링 진행할게! |
||
|
||
@PersistenceContext | ||
private EntityManager em; | ||
|
||
|
||
// READ | ||
|
||
// 유저 아이디로 QnA 리스트 조회하기 | ||
public List<QnA> findQnASByUserId(Long userId) { | ||
log.info("jpql 실행 전"); | ||
String jpql = "SELECT q FROM Parentchild pc " + | ||
"JOIN pc.qnaList q " + | ||
"LEFT JOIN User u ON u.parentChild.id = pc.id " + | ||
"WHERE u.id = :id"; | ||
|
||
TypedQuery<QnA> query = em.createQuery(jpql, QnA.class); | ||
|
||
log.info("query 실행 성공: {}", query); | ||
List<QnA> qnAList = query | ||
.setParameter("id", userId) | ||
.getResultList(); | ||
log.info("query 실행 결과: {}", qnAList.toString()); | ||
|
||
return qnAList; | ||
} | ||
|
||
// 유저 아이디로 최근 QnA 조회하기 | ||
} |
1 change: 1 addition & 0 deletions
1
src/main/java/sopt/org/umbbaServer/domain/qna/repository/QnARepository.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
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 |
---|---|---|
|
@@ -50,3 +50,6 @@ logging: | |
type: | ||
descriptor: | ||
sql: trace | ||
|
||
server: | ||
port: 9091 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지금 두 API가 2개의 Service에 나눠져 있구, 1개의 Controller에서 호출되고 있어가지구!
이거 어떻게 할지 회의좀 해봐야겠다!