Skip to content
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

ADD :: 사람 추가 api (#63) #73

Merged
merged 34 commits into from
Apr 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
cd064b3
ADD :: 유저 검색 API (#64)
gimhanul Mar 24, 2023
20fd81c
FIX :: null 저장
gimhanul Mar 24, 2023
17b5565
REFACTOR :: 결과 조회 응답 형식 변경
gimhanul Mar 25, 2023
ff23bb6
REFACTOR :: query reply null 처리
gimhanul Mar 25, 2023
31d92cf
HOTFIX :: 설명 에러처리
gimhanul Mar 26, 2023
8fae26f
Merge pull request #67 from soolung/hotfix/descritpion
gimhanul Mar 27, 2023
1d3d759
Merge pull request #68 from soolung/main
gimhanul Mar 28, 2023
bc785db
ADD :: 사람 입력 추가 (#64)
gimhanul Mar 28, 2023
c746557
ADD :: 검색 결과에 학번 추가 (#64)
gimhanul Mar 28, 2023
7fffd3e
DELETE :: search teacher
gimhanul Mar 28, 2023
f03e5ec
SET :: codeowner
gimhanul Mar 28, 2023
5407a99
CHORE :: id desc 안 먹음
gimhanul Mar 28, 2023
e58c3c6
REFACTOR :: student number n+1
gimhanul Mar 30, 2023
d218b32
Merge pull request #69 from soolung/feat/user-input
gimhanul Mar 30, 2023
e804dc4
HOTFIX :: 메인 쿼리 최신순
gimhanul Mar 30, 2023
fc0fa98
HOTFIX :: 난 바보야...
gimhanul Mar 30, 2023
631082b
FIX :: 기한이 종료된 배너를 삭제할 수 없는 문제
gimhanul Mar 30, 2023
6790351
Merge pull request #72 from soolung/fix/delete-banner
gimhanul Mar 30, 2023
1762339
HOTFIX :: user not found error
gimhanul Mar 30, 2023
20873b2
ADD :: 사람 추가 api (#63)
Yunyeong-Ko Mar 30, 2023
81fb8cd
HOTFIX :: user not found role id null
gimhanul Mar 30, 2023
4e6690e
ADD :: 리뷰 반영 (#63)
Yunyeong-Ko Mar 30, 2023
7e55eb1
ADD :: 리뷰 반영 (#63)
Yunyeong-Ko Mar 30, 2023
e862376
Merge branch 'feat/group' into feat/#63-add
Yunyeong-Ko Mar 31, 2023
68e8404
ADD :: redis 비밀번호 설정 (#75)
gimhanul Mar 31, 2023
6bcc5dc
CHORE :: host server authrotiy 분기
gimhanul Mar 31, 2023
43c8e78
CHORE :: redis 경량 이미지 사용
gimhanul Mar 31, 2023
002f65b
Merge pull request #76 from soolung/hotfix/refresh-token
gimhanul Mar 31, 2023
b99fb67
Merge branch 'develop' into main
gimhanul Mar 31, 2023
e8c7d57
Merge pull request #77 from soolung/main
gimhanul Mar 31, 2023
e16bbe4
FIX :: redis port
gimhanul Mar 31, 2023
ac2437f
Merge pull request #78 from soolung/main
gimhanul Mar 31, 2023
a092e59
FIX :: role이 없을 때 userNotFoundExcepion
gimhanul Mar 31, 2023
796ac54
ADD :: 리뷰 반영 (#63)
Yunyeong-Ko Apr 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ GOOGLE_BASE_URL=string
GOOGLE_CLIENT=string
GOOGLE_REDIRECT=string
GOOGLE_SECRET=string

JWT_SECRET=string

DB_PORT=number
DB_NAME=string
DB_USERNAME=string
DB_PASSWORD=string
DB_ROOT_PASSWORD=string
DB_HOST=string

REDIS_HOST=string
REDIS_PORT=number
REDIS_PASSWORD=string

BUCKET_NAME=string
S3_REGION=string
S3_ACCESS_KEY=string
S3_SECRET_KEY=string
S3_SECRET_KEY=string
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.* @soolung/backend
8 changes: 8 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ jobs:
echo DB_USERNAME=${{ secrets.DB_USERNAME }} >> .env
echo DB_PASSWORD=${{ secrets.DB_PASSWORD }} >> .env
echo DB_ROOT_PASSWORD=${{ secrets.DB_ROOT_PASSWORD }} >> .env
echo DB_HOST=${{ secrets.DB_HOST }} >> .env

echo JWT_SECRET=${{ secrets.JWT_SECRET }} >> .env

echo DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} >> .env
echo DOCKER_REPO=${{ secrets.DOCKER_REPO }} >> .env

echo GOOGLE_BASE_URL=${{ secrets.GOOGLE_BASE_URL }} >> .env
echo GOOGLE_CLIENT=${{ secrets.GOOGLE_CLIENT }} >> .env
echo GOOGLE_REDIRECT=${{ secrets.GOOGLE_REDIRECT }} >> .env
Expand All @@ -77,6 +81,10 @@ jobs:
echo S3_ACCESS_KEY=${{ secrets.S3_ACCESS_KEY }} >> .env
echo S3_SECRET_KEY=${{ secrets.S3_SECRET_KEY }} >> .env

echo REDIS_HOST=${{ secrets.REDIS_HOST }} >> .env
echo REDIS_PORT=${{ secrets.REDIS_PORT }} >> .env
echo REDIS_PASSWORD=${{ secrets.REDIS_PASSWORD }} >> .env

docker-compose up -d
docker image prune -f

Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/dev.cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ jobs:
echo DB_USERNAME=${{ secrets.DB_USERNAME }} >> .env
echo DB_PASSWORD=${{ secrets.DB_PASSWORD }} >> .env
echo DB_ROOT_PASSWORD=${{ secrets.DB_ROOT_PASSWORD }} >> .env
echo DB_HOST=${{ secrets.DEV_DB_HOST }} >> .env

echo JWT_SECRET=${{ secrets.JWT_SECRET }} >> .env

echo DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} >> .env
echo DOCKER_REPO=${{ secrets.DEV_DOCKER_REPO }} >> .env

echo GOOGLE_BASE_URL=${{ secrets.GOOGLE_BASE_URL }} >> .env
echo GOOGLE_CLIENT=${{ secrets.GOOGLE_CLIENT }} >> .env
echo GOOGLE_REDIRECT=${{ secrets.GOOGLE_REDIRECT_DEV }} >> .env
Expand All @@ -77,6 +81,10 @@ jobs:
echo S3_ACCESS_KEY=${{ secrets.S3_ACCESS_KEY }} >> .env
echo S3_SECRET_KEY=${{ secrets.S3_SECRET_KEY }} >> .env

echo REDIS_HOST=${{ secrets.DEV_REDIS_HOST }} >> .env
echo REDIS_PORT=${{ secrets.REDIS_PORT }} >> .env
echo REDIS_PASSWORD=${{ secrets.REDIS_PASSWORD }} >> .env

docker-compose -f docker-compose.dev.yml up -d
docker image prune -f

Expand Down
8 changes: 5 additions & 3 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ services:
- "--collation-server=utf8mb4_unicode_ci"

redis:
image: redis:latest
image: redis:7.0-alpine
container_name: soolung_simblue_redis
hostname: soolung
command: redis-server --port 6379
command: /bin/sh -c "redis-server --requirepass $$REDIS_PASSWORD"
env_file:
- .env
ports:
- "6379:6379"
- ${REDIS_PORT}:6379

application:
image: ${DOCKER_USERNAME}/${DOCKER_REPO}
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ services:
image: redis:latest
container_name: soolung_simblue_redis
hostname: soolung
command: redis-server --port 6379
command: /bin/sh -c "redis-server --requirepass soolung"
env_file:
- .env
ports:
- "6379:6379"
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ services:
- "--collation-server=utf8mb4_unicode_ci"

simblue-redis:
image: redis:latest
image: redis:7.0-alpine
container_name: soolung_simblue_redis
hostname: soolung
command: redis-server --port 6379
command: /bin/sh -c "redis-server --requirepass $$REDIS_PASSWORD"
env_file:
- .env
ports:
- "6379:6379"
- ${REDIS_PORT}:6379

simblue-application:
image: ${DOCKER_USERNAME}/${DOCKER_REPO}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Application extends BaseTimeEntity {
@Column(nullable = false, length = 20)
private String title;

@Column(nullable = true, length = 200)
@Column(nullable = true, length = 500)
private String description;

@Column(nullable = true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.soogung.simblue.domain.application.domain;

import com.soogung.simblue.domain.application.domain.type.QuestionType;
import com.soogung.simblue.domain.user.facade.UserFacade;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
Expand Down Expand Up @@ -39,4 +41,12 @@ public void putReplyBlock(ReplyBlock replyBlock) {
this.replyBlock = replyBlock;
replyBlock.getReplies().add(this);
}

public String getAnswer(UserFacade userFacade) {
if (question.getType() == QuestionType.PEOPLE) {
return userFacade.getName(Long.valueOf(answer));
}

return answer;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

public interface ApplicationRepository extends JpaRepository<Application, Long>, ApplicationRepositoryCustom {

@Query("SELECT a FROM Application a WHERE a.state = 'ALWAYS' OR a.state = 'OPENED'")
@Query("SELECT a FROM Application a WHERE a.state = 'ALWAYS' OR a.state = 'OPENED' ORDER BY a.id DESC")
List<Application> findAllByOrderByIdDesc(Pageable pageable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public enum QuestionType {
LINK(false),
RADIO(true),
CHECKBOX(true),
PEOPLE(false),
;

private final boolean hasAnswer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public ApplicationStatusResponse getMyApplication() {
}

@GetMapping("/{id}/result")
public ResultBlockResponse getApplicationResult(@PathVariable Long id) {
public ApplicationResultResponse getApplicationResult(@PathVariable Long id) {
return queryApplicationResultService.execute(id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class ApplicationRequest {
private String title;

@Nullable
@Size(max = 500)
private String description;

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import java.time.LocalDate;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.Objects;
import java.util.stream.Collectors;

@Getter
Expand Down Expand Up @@ -44,9 +44,7 @@ public static ApplicationDetailResponse of(Application application, List<NoticeR
.build();
}

public static ApplicationDetailResponse of(Application application, List<NoticeResponse> noticeList, List<ReplyDetailResponse> replyDetailList) {
AtomicInteger index = new AtomicInteger();

public static ApplicationDetailResponse of(Application application, List<NoticeResponse> noticeList, List<ReplyListResponse> replyList) {
return ApplicationDetailResponse.builder()
.id(application.getId())
.title(application.getTitle())
Expand All @@ -58,7 +56,11 @@ public static ApplicationDetailResponse of(Application application, List<NoticeR
.state(application.getState())
.questionList(
application.getQuestionList().stream()
.map((q) -> QuestionResponse.of(q, replyDetailList.get(index.getAndIncrement())))
.map((q) -> QuestionResponse.of(q,
replyList.stream().filter(r -> r.getQuestionId() == q.getId())
.findFirst()
.orElse(null)
))
.collect(Collectors.toList()))
.noticeList(noticeList)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

@Getter
@AllArgsConstructor
public class ResultBlockResponse {
public class ApplicationResultResponse {
private ApplicationResponse application;
private List<NoticeResponse> noticeList;
private List<String> questionList;
private List<ResultResponse> resultList;
private List<SimpleQuestionResponse> questionList;
private List<ReplyBlockResponse> resultList;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.soogung.simblue.domain.application.presentation.dto.response;

import com.soogung.simblue.domain.application.domain.Question;
import com.soogung.simblue.domain.application.domain.Reply;
import com.soogung.simblue.domain.application.domain.type.QuestionType;
import lombok.Builder;
import lombok.Getter;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

@Getter
Expand All @@ -19,7 +19,7 @@ public class QuestionResponse {
private Boolean isRequired;
private QuestionType type;
private List<AnswerResponse> answerList;
private List<String> replyDetailList;
private List<String> replyList;

public static QuestionResponse of(Question question) {
return QuestionResponse.builder()
Expand All @@ -36,7 +36,7 @@ public static QuestionResponse of(Question question) {
.build();
}

public static QuestionResponse of(Question question, ReplyDetailResponse replyDetail) {
public static QuestionResponse of(Question question, ReplyListResponse replyList) {
return QuestionResponse.builder()
.id(question.getId())
.question(question.getQuestion())
Expand All @@ -48,7 +48,7 @@ public static QuestionResponse of(Question question, ReplyDetailResponse replyDe
question.getAnswerList().stream()
.map(AnswerResponse::of)
.collect(Collectors.toList()) : null)
.replyDetailList(replyDetail.getReplyDetailList())
.replyList(Objects.nonNull(replyList) ? replyList.getReplyList() : null)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

@Getter
@AllArgsConstructor
public class ResultResponse {
public class ReplyBlockResponse {
private String name;
private String studentNumber;
private List<String> replyList;
private List<ReplyResponse> replyList;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

@Getter
@AllArgsConstructor
public class ReplyDetailResponse {
private List<String> replyDetailList;
public class ReplyListResponse {

private Long questionId;
private List<String> replyList;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.soogung.simblue.domain.application.presentation.dto.response;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public class ReplyResponse {

private Long questionId;
private String reply;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.soogung.simblue.domain.application.presentation.dto.response;

import com.soogung.simblue.domain.application.domain.Question;
import com.soogung.simblue.domain.application.domain.type.QuestionType;
import lombok.Builder;
import lombok.Getter;

@Getter
@Builder
public class SimpleQuestionResponse {

private Long id;
private String question;
private QuestionType type;

public static SimpleQuestionResponse of(Question question) {
return SimpleQuestionResponse.builder()
.id(question.getId())
.question(question.getQuestion())
.type(question.getType())
.build();
}
}
Loading