From 47affe0941fb10ff0a0ce240362cf4328481787f Mon Sep 17 00:00:00 2001 From: hyuna Date: Wed, 28 Aug 2024 08:14:27 +0900 Subject: [PATCH] =?UTF-8?q?chore=20::=20=EC=A3=BC=EB=A7=90=EA=B8=89?= =?UTF-8?q?=EC=8B=9D=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EC=99=B8=EC=B6=9C?= =?UTF-8?q?=20=ED=83=80=EC=9E=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/afterManage/index.ts | 2 +- src/apis/outAccept/outAccept.ts | 5 +- src/apis/outList/list.ts | 16 ++-- src/apis/previousList/index.ts | 4 +- src/apis/selfStudy/index.ts | 4 +- src/app/WeekendMeals/page.tsx | 75 ++++++++----------- .../components/common/list/before/index.tsx | 8 +- src/app/outAccept/page.tsx | 18 +---- src/app/outList/page.tsx | 6 +- src/app/outList/reason/page.tsx | 8 +- 10 files changed, 60 insertions(+), 86 deletions(-) diff --git a/src/apis/afterManage/index.ts b/src/apis/afterManage/index.ts index 1ae2003..0546f22 100644 --- a/src/apis/afterManage/index.ts +++ b/src/apis/afterManage/index.ts @@ -117,7 +117,7 @@ export const GetClubList = (club: string) => { queryFn: async () => { try { const response = await instance.get( - `/attendance/alltime/club?club=${club}` + `/attendance/total-time/club?club=${club}` ); return response.data; } catch (error) { diff --git a/src/apis/outAccept/outAccept.ts b/src/apis/outAccept/outAccept.ts index 35db34d..5fb59a3 100644 --- a/src/apis/outAccept/outAccept.ts +++ b/src/apis/outAccept/outAccept.ts @@ -4,12 +4,12 @@ import apiError from "@/hook/apiError"; interface applicationDataProp { class_num: number; - end_time: string; + end: string; grade: number; id: string; num: number; reason: string; - start_time: string; + start: string; user_id: string; username: string; } @@ -58,7 +58,6 @@ export const useOutAccept = () => { mutationFn: async (param) => { try { const response = await instance.patch(`${param.type}/status`, { - type: param.type, status: param.status, ids: param.ids, }); diff --git a/src/apis/outList/list.ts b/src/apis/outList/list.ts index b5c8e68..3de10d7 100644 --- a/src/apis/outList/list.ts +++ b/src/apis/outList/list.ts @@ -6,8 +6,8 @@ interface applicationOK { id: string; username: string; user_id: string; - start_time: string; - end_time: string; + start: string; + end: string; grade: number; class_num: number; num: number; @@ -18,8 +18,8 @@ interface OutListData { id: string; user_id: string; username: string; - start_time: string; - end_time: string; + start: string; + end: string; grade: number; class_num: number; num: number; @@ -34,8 +34,8 @@ interface data { interface previousStudent { reason: string; - start_time: string; - end_time: string; + start: string; + end: string; username: string; date: string; type: "APPLICATION" | "EARLY_RETURN"; @@ -45,7 +45,7 @@ interface ReturnHomeData { id: string; user_id: string; username: string; - start_time: string; + start: string; grade: number; class_num: number; num: number; @@ -55,7 +55,7 @@ interface ReturnHomeData { interface earlyReturnHome { user_id: string; username: string; - start_time: string; + start: string; grade: number; class_num: number; num: number; diff --git a/src/apis/previousList/index.ts b/src/apis/previousList/index.ts index 78d18ee..97f770a 100644 --- a/src/apis/previousList/index.ts +++ b/src/apis/previousList/index.ts @@ -2,7 +2,7 @@ import apiError from "@/hook/apiError"; import { instance } from ".."; import { useMutation } from "@tanstack/react-query"; -interface Type { +export interface PreviousType { username: string; application_story: { reason: string; @@ -29,7 +29,7 @@ interface id { export const GetPreviousList = () => { const { handleError } = apiError(); - return useMutation({ + return useMutation({ mutationFn: async (param: id) => { try { const response = await instance.get(`story/query/${param.id}`); diff --git a/src/apis/selfStudy/index.ts b/src/apis/selfStudy/index.ts index b6b5895..2b2c9d9 100644 --- a/src/apis/selfStudy/index.ts +++ b/src/apis/selfStudy/index.ts @@ -25,7 +25,7 @@ export const CheckStatus = () => { return useMutation({ mutationFn: async (param) => { try { - await instance.patch(`/attendance/alltime/modify`, param); + await instance.patch(`/attendance/total-time/modify`, param); } catch (error) { handleError(error); } @@ -40,7 +40,7 @@ export const ClassStudentCheck = (grade: number, class_num: number) => { queryFn: async () => { try { const { data } = await instance.get( - `/attendance/alltime/grade?grade=${grade}&class_num=${class_num}` + `/attendance/total-time/grade?grade=${grade}&class_num=${class_num}` ); return data; } catch (error) { diff --git a/src/app/WeekendMeals/page.tsx b/src/app/WeekendMeals/page.tsx index 535c07b..5a6d426 100644 --- a/src/app/WeekendMeals/page.tsx +++ b/src/app/WeekendMeals/page.tsx @@ -10,24 +10,6 @@ import { BackGround } from "../components/common/background"; import { useRouter } from "next/navigation"; import { NextPage } from "next"; -interface mealcheckProp { - id: string; - name: string; - status: "OK" | "NO"; - grade: number; - class_num: number; - num: number; -} - -interface notCheckMeal { - id: string; - name: string; - status: "QUIET"; - grade: number; - class_num: number; - num: number; -} - const WeekendMeals: NextPage = () => { const router = useRouter(); const [selectGrade, setSelectGrade] = useState(1); @@ -40,12 +22,7 @@ const WeekendMeals: NextPage = () => { router.push("/WeekendMeals/all"); }; - const { data: checkMealMutate, refetch: RecheckMealMutate } = MealCheck( - selectGrade, - selectClass - ); - const { data: notCheckMealMutate, refetch: RenotCheckMealMutate } = - NotMealCheck(selectGrade, selectClass); + const { data: checkMealMutate } = MealCheck(selectGrade, selectClass); useEffect(() => { const grade = parseInt(localStorage.getItem("grade") || "1", 10); @@ -95,33 +72,30 @@ const WeekendMeals: NextPage = () => {
-
응답자
-
- 응답자의 상태는 수정할 수 없습니다. -
+
신청자
- {checkMealMutate?.map((item, index) => ( - {}} - id="" - /> - ))} + {checkMealMutate?.map( + (item, index) => + item.status === "OK" && ( + {}} + id="" + /> + ) + )}
-
미응답자
-
- 매달 5일 전까지 상태를 수정할 수 있습니다 -
+
미신청자
- {notCheckMealMutate?.map((item, index) => ( + {/* {notCheckMealMutate?.map((item, index) => ( { setEffect(effect + 1); }} /> - ))} + ))} */} + {checkMealMutate?.map( + (item, index) => + item.status === "NO" && ( + {}} + id="" + /> + ) + )}
diff --git a/src/app/components/common/list/before/index.tsx b/src/app/components/common/list/before/index.tsx index 45f94f6..da428ef 100644 --- a/src/app/components/common/list/before/index.tsx +++ b/src/app/components/common/list/before/index.tsx @@ -3,7 +3,7 @@ import Image from "next/image"; import React, { useState, useRef, useEffect } from "react"; import arrow from "@/assets/img/Icon/chevron-right.svg"; import downarrow from "@/assets/img/Icon/downarrow.svg"; -import { GetPreviousList } from "@/apis/previousList"; +import { GetPreviousList, PreviousType } from "@/apis/previousList"; import BeforeList from "./list"; import OutBedge from "./badge"; @@ -18,8 +18,8 @@ interface Type { username: string; application_story: { reason: string; - start_time: string; - end_time: string; + start: string; + end: string; date: string; type: "APPLICATION" | "EARLY_RETURN"; }[]; @@ -33,7 +33,7 @@ const PreviousList: React.FC = ({ }) => { const [isDropdownVisible, setIsDropdownVisible] = useState(false); const { mutate: getPrevious } = GetPreviousList(); - const [data, setData] = useState(); + const [data, setData] = useState(); const dropdownRef = useRef(null); const toggleDropdown = async () => { diff --git a/src/app/outAccept/page.tsx b/src/app/outAccept/page.tsx index 29d73b4..1e279bc 100644 --- a/src/app/outAccept/page.tsx +++ b/src/app/outAccept/page.tsx @@ -12,18 +12,6 @@ import { useRouter } from "next/navigation"; import { BackGround } from "../components/common/background"; import useAcceptListSelection from "@/hook/hook"; -interface applicationDataProp { - class_num: number; - end_time: string; - grade: number; - id: string; - num: number; - reason: string; - start_time: string; - user_id: string; - username: string; -} - const OutAccept = () => { const router = useRouter(); const [selectedTab, setSelectedTab] = useState(true); @@ -203,7 +191,7 @@ const OutAccept = () => { handleAcceptListClick(dataItem.id, dataItem.username) } key={index} - time={`${dataItem.start_time} ~ ${dataItem.end_time}`} + time={`${dataItem.start} ~ ${dataItem.end}`} student={getStudentString(dataItem)} why={`${dataItem.reason}`} /> @@ -214,10 +202,10 @@ const OutAccept = () => { {getClassMutate?.map((dataItem, index) => ( - handleAcceptListClick(dataItem.user_id, dataItem.username) + handleAcceptListClick(dataItem.id, dataItem.username) } key={index} - time={`${dataItem.start_time} ~`} + time={`${dataItem.start} ~`} student={`${getStudentString(dataItem)}`} why={dataItem.reason} /> diff --git a/src/app/outList/page.tsx b/src/app/outList/page.tsx index 86912a7..44714cf 100644 --- a/src/app/outList/page.tsx +++ b/src/app/outList/page.tsx @@ -20,8 +20,8 @@ import useAcceptListSelection from "@/hook/hook"; interface applicationOK { id: string; username: string; - start_time: string; - end_time: string; + start: string; + end: string; grade: number; class_num: number; num: number; @@ -103,7 +103,7 @@ const OutList = () => { onClick={() => handleAcceptListClick(data.id, data.username)} id={data.id} key={index} - returnTime={data.end_time} + returnTime={data.end} student={getStudentString(data)} reason={data.reason} /> diff --git a/src/app/outList/reason/page.tsx b/src/app/outList/reason/page.tsx index eec02b7..bdcc934 100644 --- a/src/app/outList/reason/page.tsx +++ b/src/app/outList/reason/page.tsx @@ -12,8 +12,8 @@ interface OutListData { id: string; user_id: string; username: string; - start_time: string; - end_time: string; + start: string; + end: string; grade: number; class_num: number; num: number; @@ -24,7 +24,7 @@ interface HomeData { id: string; user_id: string; username: string; - start_time: string; + start: string; grade: number; class_num: number; num: number; @@ -79,7 +79,7 @@ const Reason = () => { {(selectedTab ? outData : returnHomeData).map((item, index) => (