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

Member 저장 기능 구현 #50

Merged
merged 8 commits into from
Nov 17, 2024
2 changes: 2 additions & 0 deletions application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.springfox:springfox-boot-starter:3.0.0'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'


}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
@SpringBootApplication
@ComponentScan(basePackages = {
"com.comssa.api",
"com.comssa.core"
"com.comssa.core",
"com.comssa.persistence"
})
public class ServerApplication {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.comssa.api.chatbot.controller

import com.comssa.core.chatbot.dto.request.ChatBotRequestDto
import com.comssa.core.chatbot.dto.response.ChatBotResponseDto
import com.comssa.core.chatbot.dto.response.ChatBotResponseDto.Companion.from
import com.comssa.core.chatbot.service.ChatbotService
import io.swagger.annotations.Api
Expand All @@ -22,5 +23,6 @@ class ChatbotController(
fun chat(
@RequestBody chatBotRequestDto: ChatBotRequestDto,
@AuthenticationPrincipal user: OAuth2User?,
) = ResponseEntity.ok(from(chatbotService.talkToAssistant(chatBotRequestDto, user)))
): ResponseEntity<ChatBotResponseDto> =
ResponseEntity.ok(from(chatbotService.talkToAssistant(chatBotRequestDto, user)))
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class LoginAspect {
/**
* 특정 메서드에 @AddLoginStatusAttribute 어노테이션이 있으면
* 메서드 실행 전후에 이 advice가 실행됩니다.
* Model에 login 상태 부여
*/
@Around("@annotation(com.comssa.api.login.aspect.AddLoginStatusAttribute)")
public Object addLoginStatusAttribute(ProceedingJoinPoint joinPoint) throws Throwable {
Expand All @@ -26,8 +27,11 @@ public Object addLoginStatusAttribute(ProceedingJoinPoint joinPoint) throws Thro
if (arg instanceof Model) {
Model model = (Model) arg;
// 인증 상태 확인 및 isLogin 속성 추가

// cognito 요청을 하면 자동으로 저장 됨.
Authentication auth = SecurityContextHolder.getContext().getAuthentication();

// 시큐리티 컨텍스트에 유저 관련 정보가 저장되어있다면
boolean isAuthenticated =
auth != null && auth.isAuthenticated() && !(auth instanceof AnonymousAuthenticationToken);
model.addAttribute("isLogin", isAuthenticated);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
@RequiredArgsConstructor
public class LoginController {

/*
해당 API는 테스트용
실제 로그인 요청은 클라이언트에서 직접 authorization/cognito 요청을 보낸다.
*/
@GetMapping("/cognito")
public ResponseEntity<ResponseAccessTokenDto> getAccessToken(
Authentication authentication, Model model
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.comssa.api.question.common.controller;

import com.api.computerscience.question.license.dto.response.ResponseLicensesDto;
import com.comssa.api.login.aspect.AddLoginStatusAttribute;
import com.comssa.api.question.common.service.QuestionSelectorService;
import com.comssa.persistence.question.license.domain.LicenseCategory;
import com.comssa.persistence.question.license.domain.dto.response.ResponseLicenseSessionDto;
import com.comssa.persistence.question.license.dto.response.ResponseLicenseSessionDto;
import com.comssa.persistence.question.license.dto.response.ResponseLicensesDto;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.comssa.api.question.common.service;

import com.api.computerscience.question.common.dto.request.RequestChangeContentDto;
import com.comssa.persistence.question.common.domain.QuestionChoice;
import com.comssa.persistence.question.common.dto.request.RequestChangeContentDto;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.comssa.api.question.common.service;


import com.api.computerscience.question.common.dto.request.RequestChangeContentDto;
import com.comssa.persistence.question.common.domain.Question;
import com.comssa.persistence.question.common.dto.request.RequestChangeContentDto;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.comssa.persistence.question.license.domain.LicenseMultipleChoiceQuestion;
import com.comssa.persistence.question.license.domain.LicenseQuestionChoice;
import com.comssa.persistence.question.license.repository.LicenseQuestionChoiceRepository;
import com.comssa.persistence.question.major.domain.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.domain.common.MajorMultipleChoiceQuestion;
import com.comssa.persistence.question.major.domain.common.MajorQuestionChoice;
import com.comssa.persistence.question.major.repository.MajorQuestionChoiceRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.comssa.api.question.license.controller;

import com.api.computerscience.question.common.dto.request.RequestChangeContentDto;
import com.comssa.api.question.license.service.AdminLicenseMuiltipleChoiceQuestionUpdateService;
import com.comssa.api.question.license.service.AdminLicenseQuestionChoiceUpdateService;
import com.comssa.api.question.license.service.AdminLicenseQuestionMakeService;
import com.comssa.persistence.question.common.domain.dto.response.ResponseQuestionChoiceDto;
import com.comssa.persistence.question.common.domain.dto.response.ResponseQuestionDto;
import com.comssa.persistence.question.license.domain.dto.request.RequestMakeLicenseMultipleChoiceQuestionDto;
import com.comssa.persistence.question.common.dto.request.RequestChangeContentDto;
import com.comssa.persistence.question.common.dto.response.ResponseQuestionChoiceDto;
import com.comssa.persistence.question.common.dto.response.ResponseQuestionDto;
import com.comssa.persistence.question.license.dto.request.RequestMakeLicenseMultipleChoiceQuestionDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.comssa.api.question.major.admin.service.ExternalQuestionService
import com.comssa.core.chatbot.dto.response.ChatGptBatchResponseDto
import com.comssa.core.chatbot.dto.response.ChatGptFileUploadResponseDto
import com.comssa.core.chatbot.service.implement.ChatGptService
import com.comssa.persistence.question.common.domain.dto.request.RequestQuestionCommandDto
import com.comssa.persistence.question.common.dto.request.RequestQuestionCommandDto
import io.swagger.annotations.Api
import lombok.RequiredArgsConstructor
import org.springframework.http.ResponseEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.comssa.api.question.license.service.AdminLicenseQuestionGetService;
import com.comssa.api.question.license.service.LicenseSessionService;
import com.comssa.api.question.license.service.UserLicenseQuestionGetService;
import com.comssa.persistence.question.common.domain.dto.response.ResponseClassifiedMultipleQuestionDto;
import com.comssa.persistence.question.common.dto.response.ResponseClassifiedMultipleQuestionDto;
import com.comssa.persistence.question.license.domain.LicenseCategory;
import com.comssa.persistence.question.license.domain.LicenseSession;
import io.swagger.annotations.Api;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

import com.comssa.api.question.common.service.FileUploadService;
import com.comssa.api.question.common.service.implement.QuestionChoiceService;
import com.comssa.persistence.question.common.domain.dto.response.ResponseQuestionDto;
import com.comssa.persistence.question.common.dto.response.ResponseQuestionDto;
import com.comssa.persistence.question.license.domain.LicenseCategory;
import com.comssa.persistence.question.license.domain.LicenseMultipleChoiceQuestion;
import com.comssa.persistence.question.license.domain.LicenseSession;
import com.comssa.persistence.question.license.domain.dto.request.RequestMakeLicenseMultipleChoiceQuestionDto;
import com.comssa.persistence.question.license.dto.request.RequestMakeLicenseMultipleChoiceQuestionDto;
import com.comssa.persistence.question.license.repository.LicenseMultipleChoiceQuestionRepository;
import com.comssa.persistence.question.major.domain.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.comssa.api.question.major.admin.controller;

import com.api.computerscience.question.common.dto.request.RequestChangeContentDto;
import com.comssa.api.question.major.admin.service.AdminMajorQuestionClassifiedGetService;
import com.comssa.api.question.major.admin.service.AdminMajorQuestionMakeService;
import com.comssa.api.question.major.admin.service.implement.AdminMajorMultipleChoiceQuestionUpdateService;
import com.comssa.api.question.major.common.exception.DuplicateQuestionException;
import com.comssa.persistence.question.common.domain.dto.response.ResponseClassifiedMultipleQuestionDto;
import com.comssa.persistence.question.common.domain.dto.response.ResponseQuestionDto;
import com.comssa.persistence.question.major.domain.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.domain.admin.dto.ResponseMajorQuestionForAdminDto;
import com.comssa.persistence.question.common.dto.request.RequestChangeContentDto;
import com.comssa.persistence.question.common.dto.response.ResponseClassifiedMultipleQuestionDto;
import com.comssa.persistence.question.common.dto.response.ResponseQuestionDto;
import com.comssa.persistence.question.major.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.admin.dto.ResponseMajorQuestionForAdminDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import com.comssa.api.question.major.admin.service.AdminMajorQuestionClassifiedGetService;
import com.comssa.persistence.question.common.domain.dto.response.ResponseClassifiedMultipleQuestionDto;
import com.comssa.persistence.question.common.dto.response.ResponseClassifiedMultipleQuestionDto;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import com.comssa.api.question.major.common.exception.DuplicateQuestionException;
import com.comssa.persistence.question.major.domain.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.domain.common.MajorMultipleChoiceQuestion;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.comssa.api.question.major.admin.service

import com.comssa.core.chatbot.dto.response.ChatGptFileUploadResponseDto
import com.comssa.persistence.question.common.domain.dto.request.RequestQuestionCommandDto
import com.comssa.persistence.question.common.dto.request.RequestQuestionCommandDto

@org.springframework.stereotype.Service
interface ExternalQuestionService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.comssa.api.question.major.admin.service.AdminMajorQuestionMakeService;
import com.comssa.api.question.major.admin.service.DuplicateQuestionDetector;
import com.comssa.api.question.major.common.exception.DuplicateQuestionException;
import com.comssa.persistence.question.major.domain.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.domain.common.MajorMultipleChoiceQuestion;
import com.comssa.persistence.question.major.repository.MajorMultipleChoiceQuestionRepository;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.comssa.api.question.major.admin.service.ExternalQuestionService
import com.comssa.core.chatbot.dto.response.ChatGptFileUploadResponseDto
import com.comssa.core.chatbot.service.implement.ChatManageService
import com.comssa.persistence.question.common.domain.Question
import com.comssa.persistence.question.common.domain.dto.request.RequestQuestionCommandDto
import com.comssa.persistence.question.common.dto.request.RequestQuestionCommandDto
import org.springframework.stereotype.Service

@Service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.comssa.api.question.major.admin.service.implement

import com.comssa.core.chatbot.domain.ChatContentType
import com.comssa.core.chatbot.dto.request.ChatContentDto
import com.comssa.core.chatbot.dto.request.ChatContentDto.Companion.from
import com.comssa.persistence.chatbot.ChatContentType
import com.comssa.persistence.question.common.domain.Question
import com.comssa.persistence.question.license.domain.LicenseMultipleChoiceQuestion
import com.comssa.persistence.question.major.domain.common.MajorMultipleChoiceQuestion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.comssa.api.login.aspect.AddLoginStatusAttribute;
import com.comssa.api.question.major.user.service.implement.BasicMajorQuestionClassifiedGetService;
import com.comssa.persistence.question.common.domain.QuestionCategory;
import com.comssa.persistence.question.common.domain.dto.response.ResponseClassifiedMultipleQuestionDto;
import com.comssa.persistence.question.common.dto.response.ResponseClassifiedMultipleQuestionDto;
import com.comssa.persistence.question.major.domain.common.MajorMultipleChoiceQuestion;
import com.comssa.persistence.question.major.domain.user.dto.request.RequestGetQuestionByCategoryAndLevelDto;
import com.comssa.persistence.question.major.user.dto.request.RequestGetQuestionByCategoryAndLevelDto;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import com.comssa.persistence.question.common.domain.QuestionCategory;
import com.comssa.persistence.question.major.domain.common.MajorMultipleChoiceQuestion;
import com.comssa.persistence.question.major.domain.user.dto.request.RequestGetQuestionByCategoryAndLevelDto;
import com.comssa.persistence.question.major.user.dto.request.RequestGetQuestionByCategoryAndLevelDto;
import org.springframework.stereotype.Service;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.comssa.api.question.major.user.service;

import com.comssa.persistence.question.major.domain.user.dto.response.ResponseMajorQuestionClassCountDto;
import com.comssa.persistence.question.major.user.dto.response.ResponseMajorQuestionClassCountDto;
import org.springframework.stereotype.Service;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.comssa.api.question.major.user.service.MajorQuestionClassifiedGetService;
import com.comssa.persistence.question.common.domain.QuestionCategory;
import com.comssa.persistence.question.major.domain.common.MajorMultipleChoiceQuestion;
import com.comssa.persistence.question.major.domain.user.dto.request.RequestGetQuestionByCategoryAndLevelDto;
import com.comssa.persistence.question.major.user.dto.request.RequestGetQuestionByCategoryAndLevelDto;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.comssa.api.question.license;

import com.api.computerscience.question.common.dto.request.RequestChangeContentDto;
import com.comssa.api.ControllerTest;
import com.comssa.api.question.license.controller.AdminLicenseQuestionController;
import com.comssa.api.question.license.service.AdminLicenseMuiltipleChoiceQuestionUpdateService;
import com.comssa.api.question.license.service.AdminLicenseQuestionChoiceUpdateService;
import com.comssa.api.question.license.service.AdminLicenseQuestionMakeService;
import com.comssa.persistence.question.common.domain.dto.request.RequestChangeDescriptionDto;
import com.comssa.persistence.question.common.domain.dto.response.ResponseQuestionDto;
import com.comssa.persistence.question.common.dto.request.RequestChangeContentDto;
import com.comssa.persistence.question.common.dto.request.RequestChangeDescriptionDto;
import com.comssa.persistence.question.common.dto.response.ResponseQuestionDto;
import com.comssa.persistence.question.license.domain.LicenseCategory;
import com.comssa.persistence.question.license.domain.LicenseMultipleChoiceQuestion;
import com.comssa.persistence.question.license.domain.dto.request.RequestMakeLicenseMultipleChoiceQuestionDto;
import com.comssa.persistence.question.license.dto.request.RequestMakeLicenseMultipleChoiceQuestionDto;
import com.epages.restdocs.apispec.MockMvcRestDocumentationWrapper;
import com.epages.restdocs.apispec.ResourceSnippetParameters;
import org.junit.jupiter.api.BeforeEach;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.comssa.api.question.license.service.LicenseSessionService;
import com.comssa.api.question.license.service.UserLicenseQuestionGetService;
import com.comssa.persistence.question.common.domain.QuestionCategory;
import com.comssa.persistence.question.common.domain.dto.response.ResponseClassifiedMultipleQuestionDto;
import com.comssa.persistence.question.common.dto.response.ResponseClassifiedMultipleQuestionDto;
import com.comssa.persistence.question.license.domain.LicenseCategory;
import com.comssa.persistence.question.license.domain.LicenseMultipleChoiceQuestion;
import com.comssa.persistence.question.license.domain.LicenseSession;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.comssa.api.question.major.admin.controller;

import com.api.computerscience.question.common.dto.request.RequestChangeContentDto;
import com.comssa.api.ControllerTest;
import com.comssa.api.question.major.admin.service.AdminMajorQuestionClassifiedGetService;
import com.comssa.api.question.major.admin.service.AdminMajorQuestionMakeService;
import com.comssa.api.question.major.admin.service.implement.AdminMajorMultipleChoiceQuestionUpdateService;
import com.comssa.api.question.major.common.exception.DuplicateQuestionException;
import com.comssa.persistence.question.common.domain.dto.request.RequestChangeDescriptionDto;
import com.comssa.persistence.question.major.domain.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.common.dto.request.RequestChangeContentDto;
import com.comssa.persistence.question.common.dto.request.RequestChangeDescriptionDto;
import com.comssa.persistence.question.major.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.domain.common.MajorMultipleChoiceQuestion;
import com.epages.restdocs.apispec.MockMvcRestDocumentationWrapper;
import com.epages.restdocs.apispec.ResourceSnippetParameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import com.comssa.api.ServiceIntegrationTest;
import com.comssa.persistence.question.major.domain.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.admin.dto.RequestMakeMultipleChoiceQuestionDto;
import com.comssa.persistence.question.major.domain.common.MajorMultipleChoiceQuestion;
import com.comssa.persistence.question.major.repository.MajorMultipleChoiceQuestionRepository;
import org.assertj.core.api.Assertions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.comssa.api.question.major.user.service.implement.BasicMajorQuestionClassifiedGetService;
import com.comssa.persistence.question.common.domain.QuestionCategory;
import com.comssa.persistence.question.common.domain.QuestionLevel;
import com.comssa.persistence.question.common.domain.dto.response.ResponseClassifiedMultipleQuestionDto;
import com.comssa.persistence.question.common.dto.response.ResponseClassifiedMultipleQuestionDto;
import com.comssa.persistence.question.major.domain.common.MajorMultipleChoiceQuestion;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand Down
Loading
Loading