Skip to content

Commit ace8277

Browse files
authored
Merge pull request #49 from pirogramming/frontend_km
[fix]: InputBlock value 오류 수정
2 parents 8a782ed + 5f6a566 commit ace8277

9 files changed

Lines changed: 93 additions & 50 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,9 @@ on:
55
branches: [deploy]
66

77
jobs:
8-
frontend:
9-
name: Deploy Frontend to S3
10-
runs-on: ubuntu-22.04
11-
12-
steps:
13-
- name: Checkout repository
14-
uses: actions/checkout@v3
15-
16-
- name: Set up Node.js
17-
uses: actions/setup-node@v3
18-
with:
19-
node-version: '22'
20-
21-
- name: Install dependencies
22-
run: |
23-
cd frontend
24-
npm ci
25-
26-
- name: Build frontend
27-
run: |
28-
cd frontend
29-
npm run build
30-
31-
- name: Deploy to S3
32-
uses: jakejarvis/s3-sync-action@master
33-
with:
34-
args: --delete
35-
env:
36-
AWS_S3_BUCKET: www.pirocheck.org
37-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
38-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
39-
SOURCE_DIR: frontend/dist
40-
418
backend:
429
name: Deploy Backend to EC2
43-
needs: frontend
44-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-22.04
4511

4612
steps:
4713
- name: Checkout repository
@@ -53,10 +19,18 @@ jobs:
5319
distribution: 'temurin'
5420
java-version: '17'
5521

56-
- name: Build backend
22+
- name: Create .env file& Build backend
5723
run: |
58-
cd backend
59-
./gradlew build --no-daemon
24+
cd backend/pirocheck
25+
echo DB_HOST=${{ secrets.DB_HOST }} >> .env
26+
echo DB_PORT=${{ secrets.DB_PORT }} >> .env
27+
echo DB_NAME=${{ secrets.DB_NAME }} >> .env
28+
echo DB_USER=${{ secrets.DB_USER }} >> .env
29+
echo DB_PASSWORD=${{ secrets.DB_PASSWORD }} >> .env
30+
31+
chmod +x gradlew
32+
./gradlew build -x test --no-daemon
33+
6034
6135
- name: Restore PEM file
6236
run: |
@@ -65,7 +39,7 @@ jobs:
6539
6640
- name: Copy JAR to EC2
6741
run: |
68-
scp -o StrictHostKeyChecking=no -i pirocheck.pem backend/build/libs/*.jar ubuntu@${{ secrets.EC2_HOST }}:/home/ubuntu/app.jar
42+
scp -o StrictHostKeyChecking=no -i pirocheck.pem backend/pirocheck/build/libs/*.jar ubuntu@${{ secrets.EC2_HOST }}:/home/ubuntu/
6943
7044
- name: Restart Spring Boot on EC2
7145
run: |
@@ -97,3 +71,39 @@ jobs:
9771
"color": 16711680
9872
}]
9973
}' ${{ secrets.DISCORD_WEBHOOK }}
74+
75+
frontend:
76+
name: Deploy Frontend to S3
77+
needs: backend
78+
runs-on: ubuntu-22.04
79+
80+
steps:
81+
- name: Checkout repository
82+
uses: actions/checkout@v3
83+
84+
- name: Set up Node.js
85+
uses: actions/setup-node@v3
86+
with:
87+
node-version: '22'
88+
89+
- name: Install dependencies
90+
run: |
91+
cd frontend
92+
rm -rf node_modules package-lock.json
93+
npm install
94+
npm install --save-dev vite rollup
95+
96+
- name: Build frontend
97+
run: |
98+
cd frontend
99+
npm run build
100+
101+
- name: Deploy to S3
102+
uses: jakejarvis/s3-sync-action@master
103+
with:
104+
args: --delete
105+
env:
106+
AWS_S3_BUCKET: www.pirocheck.org
107+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
108+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
109+
SOURCE_DIR: frontend/dist

backend/pirocheck/gradlew

100644100755
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/pirocheck/src/main/java/backend/pirocheck/Deposit/service/DepositService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class DepositService {
2020
private final DepositRepository depositRepository;
2121
private final UserRepository userRepository;
2222
private final AttendanceRepository attendanceRepository;
23-
private final AssignmentRepository assignmentRepository; // 확인
23+
private final AssignmentRepository assignmentRepository;
2424

2525
@Transactional
2626
public DepositResDto getDeposit(Long userId) {
@@ -31,12 +31,12 @@ public DepositResDto getDeposit(Long userId) {
3131

3232
// 출석 실패
3333
int failAttendanceCount = attendanceRepository.countByUserAndStatusFalse(user);
34-
int descentAttendance = failAttendanceCount * 10000;
34+
int descentAttendance = failAttendanceCount * 10_000;
3535

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

4141
// 방어권
4242
int ascentDefence = deposit.getAscentDefence();
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package backend.pirocheck.User.exception;
2+
3+
import backend.pirocheck.Attendance.dto.response.ApiResponse;
4+
import org.springframework.http.HttpStatus;
5+
import org.springframework.http.ResponseEntity;
6+
import org.springframework.web.bind.annotation.ExceptionHandler;
7+
import org.springframework.web.bind.annotation.RestControllerAdvice;
8+
9+
@RestControllerAdvice
10+
public class GlobalExceptionHandler {
11+
12+
@ExceptionHandler(InvalidLoginException.class)
13+
public ResponseEntity<ApiResponse<?>> handleInvalidLoginException(InvalidLoginException e) {
14+
return ResponseEntity
15+
.status(HttpStatus.UNAUTHORIZED) // 401 상태 코드
16+
.body(ApiResponse.error(e.getMessage())); // 에러 메시지 전달
17+
}
18+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package backend.pirocheck.User.exception;
2+
3+
public class InvalidLoginException extends RuntimeException{
4+
public InvalidLoginException(String message) {
5+
super(message);
6+
}
7+
}

backend/pirocheck/src/main/java/backend/pirocheck/User/service/UserService.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package backend.pirocheck.User.service;
22

33
import backend.pirocheck.User.entity.User;
4+
import backend.pirocheck.User.exception.InvalidLoginException;
45
import backend.pirocheck.User.repository.UserRepository;
56
import lombok.RequiredArgsConstructor;
67
import org.springframework.stereotype.Service;
@@ -12,8 +13,14 @@ public class UserService {
1213
private final UserRepository userRepository;
1314

1415
public User login(String name, String password) {
15-
return userRepository.findByName(name)
16-
.filter(user -> user.getPassword().equals(password))
17-
.orElseThrow(() -> new IllegalArgumentException("이름 또는 비밀번호가 일치하지 않습니다."));
16+
User user = userRepository.findByName(name)
17+
.orElseThrow(() -> new InvalidLoginException("해당 사용자가 존재하지 않습니다."));
18+
19+
if (!user.getPassword().equals(password)) {
20+
throw new InvalidLoginException("비밀번호가 일치하지 않습니다.");
21+
}
22+
23+
return user;
1824
}
1925
}
26+

frontend/src/Intro.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
.intro_container {
2828
background-color: var(--background-black);
2929
color: var(--main-green);
30-
font-family: "Cafe24Moyamoya-Regular-v1.0", sans-serif;
30+
font-family: 'Akira Expanded';
3131
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
3232
display: flex;
3333
justify-content: center;

frontend/src/Login.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const Login = () => {
7171
placeholder: "비밀번호",
7272
},
7373
]}
74+
values={[name, password]} // InputBlock props 수정에 따라 추가
7475
onChange={handleChange}
7576
/>
7677
<div className={styles.errorWrapper}>

frontend/src/utils/AssignmentStatus.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const mapStatus = (status) => {
1+
export const mapStatus = (status) => {
22
switch (status) {
33
case "SUCCESS":
44
return "done";

0 commit comments

Comments
 (0)