diff --git a/components/ui/Header.tsx b/components/ui/Header.tsx index f2e6447..e01d308 100644 --- a/components/ui/Header.tsx +++ b/components/ui/Header.tsx @@ -1,142 +1,108 @@ "use client"; -import { useGetLoginState, usePostLogout } from "@/lib/api/hooks/SessionHook"; -// import { useGetMyInfo } from "@/lib/api/hooks/memberHook"; + +import SImage from "@/components/ui/Image"; +import { Input } from "@/components/ui/Input"; +import { usePostLogout } from "@/lib/api/hooks/SessionHook"; +import { useGetMembersSession } from "@/lib/api/hooks/memberHook"; import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; -import React, { useState } from "react"; -import SImage from "./Image"; -import { Input } from "./Input"; -import { LinkText } from "./Text"; - -// const PersonalSection = () => { -// // const { data: isLogin } = useGetLoginState(); -// const [showMenu, setShowMenu] = useState(false); -// const { mutate: logout } = usePostLogout(); -// // TODO(Yejin0O0): 백엔드에 세션 확인하는 api 만들어달라고 한 후 로직 바꾸기 ( api 직접 만드는 것은 좋은 방법이 아님 ) -// // const { data } = useGetMyInfo(!!isLogin?.loggedIn); -// // const clubId = data?.club_member_my_page_response?.club_id || null; -// const router = useRouter(); - -// const handleProfileClick = () => { -// setShowMenu(!showMenu); -// }; +import type { ReactNode } from "react"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "./dropdown-menu"; -// const handleLogout = () => { -// logout(undefined, { -// onSuccess: () => { -// router.push("/"); -// }, -// }); -// }; +function Header() { + const path = usePathname(); + const router = useRouter(); + const { data, isLoading } = useGetMembersSession(); -// if (!isLogin?.loggedIn) { -// return ( -//
-// -// 동호회 만들기 -// -// -// Login -// -//
-// ); -// } + const { mutate: logout } = usePostLogout(); -// return ( -//
-// {!clubId ? ( -// -// 동호회 만들기 -// -// ) : null} + const handleLogout = () => { + if (confirm("정말로 로그아웃 하시겠습니까?")) { + logout(undefined, { + onSuccess: () => { + router.push("/"); + }, + }); + } + }; -// + const getActiveStyle = (linkPath: string) => { + let baseClass = + "cursor-pointer hover:text-primary transition-colors duration-300 "; + if ( + path === linkPath || + (linkPath === "/club" && path.startsWith("/club")) + ) { + baseClass += "text-primary"; + return baseClass; + } + baseClass += "text-gray-400"; + return baseClass; + }; -// {showMenu && ( -//
-// {clubId && ( -//
-// -// 내 동호회 -// -//
-// )} -//
-// -// 마이페이지 -// -//
-//
-// -//
-//
-// )} -//
-// ); -// }; + let userMenu: ReactNode; + if (isLoading) { + userMenu = null; + } else if (data) { + userMenu = ( + + + + + + + 마이페이지 + + + 로그아웃 + + + + ); + } else { + userMenu = ( + +

로그인

+ + ); + } -function Header() { - const path = usePathname(); return ( -
- -
LOGO
- -
- {/* {path === "/" && ( -
- -
- )} */} - {/* */} +
+
+ +
LOGO
+ + +
+
+
+ +
+ {userMenu}
); } - export default Header; diff --git a/lib/api/functions/memberFn.ts b/lib/api/functions/memberFn.ts index 8a7dbb2..084f9f0 100644 --- a/lib/api/functions/memberFn.ts +++ b/lib/api/functions/memberFn.ts @@ -1,46 +1,21 @@ import type { components } from "@/schemas/schema"; +import type { GetMemberSessionResponse } from "@/types/memberTypes"; +import restClient from "../restClient"; -// type MemberIsClubMemberResponse = -// components["schemas"]["MemberIsClubMemberResponse"]; -// type MemberMyPageResponse = components["schemas"]["MemberMyPageResponse"]; -// type MemberUpdateRequest = components["schemas"]["MemberUpdateRequest"]; -// type MemberResponse = components["schemas"]["MemberResponse"]; +type MemberMyPageResponse = + components["schemas"]["CommonResponseMemberMyPageResponse"]; type MemberMatchRecord = components["schemas"]["MatchResultResponse"]; const BASE_URL = `${process.env.NEXT_PUBLIC_BASE_URL}`; -// export const getIsClubMember = -// async (): Promise => { -// const response = await fetch(`${BASE_URL}/members/is-club-member`, { -// method: "GET", -// headers: { -// "Content-Type": "application/json", -// }, -// credentials: "include", -// }); +export const getMembersSession = + async (): Promise => { + return restClient.get("/members/session"); + }; -// if (!response.ok) { -// throw new Error("멤버가 클럽에 속해있는지 조회할 수 없습니다."); -// } - -// return response.json(); -// }; - -// export const getMembersMyPage = async (): Promise => { -// const response = await fetch(`${BASE_URL}/members/myPage`, { -// method: "GET", -// headers: { -// "Content-Type": "application/json", -// }, -// credentials: "include", -// }); - -// if (!response.ok) { -// throw new Error("내 정보 조회에 실패하였습니다."); -// } - -// return response.json(); -// }; +export const getMembersMyPage = async (): Promise => { + return restClient.get("/members/myPage"); +}; export const postMembersProfileImage = async ( profileImage: FormData, diff --git a/lib/api/hooks/SessionHook.ts b/lib/api/hooks/SessionHook.ts index 7224266..e1c9b8b 100644 --- a/lib/api/hooks/SessionHook.ts +++ b/lib/api/hooks/SessionHook.ts @@ -15,7 +15,7 @@ export const usePostLogout = () => { mutationFn: postLogout, onSuccess: () => { queryClient.invalidateQueries({ queryKey: ["loginState"] }); - queryClient.invalidateQueries({ queryKey: ["myInfo"] }); + queryClient.invalidateQueries({ queryKey: ["mySession"] }); }, onError: (error: Error) => alert(error), }); diff --git a/lib/api/hooks/memberHook.ts b/lib/api/hooks/memberHook.ts index 4ebfff3..162ee73 100644 --- a/lib/api/hooks/memberHook.ts +++ b/lib/api/hooks/memberHook.ts @@ -1,27 +1,35 @@ import type { components } from "@/schemas/schema"; +import type { + GetMemberSessionData, + MemberMyPageData, +} from "@/types/memberTypes"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { // getIsClubMember, getMembersMatchRecord, - // getMembersMyPage, + getMembersMyPage, + getMembersSession, postMembersProfileImage, // putMembersProfileImage, } from "../functions/memberFn"; +import useQueryWithToast from "./useQueryWithToast"; -type MemberImageUpdate = components["schemas"]["MemberUpdateRequest"]; +export const useGetMembersSession = () => { + return useQuery({ + queryKey: ["mySession"], + queryFn: async () => { + const result = await getMembersSession(); -// export const useGetIsClubMember = () => { -// return useQuery({ -// queryKey: ["isClubMemberData"], -// queryFn: getIsClubMember, -// }); -// }; + if (result.result === "FAIL") { + return null; + } + return result.data; + }, + }); +}; // export const useGetMembersMyPage = () => { -// return useQuery({ -// queryKey: ["myPageData"], -// queryFn: getMembersMyPage, -// }); +// return useQueryWithToast(["myPage"], getMembersMyPage); // }; // export const useGetMyInfo = (isEnabled: boolean) => { diff --git a/lib/api/hooks/useQueryWithToast.ts b/lib/api/hooks/useQueryWithToast.ts index 2275b28..6a5ef2f 100644 --- a/lib/api/hooks/useQueryWithToast.ts +++ b/lib/api/hooks/useQueryWithToast.ts @@ -1,76 +1,13 @@ "use client"; import { useToast } from "@/hooks/use-toast"; +import type { ErrorCode } from "@/types/errorCode"; import { useQuery } from "@tanstack/react-query"; import { useEffect } from "react"; -// type CommonResponse = -// | { -// result: "SUCCESS"; -// data: T; -// } -// | { -// result: "FAIL"; -// error_code: string; -// error_message_for_log: string; -// error_message_for_client: string; -// }; - interface CommonResponse { result?: "SUCCESS" | "FAIL"; data?: T; - error_code?: - | "BAD_REQUEST" - | "INVALID_PARAMETER" - | "INVALID_RESOURCE" - | "MISSING_PARAMETER" - | "LIMIT_EXCEEDED" - | "OUT_OF_RANGE" - | "FILE_NOT_EXIST" - | "VALIDATION_ERROR" - | "UNAUTHORIZED" - | "FORBIDDEN" - | "ACCESS_DENIED" - | "LIMIT_EXCEEDED_403" - | "OUT_OF_RANGE_403" - | "NOT_FOUND" - | "JWT_COOKIE_NOT_FOUND" - | "RESOURCE_NOT_EXIST" - | "MEMBER_NOT_EXIST" - | "CLUB_NOT_EXIST" - | "LEAGUE_NOT_EXIST" - | "BRACKET_NOT_EXIST" - | "MATCH_NOT_EXIST" - | "SET_NOT_EXIST" - | "MEMBER_NOT_JOINED_CLUB" - | "CLUB_MEMBER_NOT_EXIST" - | "MATCH_DETAILS_NOT_EXIST" - | "IMAGE_FILE_NOT_FOUND" - | "CONFLICT" - | "ALREADY_EXIST" - | "CLUB_MEMBER_ALREADY_EXIST" - | "LEAGUE_RECRUITING_ALREADY_COMPLETED" - | "CLUB_MEMBER_ALREADY_OWNER" - | "RESOURCE_ALREADY_EXIST" - | "CLUB_NAME_ALREADY_EXIST" - | "LEAGUE_ALREADY_EXIST" - | "MATCH_ALREADY_EXIST" - | "MEMBER_ALREADY_JOINED_CLUB" - | "MEMBER_ALREADY_APPLY_CLUB" - | "LEAGUE_ALREADY_PARTICIPATED" - | "LEAGUE_NOT_PARTICIPATED" - | "LEAGUE_PARTICIPATION_ALREADY_CANCELED" - | "CLUB_MEMBER_ALREADY_BANNED" - | "DELETED" - | "INVALID_PLAYER_COUNT" - | "LEAGUE_RECRUITING_MUST_BE_COMPLETED_WHEN_BRACKET_GENERATION" - | "INSUFFICIENT_TIER" - | "ONGOING_AND_UPCOMING_LEAGUE_CANNOT_BE_PAST" - | "RECRUITMENT_END_DATE_AFTER_LEAGUE_START" // 추가된 부분 - | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" - | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" - | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" - | "INTERNAL_SERVER_ERROR" - | "SERVICE_UNAVAILABLE"; + error_code?: ErrorCode; error_message_for_log?: string; error_message_for_client?: string; } diff --git a/schemas/schema.d.ts b/schemas/schema.d.ts index 5e21a0f..7a7c7b1 100644 --- a/schemas/schema.d.ts +++ b/schemas/schema.d.ts @@ -463,6 +463,26 @@ export interface paths { patch?: never; trace?: never; }; + "/v1/members/session": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 로그인 세션을 확인합니다. + * @description 로그인 세션을 확인하여 로그인 여부를 판단할 때 사용합니다. + */ + get: operations["getMySummaryInfo"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/v1/members/myPage": { parameters: { query?: never; @@ -787,6 +807,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -860,6 +882,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -949,6 +973,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -1073,6 +1099,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -1212,6 +1240,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -1296,6 +1326,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -1391,6 +1423,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -1474,6 +1508,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -1535,6 +1571,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -1608,6 +1646,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -1687,6 +1727,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -1778,6 +1820,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -1885,6 +1929,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -1959,6 +2005,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -2025,6 +2073,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -2106,6 +2156,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -2135,6 +2187,98 @@ export interface components { participant2_name?: string; participant2_image?: string; }; + CommonResponseSimpleMemberResponse: { + /** @enum {string} */ + result?: "SUCCESS" | "FAIL"; + data?: components["schemas"]["SimpleMemberResponse"]; + /** @enum {string} */ + error_code?: + | "BAD_REQUEST" + | "INVALID_PARAMETER" + | "INVALID_RESOURCE" + | "MISSING_PARAMETER" + | "LIMIT_EXCEEDED" + | "OUT_OF_RANGE" + | "FILE_NOT_EXIST" + | "VALIDATION_ERROR" + | "UNAUTHORIZED" + | "FORBIDDEN" + | "ACCESS_DENIED" + | "LIMIT_EXCEEDED_403" + | "OUT_OF_RANGE_403" + | "NOT_FOUND" + | "JWT_COOKIE_NOT_FOUND" + | "RESOURCE_NOT_EXIST" + | "MEMBER_NOT_EXIST" + | "CLUB_NOT_EXIST" + | "LEAGUE_NOT_EXIST" + | "BRACKET_NOT_EXIST" + | "MATCH_NOT_EXIST" + | "SET_NOT_EXIST" + | "MEMBER_NOT_JOINED_CLUB" + | "CLUB_MEMBER_NOT_EXIST" + | "MATCH_DETAILS_NOT_EXIST" + | "IMAGE_FILE_NOT_FOUND" + | "CONFLICT" + | "ALREADY_EXIST" + | "CLUB_MEMBER_ALREADY_EXIST" + | "LEAGUE_RECRUITING_ALREADY_COMPLETED" + | "CLUB_MEMBER_ALREADY_OWNER" + | "RESOURCE_ALREADY_EXIST" + | "CLUB_NAME_ALREADY_EXIST" + | "LEAGUE_ALREADY_EXIST" + | "MATCH_ALREADY_EXIST" + | "MEMBER_ALREADY_JOINED_CLUB" + | "MEMBER_ALREADY_APPLY_CLUB" + | "LEAGUE_ALREADY_PARTICIPATED" + | "LEAGUE_NOT_PARTICIPATED" + | "LEAGUE_PARTICIPATION_ALREADY_CANCELED" + | "CLUB_MEMBER_ALREADY_BANNED" + | "DELETED" + | "INVALID_PLAYER_COUNT" + | "LEAGUE_RECRUITING_MUST_BE_COMPLETED_WHEN_BRACKET_GENERATION" + | "INSUFFICIENT_TIER" + | "ONGOING_AND_UPCOMING_LEAGUE_CANNOT_BE_PAST" + | "RECRUITMENT_END_DATE_AFTER_LEAGUE_START" + | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" + | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" + | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" + | "INTERNAL_SERVER_ERROR" + | "SERVICE_UNAVAILABLE"; + error_message_for_log?: string; + error_message_for_client?: string; + }; + /** @description 로그인 세션 확인 Dto */ + SimpleMemberResponse: { + /** + * @description 회원 이름 + * @example 이선우 + */ + name?: string; + /** + * @description oAuth 로그인 이메일 + * @example qosle@naver.com + */ + email?: string; + /** + * @description oAuth 제공 ID + * @example 1070449979547641023123 + * @enum {string} + */ + member_tier?: "GOLD" | "SILVER" | "BRONZE"; + /** + * @description 회원 역할 + * @example AUTHORIZATION_USER + */ + authorization?: string; + /** + * @description oAuth 제공 이미지 + * @example 1070449979547641023123 + */ + profile_image?: string; + }; /** @description ClubMember information */ ClubMemberMyPageResponse: { /** @@ -2217,6 +2361,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -2340,6 +2486,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -2401,6 +2549,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -2496,6 +2646,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -2585,6 +2737,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -2646,6 +2800,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -2806,6 +2962,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -2895,6 +3053,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -2970,6 +3130,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -3041,6 +3203,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -3137,6 +3301,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -3217,6 +3383,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -3288,6 +3456,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -3349,6 +3519,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -3427,6 +3599,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -3488,6 +3662,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -3561,6 +3737,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -3639,6 +3817,8 @@ export interface components { | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" | "INTERNAL_SERVER_ERROR" | "SERVICE_UNAVAILABLE"; error_message_for_log?: string; @@ -4374,6 +4554,26 @@ export interface operations { }; }; }; + getMySummaryInfo: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "*/*": components["schemas"]["CommonResponseSimpleMemberResponse"]; + }; + }; + }; + }; getMemberInfo: { parameters: { query?: never; diff --git a/types/errorCode.ts b/types/errorCode.ts new file mode 100644 index 0000000..adce9b4 --- /dev/null +++ b/types/errorCode.ts @@ -0,0 +1,55 @@ +export type ErrorCode = + | "BAD_REQUEST" + | "INVALID_PARAMETER" + | "INVALID_RESOURCE" + | "MISSING_PARAMETER" + | "LIMIT_EXCEEDED" + | "OUT_OF_RANGE" + | "FILE_NOT_EXIST" + | "VALIDATION_ERROR" + | "UNAUTHORIZED" + | "FORBIDDEN" + | "ACCESS_DENIED" + | "LIMIT_EXCEEDED_403" + | "OUT_OF_RANGE_403" + | "NOT_FOUND" + | "JWT_COOKIE_NOT_FOUND" + | "RESOURCE_NOT_EXIST" + | "MEMBER_NOT_EXIST" + | "CLUB_NOT_EXIST" + | "LEAGUE_NOT_EXIST" + | "BRACKET_NOT_EXIST" + | "MATCH_NOT_EXIST" + | "SET_NOT_EXIST" + | "MEMBER_NOT_JOINED_CLUB" + | "CLUB_MEMBER_NOT_EXIST" + | "MATCH_DETAILS_NOT_EXIST" + | "IMAGE_FILE_NOT_FOUND" + | "CONFLICT" + | "ALREADY_EXIST" + | "CLUB_MEMBER_ALREADY_EXIST" + | "LEAGUE_RECRUITING_ALREADY_COMPLETED" + | "CLUB_MEMBER_ALREADY_OWNER" + | "RESOURCE_ALREADY_EXIST" + | "CLUB_NAME_ALREADY_EXIST" + | "LEAGUE_ALREADY_EXIST" + | "MATCH_ALREADY_EXIST" + | "MEMBER_ALREADY_JOINED_CLUB" + | "MEMBER_ALREADY_APPLY_CLUB" + | "LEAGUE_ALREADY_PARTICIPATED" + | "LEAGUE_NOT_PARTICIPATED" + | "LEAGUE_PARTICIPATION_ALREADY_CANCELED" + | "CLUB_MEMBER_ALREADY_BANNED" + | "DELETED" + | "INVALID_PLAYER_COUNT" + | "LEAGUE_RECRUITING_MUST_BE_COMPLETED_WHEN_BRACKET_GENERATION" + | "INSUFFICIENT_TIER" + | "ONGOING_AND_UPCOMING_LEAGUE_CANNOT_BE_PAST" + | "RECRUITMENT_END_DATE_AFTER_LEAGUE_START" + | "PLAYER_LIMIT_COUNT_DECREASED_NOT_ALLOWED" + | "PLAYER_LIMIT_COUNT_MUST_BE_MULTIPLE_WHEN_DOUBLES_MATCH" + | "PLAYER_LIMIT_COUNT_MUST_BE_MORE_THAN_FOUR" + | "LEAGUE_OWNER_CANNOT_CANCEL_LEAGUE_PARTICIPATION" + | "LEAGUE_CANNOT_BE_CANCELED_WHEN_IS_NOT_RECRUITING" + | "INTERNAL_SERVER_ERROR" + | "SERVICE_UNAVAILABLE"; diff --git a/types/memberTypes.ts b/types/memberTypes.ts new file mode 100644 index 0000000..92118fe --- /dev/null +++ b/types/memberTypes.ts @@ -0,0 +1,10 @@ +import type { components } from "@/schemas/schema"; + +export type GetMemberSessionResponse = + components["schemas"]["CommonResponseSimpleMemberResponse"]; + +export type GetMemberSessionData = + components["schemas"]["SimpleMemberResponse"]; + +export type MemberImageUpdate = components["schemas"]["MemberUpdateRequest"]; +export type MemberMyPageData = components["schemas"]["MemberMyPageResponse"];