Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.example.solidconnection.application.controller;

import com.example.solidconnection.application.dto.*;
import com.example.solidconnection.application.dto.ApplicationSubmissionResponse;
import com.example.solidconnection.application.dto.ApplicationsResponse;
import com.example.solidconnection.application.dto.ApplyRequest;
import com.example.solidconnection.application.service.ApplicationQueryService;
import com.example.solidconnection.application.service.ApplicationSubmissionService;
import jakarta.validation.Valid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.type.VerifyStatus;
import com.example.solidconnection.university.domain.UniversityInfoForApply;
import jakarta.persistence.*;
import jakarta.persistence.Column;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import com.example.solidconnection.application.domain.Application;
import com.example.solidconnection.type.LanguageTestType;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "지원자")
public record ApplicantResponse(

@Schema(description = "닉네임", example = "행복한 개발자")
String nicknameForApply,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

@Schema(description = "지원 정보 제출 성공 여부")
public record ApplicationSubmissionResponse(

@Schema(description = "제출 성공 여부", example = "true")
boolean isSuccess) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

import java.util.List;

@Schema(description = "1지망과 2지망 대학과 그 대학에 지원한 지원자 정보")
@Schema(description = "지망별 지원자 목록")
public record ApplicationsResponse(

@ArraySchema(arraySchema = @Schema(description = "1지망 대학에 지원한 지원자 목록"))
List<UniversityApplicantsResponse> firstChoice,

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

@Schema(description = "지망 대학")
public record UniversityChoiceRequest(

@NotNull(message = "1지망 대학교를 입력해주세요.")
@Schema(description = "1지망 대학교의 지원 정보 ID", example = "1")
Long firstChoiceUniversityId,
Expand All @@ -14,4 +13,5 @@ public record UniversityChoiceRequest(
Long secondChoiceUniversityId,

@Schema(description = "3지망 대학교의 지원 정보 ID (선택사항)", example = "3", nullable = true)
Long thirdChoiceUniversityId) {}
Long thirdChoiceUniversityId) {
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@ public interface ApplicationRepository extends JpaRepository<Application, Long>

boolean existsByNicknameForApply(String nicknameForApply);

@Query("SELECT a FROM Application a WHERE a.siteUser = :siteUser AND a.term = :term AND a.isDelete = false")
Optional<Application> findBySiteUserAndTerm(@Param("siteUser") SiteUser siteUser, @Param("term") String term);
List<Application> findAllByFirstChoiceUniversityAndVerifyStatusAndTerm(
UniversityInfoForApply firstChoiceUniversity, VerifyStatus verifyStatus, String term);

List<Application> findAllByFirstChoiceUniversityAndVerifyStatusAndTerm(UniversityInfoForApply firstChoiceUniversity, VerifyStatus verifyStatus, String term);
List<Application> findAllBySecondChoiceUniversityAndVerifyStatusAndTerm(
UniversityInfoForApply secondChoiceUniversity, VerifyStatus verifyStatus, String term);

List<Application> findAllBySecondChoiceUniversityAndVerifyStatusAndTerm(UniversityInfoForApply secondChoiceUniversity, VerifyStatus verifyStatus, String term);
List<Application> findAllByThirdChoiceUniversityAndVerifyStatusAndTerm(
UniversityInfoForApply thirdChoiceUniversity, VerifyStatus verifyStatus, String term);

List<Application> findAllByThirdChoiceUniversityAndVerifyStatusAndTerm(UniversityInfoForApply thirdChoiceUniversity, VerifyStatus verifyStatus, String term);
@Query("""
SELECT a FROM Application a
WHERE a.siteUser = :siteUser
AND a.term = :term
AND a.isDelete = false
""")
Optional<Application> findBySiteUserAndTerm(@Param("siteUser") SiteUser siteUser, @Param("term") String term);

default Application getApplicationBySiteUserAndTerm(SiteUser siteUser, String term) {
return findBySiteUserAndTerm(siteUser, term)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class ApplicationQueryService {
private final UniversityInfoForApplyRepository universityInfoForApplyRepository;
private final SiteUserRepository siteUserRepository;
private final UniversityFilterRepositoryImpl universityFilterRepository;

@Value("${university.term}")
public String term;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.example.solidconnection.application.service;

import com.example.solidconnection.application.domain.*;
import com.example.solidconnection.application.domain.Application;
import com.example.solidconnection.application.dto.ApplyRequest;
import com.example.solidconnection.application.dto.UniversityChoiceRequest;
import com.example.solidconnection.application.repository.ApplicationRepository;
import com.example.solidconnection.score.repository.GpaScoreRepository;
import com.example.solidconnection.score.repository.LanguageTestScoreRepository;
import com.example.solidconnection.custom.exception.CustomException;
import com.example.solidconnection.score.domain.GpaScore;
import com.example.solidconnection.score.domain.LanguageTestScore;
import com.example.solidconnection.score.repository.GpaScoreRepository;
import com.example.solidconnection.score.repository.LanguageTestScoreRepository;
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.siteuser.repository.SiteUserRepository;
import com.example.solidconnection.type.VerifyStatus;
Expand All @@ -19,9 +19,16 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;

import static com.example.solidconnection.custom.exception.ErrorCode.*;
import static com.example.solidconnection.custom.exception.ErrorCode.APPLY_UPDATE_LIMIT_EXCEED;
import static com.example.solidconnection.custom.exception.ErrorCode.CANT_APPLY_FOR_SAME_UNIVERSITY;
import static com.example.solidconnection.custom.exception.ErrorCode.INVALID_GPA_SCORE;
import static com.example.solidconnection.custom.exception.ErrorCode.INVALID_GPA_SCORE_STATUS;
import static com.example.solidconnection.custom.exception.ErrorCode.INVALID_LANGUAGE_TEST_SCORE;
import static com.example.solidconnection.custom.exception.ErrorCode.INVALID_LANGUAGE_TEST_SCORE_STATUS;

@RequiredArgsConstructor
@Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@
@NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
class NicknameCreator {

public static final List<String> ADJECTIVES = List.copyOf(
Set.of("기쁜", "행복한", "즐거운", "밝은", "따뜻한", "시원한", "고고한", "예쁜", "신선한", "풍부한", "깨끗한",
"귀한", "눈부신", "멋진", "고귀한", "화려한", "상큼한", "활기찬", "유쾌한", "똘똘한", "친절한", "좋은",
"영리한", "용감한", "정직한", "성실한", "강인한", "귀여운", "순수한", "희망찬", "발랄한", "나른한", "후한", "빛나는",
"따스한", "안락한", "편안한", "성공한", "재미난", "청량한", "찬란한", "소중한", "특별한", "단순한", "반가운", "그리운")
public static final List<String> ADJECTIVES = List.copyOf(Set.of(
"기쁜", "행복한", "즐거운", "밝은", "따뜻한", "시원한", "고고한", "예쁜", "신선한", "풍부한", "깨끗한",
"귀한", "눈부신", "멋진", "고귀한", "화려한", "상큼한", "활기찬", "유쾌한", "똘똘한", "친절한", "좋은",
"영리한", "용감한", "정직한", "성실한", "강인한", "귀여운", "순수한", "희망찬", "발랄한", "나른한", "후한", "빛나는",
"따스한", "안락한", "편안한", "성공한", "재미난", "청량한", "찬란한", "소중한", "특별한", "단순한", "반가운", "그리운")
);
public static final List<String> NOUNS = List.copyOf(
Set.of("청춘", "토끼", "기사", "곰", "사슴", "여우", "팬더", "이슬", "새싹", "햇빛", "나비", "별", "달", "구름",
"사탕", "젤리", "마법", "풍선", "캔디", "초코", "인형", "쿠키", "요정", "장미", "마녀", "보물", "꽃", "보석",
"달빛", "오리", "날개", "여행", "편지", "불꽃", "파도", "별빛", "구슬", "노래", "음표", "선율", "미소", "가방", "거울",
"씨앗", "열매", "바다", "약속", "구두", "공기", "등불", "촛불", "진주", "꿀벌", "예감", "바람", "오전", "오후", "아침", "점심", "저녁")
public static final List<String> NOUNS = List.copyOf(Set.of(
"청춘", "토끼", "기사", "곰", "사슴", "여우", "팬더", "이슬", "새싹", "햇빛", "나비", "별", "달", "구름",
"사탕", "젤리", "마법", "풍선", "캔디", "초코", "인형", "쿠키", "요정", "장미", "마녀", "보물", "꽃", "보석",
"달빛", "오리", "날개", "여행", "편지", "불꽃", "파도", "별빛", "구슬", "노래", "음표", "선율", "미소", "가방",
"거울", "씨앗", "열매", "바다", "약속", "구두", "공기", "등불", "촛불", "진주", "꿀벌", "예감", "바람",
"오전", "오후", "아침", "점심", "저녁")
);

private static final Random RANDOM = new Random();

public static String createRandomNickname() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@
public class KakaoOAuthClient {

private final RestTemplate restTemplate;

@Value("${kakao.redirect_uri}")
public String redirectUri;

@Value("${kakao.client_id}")
private String clientId;

@Value("${kakao.token_url}")
private String tokenUrl;

@Value("${kakao.user_info_url}")
private String userInfoUrl;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.example.solidconnection.auth.dto;

import com.example.solidconnection.auth.dto.kakao.KakaoOauthResponse;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "로그인 응답 데이터")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

@Schema(description = "등록되지 않은 사용자의 최초 접속 시 응답 데이터")
public record FirstAccessResponse(

@Schema(description = "사용자 등록 여부", example = "false")
boolean isRegistered,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
import io.swagger.v3.oas.annotations.security.SecurityRequirements;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package com.example.solidconnection.board.domain;

import com.example.solidconnection.post.domain.Post;
import jakarta.persistence.*;
import lombok.*;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
public class BoardService {
private final BoardRepository boardRepository;

@Transactional(readOnly = true)
public List<BoardFindPostResponse> findPostsByCodeAndPostCategory(String code, String category) {

String boardCode = validateCode(code);
PostCategory postCategory = validatePostCategory(category);

Board board = boardRepository.getByCodeUsingEntityGraph(boardCode);
List<Post> postList = getPostListByPostCategory(board.getPostList(), postCategory);

return BoardFindPostResponse.from(postList);
}

private String validateCode(String code) {
try {
return String.valueOf(BoardCode.valueOf(code));
Expand All @@ -31,25 +43,13 @@ private String validateCode(String code) {
}
}

private PostCategory validatePostCategory(String category){
if(!EnumUtils.isValidEnum(PostCategory.class, category)){
private PostCategory validatePostCategory(String category) {
if (!EnumUtils.isValidEnum(PostCategory.class, category)) {
throw new CustomException(INVALID_POST_CATEGORY);
}
return PostCategory.valueOf(category);
}

@Transactional(readOnly = true)
public List<BoardFindPostResponse> findPostsByCodeAndPostCategory(String code, String category) {

String boardCode = validateCode(code);
PostCategory postCategory = validatePostCategory(category);

Board board = boardRepository.getByCodeUsingEntityGraph(boardCode);
List<Post> postList = getPostListByPostCategory(board.getPostList(), postCategory);

return BoardFindPostResponse.from(postList);
}

private List<Post> getPostListByPostCategory(List<Post> postList, PostCategory postCategory) {
if (postCategory.equals(PostCategory.전체)) {
return postList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
public class CacheUpdateListener implements MessageListener {

private final CompletableFutureManager futureManager;

@Override
public void onMessage(Message message, byte[] pattern) {
String messageBody = new String(message.getBody(), StandardCharsets.UTF_8).replaceAll("^\"|\"$", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@Component
@RequiredArgsConstructor
public class CachingAspect {

private final ApplicationContext applicationContext;
private final RedisUtils redisUtils;

Expand Down Expand Up @@ -47,7 +48,7 @@ public Object cacheEvict(ProceedingJoinPoint joinPoint, DefaultCacheOut defaultC

if (usingPrefix) {
cacheManager.evictUsingPrefix(cacheKey);
}else{
} else {
cacheManager.evict(cacheKey);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.Map;

@Component
public class CompletableFutureManager {

private final Map<String, CompletableFuture<Void>> waitingRequests = new ConcurrentHashMap<>();

public CompletableFuture<Void> getOrCreateFuture(String key) {
Expand Down
Loading