Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
749 changes: 749 additions & 0 deletions apps/web/src/apis/.bruno-cache/hashes.json

Large diffs are not rendered by default.

34 changes: 16 additions & 18 deletions apps/web/src/apis/Admin/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,34 +143,32 @@ export interface GpaListResponse {
}

export const adminApi = {
putVerifyLanguageTest: async (params: {
languageTestScoreId: string | number;
data?: VerifyLanguageTestRequest;
}): Promise<VerifyLanguageTestResponse> => {
putVerifyLanguageTest: async (params: { languageTestScoreId: string | number, data?: VerifyLanguageTestRequest }): Promise<VerifyLanguageTestResponse> => {
const res = await axiosInstance.put<VerifyLanguageTestResponse>(
`/admin/scores/language-tests/${params.languageTestScoreId}`,
params?.data,
`/admin/scores/language-tests/${params.languageTestScoreId}`, params?.data
);
return res.data;
},

getLanguageTestList: async (params: { params?: Record<string, any> }): Promise<LanguageTestListResponse> => {
const res = await axiosInstance.get<LanguageTestListResponse>(`/admin/scores/language-tests?page=1&size=10`, {
params: params?.params,
});
getLanguageTestList: async (params: { params?: Record<string, unknown> }): Promise<LanguageTestListResponse> => {
const res = await axiosInstance.get<LanguageTestListResponse>(
`/admin/scores/language-tests?page=1&size=10`, { params: params?.params }
);
return res.data;
},

putVerifyGpa: async (params: {
gpaScoreId: string | number;
data?: VerifyGpaRequest;
}): Promise<VerifyGpaResponse> => {
const res = await axiosInstance.put<VerifyGpaResponse>(`/admin/scores/gpas/${params.gpaScoreId}`, params?.data);
putVerifyGpa: async (params: { gpaScoreId: string | number, data?: VerifyGpaRequest }): Promise<VerifyGpaResponse> => {
const res = await axiosInstance.put<VerifyGpaResponse>(
`/admin/scores/gpas/${params.gpaScoreId}`, params?.data
);
return res.data;
},

getGpaList: async (params: { params?: Record<string, any> }): Promise<GpaListResponse> => {
const res = await axiosInstance.get<GpaListResponse>(`/admin/scores/gpas`, { params: params?.params });
getGpaList: async (params: { params?: Record<string, unknown> }): Promise<GpaListResponse> => {
const res = await axiosInstance.get<GpaListResponse>(
`/admin/scores/gpas`, { params: params?.params }
);
return res.data;
},
};

};
38 changes: 38 additions & 0 deletions apps/web/src/apis/Admin/apiDefinitions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type { GpaListResponse, LanguageTestListResponse, VerifyGpaRequest, VerifyGpaResponse, VerifyLanguageTestRequest, VerifyLanguageTestResponse } from './api';

export const adminApiDefinitions = {
putVerifyLanguageTest: {
method: 'PUT' as const,
path: '{{URL}}/admin/scores/language-tests/{{language-test-score-id}}' as const,
pathParams: {} as { languageTestScoreId: string | number },
queryParams: {} as Record<string, never>,
body: {} as VerifyLanguageTestRequest,
response: {} as VerifyLanguageTestResponse,
},
getLanguageTestList: {
method: 'GET' as const,
path: '{{URL}}/admin/scores/language-tests?page=1&size=10' as const,
pathParams: {} as Record<string, never>,
queryParams: {} as Record<string, unknown>,
body: {} as Record<string, never>,
response: {} as LanguageTestListResponse,
},
putVerifyGpa: {
method: 'PUT' as const,
path: '{{URL}}/admin/scores/gpas/{{gpa-score-id}}' as const,
pathParams: {} as { gpaScoreId: string | number },
queryParams: {} as Record<string, never>,
body: {} as VerifyGpaRequest,
response: {} as VerifyGpaResponse,
},
getGpaList: {
method: 'GET' as const,
path: '{{URL}}/admin/scores/gpas' as const,
pathParams: {} as Record<string, never>,
queryParams: {} as Record<string, unknown>,
body: {} as Record<string, never>,
response: {} as GpaListResponse,
},
} as const;

export type AdminApiDefinitions = typeof adminApiDefinitions;
11 changes: 6 additions & 5 deletions apps/web/src/apis/Admin/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { adminApi } from "./api";
export { default as getGpaList } from "./getGpaList";
export { default as getLanguageTestList } from "./getLanguageTestList";
export { default as putVerifyGpa } from "./putVerifyGpa";
export { default as putVerifyLanguageTest } from "./putVerifyLanguageTest";
export { adminApi } from './api';
export { adminApiDefinitions, AdminApiDefinitions } from './apiDefinitions';
export * from './getGpaList';
export * from './getLanguageTestList';
export * from './putVerifyGpa';
export * from './putVerifyLanguageTest';
121 changes: 44 additions & 77 deletions apps/web/src/apis/Auth/api.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
import { axiosInstance, publicAxiosInstance } from "@/utils/axiosInstance";
import { axiosInstance } from "@/utils/axiosInstance";

export type SignOutResponse = Record<string, never>;

export type SignOutRequest = Record<string, never>;

// Apple Auth Types
export interface RegisteredAppleAuthResponse {
isRegistered: true;
accessToken: string;
refreshToken: string;
}

export interface UnregisteredAppleAuthResponse {
isRegistered: false;
export interface AppleAuthResponse {
isRegistered: boolean;
nickname: null;
email: string;
profileImageUrl: null;
signUpToken: string;
}

export type AppleAuthResponse = RegisteredAppleAuthResponse | UnregisteredAppleAuthResponse;

export interface AppleAuthRequest {
code: string;
}
export type AppleAuthRequest = Record<string, never>;

export interface RefreshTokenResponse {
accessToken: string;
Expand All @@ -36,110 +25,88 @@ export interface EmailLoginResponse {
refreshToken: string;
}

export interface EmailLoginRequest {
email: string;
password: string;
}
export type EmailLoginRequest = Record<string, never>;

export interface EmailVerificationResponse {
signUpToken: string;
}

export interface EmailVerificationRequest {
email: string;
verificationCode: string;
}

// Kakao Auth Types
export interface RegisteredKakaoAuthResponse {
isRegistered: true;
accessToken: string;
refreshToken: string;
}
export type EmailVerificationRequest = Record<string, never>;

export interface UnregisteredKakaoAuthResponse {
isRegistered: false;
export interface KakaoAuthResponse {
isRegistered: boolean;
nickname: string;
email: string;
profileImageUrl: string;
signUpToken: string;
}

export type KakaoAuthResponse = RegisteredKakaoAuthResponse | UnregisteredKakaoAuthResponse;
export type KakaoAuthRequest = Record<string, never>;

export interface KakaoAuthRequest {
code: string;
}

export type AccountResponse = undefined;
export type AccountResponse = void;

export interface SignUpResponse {
accessToken: string;
refreshToken: string;
}

export interface SignUpRequest {
signUpToken: string;
nickname: string;
profileImageUrl: string;
preparationStatus: string;
interestedRegions: string[];
interestedCountries: string[];
}

export interface EmailSignUpRequest {
email: string;
password: string;
}

export interface EmailSignUpResponse {
signUpToken: string;
}
export type SignUpRequest = Record<string, never>;

export const authApi = {
postSignOut: async (): Promise<SignOutResponse> => {
const res = await axiosInstance.post<SignOutResponse>(`/auth/sign-out`);
postSignOut: async (params: { data?: SignOutRequest }): Promise<SignOutResponse> => {
const res = await axiosInstance.post<SignOutResponse>(
`/auth/sign-out`, params?.data
);
return res.data;
},

postAppleAuth: async (data: AppleAuthRequest): Promise<AppleAuthResponse> => {
const res = await publicAxiosInstance.post<AppleAuthResponse>(`/auth/apple`, data);
postAppleAuth: async (params: { data?: AppleAuthRequest }): Promise<AppleAuthResponse> => {
const res = await axiosInstance.post<AppleAuthResponse>(
`/auth/apple`, params?.data
);
return res.data;
},

postRefreshToken: async (): Promise<RefreshTokenResponse> => {
const res = await publicAxiosInstance.post<RefreshTokenResponse>(`/auth/reissue`);
postRefreshToken: async (params: { data?: RefreshTokenRequest }): Promise<RefreshTokenResponse> => {
const res = await axiosInstance.post<RefreshTokenResponse>(
`/auth/reissue`, params?.data
);
return res.data;
},

postEmailLogin: async (data: EmailLoginRequest): Promise<EmailLoginResponse> => {
const res = await publicAxiosInstance.post<EmailLoginResponse>(`/auth/email/sign-in`, data);
postEmailLogin: async (params: { data?: EmailLoginRequest }): Promise<EmailLoginResponse> => {
const res = await axiosInstance.post<EmailLoginResponse>(
`/auth/email/sign-in`, params?.data
);
return res.data;
},

postEmailSignUp: async (data: EmailSignUpRequest): Promise<EmailSignUpResponse> => {
const res = await publicAxiosInstance.post<EmailSignUpResponse>(`/auth/email/sign-up`, data);
postEmailVerification: async (params: { data?: EmailVerificationRequest }): Promise<EmailVerificationResponse> => {
const res = await axiosInstance.post<EmailVerificationResponse>(
`/auth/email/sign-up`, params?.data
);
return res.data;
},

postKakaoAuth: async (data: KakaoAuthRequest): Promise<KakaoAuthResponse> => {
const res = await publicAxiosInstance.post<KakaoAuthResponse>(`/auth/kakao`, data);
postKakaoAuth: async (params: { data?: KakaoAuthRequest }): Promise<KakaoAuthResponse> => {
const res = await axiosInstance.post<KakaoAuthResponse>(
`/auth/kakao`, params?.data
);
return res.data;
},

deleteAccount: async (): Promise<AccountResponse> => {
const res = await axiosInstance.delete<AccountResponse>(`/auth/quit`);
const res = await axiosInstance.delete<AccountResponse>(
`/auth/quit`
);
return res.data;
},

postSignUp: async (data: SignUpRequest): Promise<SignUpResponse> => {
// ์ž„์‹œ ์„ฑ๋ณ„, ์ƒ๋…„์›”์ผ ์ถ”๊ฐ€. API ๋ณ€๊ฒฝ ์‹œ ์‚ญ์ œ
const payload = {
...data,
birth: "2000-01-01",
gender: "PREFER_NOT_TO_SAY",
};
const res = await publicAxiosInstance.post<SignUpResponse>(`/auth/sign-up`, payload);
postSignUp: async (params: { data?: SignUpRequest }): Promise<SignUpResponse> => {
const res = await axiosInstance.post<SignUpResponse>(
`/auth/sign-up`, params?.data
);
return res.data;
},
};

};
70 changes: 70 additions & 0 deletions apps/web/src/apis/Auth/apiDefinitions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import type { AccountResponse, AppleAuthRequest, AppleAuthResponse, EmailLoginRequest, EmailLoginResponse, EmailVerificationRequest, EmailVerificationResponse, KakaoAuthRequest, KakaoAuthResponse, RefreshTokenResponse, SignOutResponse, SignUpRequest, SignUpResponse } from './api';

export const authApiDefinitions = {
postSignOut: {
method: 'POST' as const,
path: '{{URL}}/auth/sign-out' as const,
pathParams: {} as Record<string, never>,
queryParams: {} as Record<string, never>,
body: {} as Record<string, never>,
response: {} as SignOutResponse,
},
postAppleAuth: {
method: 'POST' as const,
path: '{{URL}}/auth/apple' as const,
pathParams: {} as Record<string, never>,
queryParams: {} as Record<string, never>,
body: {} as AppleAuthRequest,
response: {} as AppleAuthResponse,
},
postRefreshToken: {
method: 'POST' as const,
path: '{{URL}}/auth/reissue' as const,
pathParams: {} as Record<string, never>,
queryParams: {} as Record<string, never>,
body: {} as Record<string, never>,
response: {} as RefreshTokenResponse,
},
postEmailLogin: {
method: 'POST' as const,
path: '{{URL}}/auth/email/sign-in' as const,
pathParams: {} as Record<string, never>,
queryParams: {} as Record<string, never>,
body: {} as EmailLoginRequest,
response: {} as EmailLoginResponse,
},
postEmailVerification: {
method: 'POST' as const,
path: '{{URL}}/auth/email/sign-up' as const,
pathParams: {} as Record<string, never>,
queryParams: {} as Record<string, never>,
body: {} as EmailVerificationRequest,
response: {} as EmailVerificationResponse,
},
postKakaoAuth: {
method: 'POST' as const,
path: '{{URL}}/auth/kakao' as const,
pathParams: {} as Record<string, never>,
queryParams: {} as Record<string, never>,
body: {} as KakaoAuthRequest,
response: {} as KakaoAuthResponse,
},
deleteAccount: {
method: 'DELETE' as const,
path: '{{URL}}/auth/quit' as const,
pathParams: {} as Record<string, never>,
queryParams: {} as Record<string, never>,
body: {} as Record<string, never>,
response: {} as AccountResponse,
},
postSignUp: {
method: 'POST' as const,
path: '{{URL}}/auth/sign-up' as const,
pathParams: {} as Record<string, never>,
queryParams: {} as Record<string, never>,
body: {} as SignUpRequest,
response: {} as SignUpResponse,
},
} as const;

export type AuthApiDefinitions = typeof authApiDefinitions;
35 changes: 10 additions & 25 deletions apps/web/src/apis/Auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
export type {
AppleAuthRequest,
AppleAuthResponse,
EmailLoginRequest,
EmailLoginResponse,
EmailSignUpRequest,
EmailSignUpResponse,
KakaoAuthRequest,
KakaoAuthResponse,
SignUpRequest,
SignUpResponse,
} from "./api";
export { authApi } from "./api";

// Client-side hooks
export { default as useDeleteUserAccount } from "./deleteAccount";
export { default as usePostAppleAuth } from "./postAppleAuth";
export { default as usePostEmailAuth } from "./postEmailLogin";
export { default as usePostEmailSignUp } from "./postEmailVerification";
export { default as usePostKakaoAuth } from "./postKakaoAuth";
export { default as usePostLogout } from "./postSignOut";
export { default as usePostSignUp } from "./postSignUp";

// Server-side functions
export { postReissueToken } from "./server";
export { authApi } from './api';
export { authApiDefinitions, AuthApiDefinitions } from './apiDefinitions';
export * from './deleteAccount';
export * from './postAppleAuth';
export * from './postEmailLogin';
export * from './postEmailVerification';
export * from './postKakaoAuth';
export * from './postRefreshToken';
export * from './postSignOut';
export * from './postSignUp';
Loading
Loading