Skip to content

Commit 0e3c388

Browse files
committed
merge
2 parents 403a46d + bfc0996 commit 0e3c388

File tree

11 files changed

+103
-27
lines changed

11 files changed

+103
-27
lines changed

backend/pirocheck/src/main/java/backend/pirocheck/User/filter/SessionCheckFilter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ protected void doFilterInternal(HttpServletRequest request,
1818
throws ServletException, IOException {
1919

2020
String path = request.getRequestURI();
21+
String method = request.getMethod();
2122

22-
// 로그인/로그아웃 요청은 세션 체크 제외
23-
if (path.startsWith("/api/login") || path.startsWith("/api/logout")) {
23+
// CORS preflight 요청(OPTIONS) 또는 로그인/로그아웃 요청은 세션 체크 제외
24+
if ("OPTIONS".equals(method) || path.startsWith("/api/login") || path.startsWith("/api/logout")) {
2425
filterChain.doFilter(request, response); // 다음 필터나 컨트롤러로 넘기는 명령어
2526
return; // 세션 검사 안함
2627
}

frontend/src/api/api.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import axios from "axios";
22

33
const api = axios.create({
44
baseURL: "http://api.pirocheck.org:8080/api",
5-
65
// 수정 필요한지 재검 필요함
76
// "http://api.pirocheck.org:8080/api"
8-
97
withCredentials: true,
108
});
119

frontend/src/api/assignment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const submitAssignmentStatus = async (userId, assignmentId, status) => {
2525
};
2626

2727
export const updateAssignmentStatus = async (userId, assignmentId, status) => {
28-
return api.put(`/api/admin/users/${userId}/assignments/${assignmentId}/submission`, {
28+
return api.put(`/admin/users/${userId}/assignments/${assignmentId}/submission`, {
2929
status,
3030
});
3131
};

frontend/src/api/students.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const getStudentsByName = async (name) => {
44
const res = await api.get(`/admin/managestudent`, {
55
params: { name },
66
});
7+
console.log("💬 getStudentsByName 응답:", res.data);
78
return res.data; // [{ id: ..., name: ... }]
89
};
910

frontend/src/components/Header.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ const Header = () => {
5050
height={30}
5151
/>
5252
</button>
53-
) : (
54-
<div style={{ width: "30px" }} />
55-
)}
53+
) : null}
5654
{showRightMagageStudent ? (
5755
<button
5856
className="icon-button"

frontend/src/components/componentsCss/Header.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
display: flex;
66
align-items: center;
77
width: 390px;
8-
justify-content: space-between;
8+
justify-content: flex-start;
99
padding: 1rem;
10-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
10+
gap: 100px;
11+
box-shadow: 0 2px 4px #0003;
1112
margin: 10px;
1213
}
1314

frontend/src/pages/admin/AdminStudentAssignment.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,4 @@ const handleSave = async (taskId, status) => {
143143
);
144144
};
145145

146-
export default AdminStudentAssignment;
146+
export default AdminStudentAssignment;

frontend/src/pages/admin/AttendanceCode.jsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,33 @@
1-
import { useState } from "react";
21
import api from "../../api/api";
32
import Header from "../../components/Header";
43
import style from "./AttendanceCode.module.css";
4+
import { useState, useEffect } from "react";
55

66
const AttendanceCode = () => {
77
const [code, setCode] = useState("");
88

9+
useEffect(() => {
10+
const expireIfNeeded = async () => {
11+
try {
12+
const res = await api.get("admin/attendance/active-code");
13+
const activeCode = res.data.data.code;
14+
15+
await api.put("admin/attendance/expire", null, {
16+
params: { code: activeCode },
17+
});
18+
19+
console.log("기존 출석코드 자동 만료됨");
20+
} catch (error) {
21+
if (error.response?.status !== 404) {
22+
alert(
23+
"초기화 중 오류: " + (error.response?.data?.message || "서버 오류")
24+
);
25+
}
26+
}
27+
};
28+
29+
expireIfNeeded();
30+
}, []);
931
// 출석코드 생성
1032
const generateCode = async () => {
1133
try {

frontend/src/pages/admin/DetailManageStudent.jsx

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,51 @@ import { getStudentDetail } from "../../api/students";
66

77
const DetailManageStudent = () => {
88
const { studentId } = useParams();
9+
const numericId = Number(studentId);
910
const [student, setStudent] = useState(null);
1011

1112
useEffect(() => {
1213
const fetchStudent = async () => {
1314
try {
14-
const data = await getStudentDetail(studentId);
15+
const data = await getStudentDetail(numericId);
1516
setStudent(data);
1617
} catch (err) {
1718
console.error("학생 상세 정보 불러오기 실패:", err);
1819
}
1920
};
2021

2122
fetchStudent();
22-
}, [studentId]);
23+
}, [numericId]);
2324

2425
if (!student) return <div>loading...</div>;
2526

27+
console.log("studentId from URL:", studentId);
28+
console.log("numericId:", numericId);
29+
2630
return (
2731
<div className={style.managestudent_wrapper}>
2832
<Header />
2933
<div className={style.under_header}>
3034
<div className={style.student_card}>
31-
<h2>{student.name}</h2>
32-
<p>잔여 보증금: {student.deposit}</p>
33-
<p>보증금 방어권: {student.defence}</p>
35+
<h2 className={style.student_name}>{student.name}</h2>
36+
<div className={style.deposit_container}>
37+
<p>
38+
잔여 보증금: <p>{student.deposit}</p>
39+
</p>
40+
</div>
41+
<div className={style.defence_container}>
42+
<p>
43+
보증금 방어권: <p>{student.defence}</p>
44+
</p>
45+
</div>
3446
</div>
35-
47+
<button
48+
key={student.id || index}
49+
className={style.attendance_btn}
50+
onClick={() => navigate(`/admin/attendance/${student.id}`)}
51+
>
52+
출석 관리 <span>&gt;</span>
53+
</button>
3654
<div className={style.assignment_list}>
3755
{student.assignmentTitles.map((title, idx) => (
3856
<button key={idx} className={style.assignment_button}>

frontend/src/pages/admin/DetailManageStudent.module.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,37 @@
99
flex-direction: column;
1010
align-items: center;
1111
}
12+
.student_card {
13+
display: flex;
14+
background: #49ff24;
15+
flex-direction: column;
16+
border-radius: 9px;
17+
padding: 15px 20px;
18+
width: 300px;
19+
height: 150px;
20+
justify-content: space-around;
21+
}
22+
.student_name {
23+
font-size: 25px;
24+
font-weight: 700;
25+
}
26+
.deposit_container,
27+
.defence_container {
28+
display: flex;
29+
justify-content: space-between;
30+
font-size: 20px;
31+
font-weight: 500;
32+
}
33+
.attendance_btn {
34+
border: 1px solid #49ff24;
35+
border-radius: 9px;
36+
width: 300px;
37+
height: 40px;
38+
display: flex;
39+
align-items: center;
40+
justify-content: space-between;
41+
background-color: #333;
42+
color: #49ff24;
43+
padding: 15px;
44+
text-align: left;
45+
}

0 commit comments

Comments
 (0)