Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
edcdf39
Merge pull request #40 from pirogramming/main
Imggaggu May 7, 2025
ecfb7b2
install npm
Imggaggu May 7, 2025
10a5d95
update README.md
Imggaggu May 7, 2025
8691e9a
Merge pull request #43 from pirogramming/frontend
qkrxogmla May 7, 2025
c049062
Update README.md
Imggaggu May 7, 2025
1708459
npm재설치
qkrxogmla May 7, 2025
cd00a30
[Fix] export mapStatus
Imggaggu May 7, 2025
286ca48
Merge pull request #44 from pirogramming/frontend_th
qkrxogmla May 7, 2025
203f50a
install npm
Imggaggu May 7, 2025
859a238
re-install npm
Imggaggu May 7, 2025
95d13c3
[Fix]package.json
Imggaggu May 7, 2025
08df23e
[Fix] deploy.yml
Imggaggu May 7, 2025
f6f42be
[Fix] package.json
Imggaggu May 7, 2025
9c9b585
[Fix] deploy.yml
Imggaggu May 7, 2025
ba635a6
frontend 배포 성공
Imggaggu May 7, 2025
e0a5702
give permission gradlew
Imggaggu May 7, 2025
1c4fb21
grant permission
Imggaggu May 7, 2025
409b387
[Fix] deploy.yml for backend
Imggaggu May 7, 2025
b7b5080
deploy.yml:Create .env file
Imggaggu May 7, 2025
4a19d0d
배포 순서 바꾸기
Imggaggu May 7, 2025
52a7c50
build& env 생성 합치기
Imggaggu May 7, 2025
58e1c08
test 생략
Imggaggu May 7, 2025
4465362
찐막
Imggaggu May 7, 2025
6f26bcc
장재훈 천재
Imggaggu May 7, 2025
6a5364c
[HotFix]Deploy 성공
Imggaggu May 7, 2025
50f1211
Merge pull request #45 from pirogramming/deploy
Imggaggu May 7, 2025
ff4c525
[Fix] intro page font
Imggaggu May 8, 2025
6fc3aa0
[feat] 보증금 차감 수정
seonjuuu May 8, 2025
8bf9a7c
[feat] login exception
seonjuuu May 8, 2025
2884082
Merge pull request #47 from pirogramming/backend_sj
seonjuuu May 8, 2025
0cb5077
[feat] login exception
seonjuuu May 8, 2025
10653bb
Merge pull request #48 from pirogramming/backend_sj
seonjuuu May 8, 2025
5f6a566
[fix]: InputBlock 입력 글자 안보이는 이슈 해결
NamKyeongMin May 10, 2025
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
88 changes: 49 additions & 39 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,9 @@ on:
branches: [deploy]

jobs:
frontend:
name: Deploy Frontend to S3
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22'

- name: Install dependencies
run: |
cd frontend
npm ci

- name: Build frontend
run: |
cd frontend
npm run build

- name: Deploy to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --delete
env:
AWS_S3_BUCKET: www.pirocheck.org
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: frontend/dist

backend:
name: Deploy Backend to EC2
needs: frontend
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
Expand All @@ -53,10 +19,18 @@ jobs:
distribution: 'temurin'
java-version: '17'

- name: Build backend
- name: Create .env file& Build backend
run: |
cd backend
./gradlew build --no-daemon
cd backend/pirocheck
echo DB_HOST=${{ secrets.DB_HOST }} >> .env
echo DB_PORT=${{ secrets.DB_PORT }} >> .env
echo DB_NAME=${{ secrets.DB_NAME }} >> .env
echo DB_USER=${{ secrets.DB_USER }} >> .env
echo DB_PASSWORD=${{ secrets.DB_PASSWORD }} >> .env

chmod +x gradlew
./gradlew build -x test --no-daemon


- name: Restore PEM file
run: |
Expand All @@ -65,7 +39,7 @@ jobs:

- name: Copy JAR to EC2
run: |
scp -o StrictHostKeyChecking=no -i pirocheck.pem backend/build/libs/*.jar ubuntu@${{ secrets.EC2_HOST }}:/home/ubuntu/app.jar
scp -o StrictHostKeyChecking=no -i pirocheck.pem backend/pirocheck/build/libs/*.jar ubuntu@${{ secrets.EC2_HOST }}:/home/ubuntu/

- name: Restart Spring Boot on EC2
run: |
Expand Down Expand Up @@ -97,3 +71,39 @@ jobs:
"color": 16711680
}]
}' ${{ secrets.DISCORD_WEBHOOK }}

frontend:
name: Deploy Frontend to S3
needs: backend
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22'

- name: Install dependencies
run: |
cd frontend
rm -rf node_modules package-lock.json
npm install
npm install --save-dev vite rollup

- name: Build frontend
run: |
cd frontend
npm run build

- name: Deploy to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --delete
env:
AWS_S3_BUCKET: www.pirocheck.org
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: frontend/dist
2 changes: 1 addition & 1 deletion backend/pirocheck/gradlew
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class DepositService {
private final DepositRepository depositRepository;
private final UserRepository userRepository;
private final AttendanceRepository attendanceRepository;
private final AssignmentRepository assignmentRepository; // 확인
private final AssignmentRepository assignmentRepository;

@Transactional
public DepositResDto getDeposit(Long userId) {
Expand All @@ -31,12 +31,12 @@ public DepositResDto getDeposit(Long userId) {

// 출석 실패
int failAttendanceCount = attendanceRepository.countByUserAndStatusFalse(user);
int descentAttendance = failAttendanceCount * 10000;
int descentAttendance = failAttendanceCount * 10_000;

// 과제 실패
int failAssignmentCount = assignmentRepository.countByUserAndSubmitted(user, AssignmentStatus.FAILURE); // 확인
int weakAssignmentCount = assignmentRepository.countByUserAndSubmitted(user, AssignmentStatus.INSUFFICIENT); // 확인
int descentAssignment = failAssignmentCount * 10_000 + weakAssignmentCount * 5_000;
int failAssignmentCount = assignmentRepository.countByUserAndSubmitted(user, AssignmentStatus.FAILURE);
int weakAssignmentCount = assignmentRepository.countByUserAndSubmitted(user, AssignmentStatus.INSUFFICIENT);
int descentAssignment = failAssignmentCount * 20_000 + weakAssignmentCount * 10_000;

// 방어권
int ascentDefence = deposit.getAscentDefence();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package backend.pirocheck.User.exception;

import backend.pirocheck.Attendance.dto.response.ApiResponse;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

@ExceptionHandler(InvalidLoginException.class)
public ResponseEntity<ApiResponse<?>> handleInvalidLoginException(InvalidLoginException e) {
return ResponseEntity
.status(HttpStatus.UNAUTHORIZED) // 401 상태 코드
.body(ApiResponse.error(e.getMessage())); // 에러 메시지 전달
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package backend.pirocheck.User.exception;

public class InvalidLoginException extends RuntimeException{
public InvalidLoginException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package backend.pirocheck.User.service;

import backend.pirocheck.User.entity.User;
import backend.pirocheck.User.exception.InvalidLoginException;
import backend.pirocheck.User.repository.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand All @@ -12,8 +13,14 @@ public class UserService {
private final UserRepository userRepository;

public User login(String name, String password) {
return userRepository.findByName(name)
.filter(user -> user.getPassword().equals(password))
.orElseThrow(() -> new IllegalArgumentException("이름 또는 비밀번호가 일치하지 않습니다."));
User user = userRepository.findByName(name)
.orElseThrow(() -> new InvalidLoginException("해당 사용자가 존재하지 않습니다."));

if (!user.getPassword().equals(password)) {
throw new InvalidLoginException("비밀번호가 일치하지 않습니다.");
}

return user;
}
}

2 changes: 1 addition & 1 deletion frontend/src/Intro.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
.intro_container {
background-color: var(--background-black);
color: var(--main-green);
font-family: "Cafe24Moyamoya-Regular-v1.0", sans-serif;
font-family: 'Akira Expanded';
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
display: flex;
justify-content: center;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const Login = () => {
placeholder: "비밀번호",
},
]}
values={[name, password]} // InputBlock props 수정에 따라 추가
onChange={handleChange}
/>
<div className={styles.errorWrapper}>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/AssignmentStatus.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const mapStatus = (status) => {
export const mapStatus = (status) => {
switch (status) {
case "SUCCESS":
return "done";
Expand Down