From a5b1782dece0bbaf67750a1d86e71a48d9bab816 Mon Sep 17 00:00:00 2001 From: Seo Jiwon Date: Wed, 30 Apr 2025 19:53:43 +0900 Subject: [PATCH 01/13] =?UTF-8?q?=E2=9A=99=20setting:=20add=20aws=20region?= =?UTF-8?q?=20env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5fa0522..2b160f4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,6 +9,9 @@ jobs: deploy: runs-on: ubuntu-latest + env: + AWS_REGION: ${{ secrets.AWS_REGION }} + steps: - name: Checkout source code uses: actions/checkout@v3 From 71510e0e9759a4eb997a0789db5440ea52ab641d Mon Sep 17 00:00:00 2001 From: Seo Jiwon Date: Wed, 30 Apr 2025 20:00:12 +0900 Subject: [PATCH 02/13] =?UTF-8?q?=E2=9A=99=20setting:=20add=20aws=20region?= =?UTF-8?q?=20env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2b160f4..a3c2c9b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,6 +12,7 @@ jobs: env: AWS_REGION: ${{ secrets.AWS_REGION }} + steps: - name: Checkout source code uses: actions/checkout@v3 From 6f99e1cff55bff7ac5eeec2e0c4f842af5196fbe Mon Sep 17 00:00:00 2001 From: Seo Jiwon Date: Wed, 30 Apr 2025 20:03:02 +0900 Subject: [PATCH 03/13] =?UTF-8?q?=E2=9A=99=20setting:=20add=20aws=20region?= =?UTF-8?q?=20env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a3c2c9b..cd63d26 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,9 +10,10 @@ jobs: runs-on: ubuntu-latest env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: ${{ secrets.AWS_REGION }} - steps: - name: Checkout source code uses: actions/checkout@v3 From fb924817d3e996cfa01a4bb270448057d0d9a1e1 Mon Sep 17 00:00:00 2001 From: Seo Jiwon <134384128+seoiiwon@users.noreply.github.com> Date: Mon, 9 Jun 2025 13:02:43 +0900 Subject: [PATCH 04/13] Update deploy.yml --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ca15cb0..c801bc4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -32,7 +32,7 @@ jobs: # 이전에 빌드한 캐시 불러오기 - name: Cache Docker layers - uses: actions/cache@v2 + uses: actions/cache@v4 with: key: ${{ runner.os }}-buildx-${{ github.sha }} path: /tmp/.buildx-cache @@ -63,4 +63,4 @@ jobs: docker stop app || true docker rm app || true docker run -d --name app -p 3000:3000 --restart always ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest - # 기존 컨테이너 중지, 삭제 후 새 컨테이너 실행 ( port 3000, restart ) \ No newline at end of file + # 기존 컨테이너 중지, 삭제 후 새 컨테이너 실행 ( port 3000, restart ) From 3dd9dcea84916e729a2e5f475212c0712b90ad34 Mon Sep 17 00:00:00 2001 From: Seo Jiwon <134384128+seoiiwon@users.noreply.github.com> Date: Mon, 9 Jun 2025 13:05:44 +0900 Subject: [PATCH 05/13] Update deploy.yml --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c801bc4..326446e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,7 +9,7 @@ on: env: DOCKER_IMAGE: ${{ secrets.ECR_REPO }} - ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazon.com + ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com jobs: From 36202a3407cc785b4e6ad23565790d4e07f07fd8 Mon Sep 17 00:00:00 2001 From: Seo Jiwon <134384128+seoiiwon@users.noreply.github.com> Date: Mon, 9 Jun 2025 13:09:29 +0900 Subject: [PATCH 06/13] Update deploy.yml --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 326446e..20b20d9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,7 +8,7 @@ on: env: - DOCKER_IMAGE: ${{ secrets.ECR_REPO }} + IMAGE_NAME: ${{ secrets.ECR_REPO }} ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com From b080ac64b96d7424ebcf9562043e4d57fe1bf7c2 Mon Sep 17 00:00:00 2001 From: Seo Jiwon <134384128+seoiiwon@users.noreply.github.com> Date: Mon, 9 Jun 2025 13:14:27 +0900 Subject: [PATCH 07/13] Update deploy.yml --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 20b20d9..4cb19bb 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -64,3 +64,4 @@ jobs: docker rm app || true docker run -d --name app -p 3000:3000 --restart always ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest # 기존 컨테이너 중지, 삭제 후 새 컨테이너 실행 ( port 3000, restart ) + From 78817b390ccb490914e42d017c57dd9651444dbe Mon Sep 17 00:00:00 2001 From: seoiiwon Date: Mon, 9 Jun 2025 13:20:07 +0900 Subject: [PATCH 08/13] =?UTF-8?q?=F0=9F=94=A8=20refactor:=20release=20port?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=203000=20->=208080?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4cb19bb..a5caa6d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -62,6 +62,6 @@ jobs: docker pull ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest docker stop app || true docker rm app || true - docker run -d --name app -p 3000:3000 --restart always ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest + docker run -d --name app -p 8080:8080 --restart always ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest # 기존 컨테이너 중지, 삭제 후 새 컨테이너 실행 ( port 3000, restart ) From 98d187dd0bc3feeba8b7b83b0d9042b88f947d99 Mon Sep 17 00:00:00 2001 From: seoiiwon Date: Mon, 9 Jun 2025 13:23:55 +0900 Subject: [PATCH 09/13] =?UTF-8?q?=F0=9F=94=A8=20refactor:=20deploy=20scrip?= =?UTF-8?q?t=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a5caa6d..d366eab 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -59,9 +59,7 @@ jobs: username: ec2-user key: ${{ secrets.EC2_SSH_KEY }} script: | - docker pull ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest - docker stop app || true - docker rm app || true + aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ env.ECR_REGISTRY }} + docker rm -f app || true docker run -d --name app -p 8080:8080 --restart always ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest - # 기존 컨테이너 중지, 삭제 후 새 컨테이너 실행 ( port 3000, restart ) From e3c3a05ddda9d09e11663f2cb29f95991441cfd6 Mon Sep 17 00:00:00 2001 From: seoiiwon Date: Mon, 9 Jun 2025 13:31:28 +0900 Subject: [PATCH 10/13] =?UTF-8?q?=F0=9F=94=A8=20refactor:=20deploy=20scrip?= =?UTF-8?q?t=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d366eab..20f990c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -60,6 +60,8 @@ jobs: key: ${{ secrets.EC2_SSH_KEY }} script: | aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ env.ECR_REGISTRY }} + docker rm -f app || true - docker run -d --name app -p 8080:8080 --restart always ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest - + docker kill $(docker ps -q --filter "publish=8080") || true + + docker run -d --name app -p 8080:8080 --restart always ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ No newline at end of file From 4616dcf32df946ba31969345e944f7a2b6abd93b Mon Sep 17 00:00:00 2001 From: seoiiwon Date: Mon, 9 Jun 2025 13:39:03 +0900 Subject: [PATCH 11/13] =?UTF-8?q?=F0=9F=94=A8=20refactor:=20deploy=20scrip?= =?UTF-8?q?t=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 20f990c..edf8752 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -60,8 +60,6 @@ jobs: key: ${{ secrets.EC2_SSH_KEY }} script: | aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ env.ECR_REGISTRY }} - - docker rm -f app || true - docker kill $(docker ps -q --filter "publish=8080") || true - - docker run -d --name app -p 8080:8080 --restart always ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ No newline at end of file + docker-compose -f docker-compose.prod.yml down + docker-compose -f docker-compose.prod.yml pull + docker-compose -f docker-compose.prod.yml up -d \ No newline at end of file From f177ce13cd6c8b407f3fa88fa149e0017c6c95d3 Mon Sep 17 00:00:00 2001 From: seoiiwon Date: Mon, 9 Jun 2025 13:50:13 +0900 Subject: [PATCH 12/13] =?UTF-8?q?=F0=9F=94=A8=20refactor:=20deploy=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=9E=84=EC=8B=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/test/test_router.py | 3 +-- app/test/dto/response/test_response.py | 2 ++ app/test/usecase/test_usecase.py | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/api/v1/test/test_router.py b/api/v1/test/test_router.py index 1449a84..d9e1f72 100644 --- a/api/v1/test/test_router.py +++ b/api/v1/test/test_router.py @@ -1,7 +1,7 @@ from fastapi import APIRouter, Depends, Path, Query from sqlalchemy.orm import Session -from core.dependency import get_db +from database.dependency import get_db from app.test.dto.request.test_request import TestRequest from app.test.dto.response.test_response import TestResponse from app.test.usecase.test_usecase import create_test_usecae, get_tests_usecase @@ -20,7 +20,6 @@ # 문제 풀기 (쉬엄 모드) from app.test.usecase.rest_mode_usecase import rest_mode_usecase from app.test.dto.response.rest_mode_response import RestModeResponse -from core.dependency import get_db # 문제 풀기 (오늘의 문제) from domain.user.entity.user import User from app.test.dto.response.today_questions_response import TodayQuestionsResponse diff --git a/app/test/dto/response/test_response.py b/app/test/dto/response/test_response.py index e69de29..d02bdce 100644 --- a/app/test/dto/response/test_response.py +++ b/app/test/dto/response/test_response.py @@ -0,0 +1,2 @@ +class TestResponse: + pass \ No newline at end of file diff --git a/app/test/usecase/test_usecase.py b/app/test/usecase/test_usecase.py index a1c436e..7316a2f 100644 --- a/app/test/usecase/test_usecase.py +++ b/app/test/usecase/test_usecase.py @@ -11,4 +11,10 @@ # def get_tests_usecase(db: Session) -> list[TestResponse]: # service = TestService(db) # tests = service.get_tests() -# return [TestResponse.model_validate(t) for t in tests] \ No newline at end of file +# return [TestResponse.model_validate(t) for t in tests] +def create_test_usecae(): + return None + + +def get_tests_usecase(): + return None \ No newline at end of file From e53182e3bf5954d8a0d2decd52508f8f2ae9aead Mon Sep 17 00:00:00 2001 From: seoiiwon Date: Mon, 9 Jun 2025 14:09:10 +0900 Subject: [PATCH 13/13] =?UTF-8?q?=F0=9F=94=A8=20refactor:=20=EC=86=8C?= =?UTF-8?q?=EC=8A=A4=20=EC=98=A4=EB=A5=98=20=EC=9E=84=EC=8B=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/test/test_router.py | 7 ---- app/test/dto/response/test_response.py | 5 ++- .../usecase/send_answer_feedback_usecase.py | 32 ------------------- domain/test/entity/feedback.py | 12 ------- 4 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 app/test/usecase/send_answer_feedback_usecase.py delete mode 100644 domain/test/entity/feedback.py diff --git a/api/v1/test/test_router.py b/api/v1/test/test_router.py index d9e1f72..965a1de 100644 --- a/api/v1/test/test_router.py +++ b/api/v1/test/test_router.py @@ -30,7 +30,6 @@ # 개발자에게 피드백 제출하기 from app.test.dto.request.send_answer_feedback_request import SendAnswerFeedbackRequest from app.test.dto.response.send_answer_feedback_response import SendAnswerFeedbackResponse -from app.test.usecase.send_answer_feedback_usecase import send_answer_feedback_usecase router = APIRouter(prefix="/test", tags=["test"]) @@ -102,9 +101,3 @@ async def create_ai_explanation( current_user: User = Depends(get_current_user) ): return await create_ai_explanation_usecase(exam_id, db, current_user) - - -# 개발자에게 피드백 제출하기 -@router.post("/send-answer-feedback", response_model=SendAnswerFeedbackResponse) -def send_answer_feedback(request: SendAnswerFeedbackRequest, db: Session = Depends(get_db)): - return send_answer_feedback_usecase(db, request) diff --git a/app/test/dto/response/test_response.py b/app/test/dto/response/test_response.py index d02bdce..2725fd2 100644 --- a/app/test/dto/response/test_response.py +++ b/app/test/dto/response/test_response.py @@ -1,2 +1,5 @@ -class TestResponse: +from pydantic import BaseModel + + +class TestResponse(BaseModel): pass \ No newline at end of file diff --git a/app/test/usecase/send_answer_feedback_usecase.py b/app/test/usecase/send_answer_feedback_usecase.py deleted file mode 100644 index 2381050..0000000 --- a/app/test/usecase/send_answer_feedback_usecase.py +++ /dev/null @@ -1,32 +0,0 @@ -from sqlalchemy.orm import Session -from app.test.dto.request.send_answer_feedback_request import SendAnswerFeedbackRequest -from domain.test.entity.feedback import Feedback - -from exception.client_exception import BadRequestException -from exception.server_exception import InternalServerErrorException -from exception.success import ok - - -async def send_answer_feedback_usecase(db: Session, request: SendAnswerFeedbackRequest): - if not request.test_id or not request.question_id or not request.ai_explanation or not request.feedback: - raise BadRequestException("누락된 필드가 존재합니다.") - - try: - feedback = Feedback( - test_id=request.test_id, - question_id=request.question_id, - ai_explanation=request.ai_explanation, - feedback=request.feedback - ) - db.add(feedback) - db.commit() - db.refresh(feedback) - - return ok( - data=None, - message="피드백이 성공적으로 제출되었습니다." - ) - - except Exception: - db.rollback() - raise InternalServerErrorException("서버 오류") diff --git a/domain/test/entity/feedback.py b/domain/test/entity/feedback.py deleted file mode 100644 index 85fef30..0000000 --- a/domain/test/entity/feedback.py +++ /dev/null @@ -1,12 +0,0 @@ -from sqlalchemy import Column, Integer, String -from database.base import Base - - -class Feedback(Base): - __tablename__ = "feedbacks" - - id = Column(Integer, primary_key=True, index=True) - test_id = Column(String, nullable=False) - question_id = Column(String, nullable=False) - ai_explanation = Column(String, nullable=False) - feedback = Column(String, nullable=False)