Skip to content

Commit

Permalink
Merge pull request #163 from MZ-OFFISSU/refactor/162_v2-migration
Browse files Browse the repository at this point in the history
Refactor/162 v2 migration
  • Loading branch information
Jun99uu authored May 3, 2024
2 parents 64ae3d7 + c00d0e6 commit 6c634eb
Show file tree
Hide file tree
Showing 40 changed files with 116 additions and 113 deletions.
2 changes: 1 addition & 1 deletion TERMTERM/@types/Folder.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare module "Folder" {
export type FolderDetail = {
bookmarked: "YES" | null;
bookmarked: "YES" | "NO";
categories: string[];
comments: FolderTermComment[];
description: string;
Expand Down
4 changes: 2 additions & 2 deletions TERMTERM/src/api/AuthApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AuthApi {
): Promise<AuthResponse> => {
const data = await axios({
method: "post",
url: `${BASE_URL}/v1/auth/${oauth}`,
url: `${BASE_URL}/v2/auth/${oauth}`,
headers: {
"auth-code": code,
},
Expand All @@ -26,7 +26,7 @@ class AuthApi {
): Promise<AuthResponse> => {
const data = await axios({
method: "post",
url: `${BASE_URL}/v1/apple-callback`,
url: `${BASE_URL}/v2/apple-callback`,
params: {
code: code,
id_token: token,
Expand Down
12 changes: 6 additions & 6 deletions TERMTERM/src/api/CommentApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@ import { post, put } from "./AxiosCreate";
class CommentApi {
/**나만의 용어 신청 작성 후 등록 */
registerComment = async (comment: CommentInput): Promise<string> => {
const data = await post<string>(`/v1/comment`, comment);
const data = await post<string>(`/v2/s/comment`, comment);
return data;
};

/** (관리자) 나만의 용어 신청 승인 */
acceptComment = async (id: number): Promise<string> => {
const data = await put<string>(`/v1/comment/accept/${id}`);
const data = await put<string>(`/v2/s/comment/accept/${id}`);
return data;
};

/** 코멘트 좋아요 취소 */
dislikeComment = async (id: number): Promise<string> => {
const data = await put<string>(`/v1/comment/dislike/${id}`);
const data = await put<string>(`/v2/s/comment/dislike/${id}`);
return data;
};

/** 코멘트 좋아요 */
likeComment = async (id: number): Promise<string> => {
const data = await put<string>(`/v1/comment/like/${id}`);
const data = await put<string>(`/v2/s/comment/like/${id}`);
return data;
};

/** 코멘트 신고하기 */
reportComment = async (report: Report): Promise<string> => {
const data = await post<string>(`/v1/comment/report`, report);
const data = await post<string>(`/v2/s/comment/report`, report);
return data;
};

/** 코멘트 신고 승인 */
acceptReport = async (id: number): Promise<string> => {
const data = await put<string>(`/v1/comment/report/completed/${id}`);
const data = await put<string>(`/v2/s/comment/report/completed/${id}`);
return data;
};
}
Expand Down
12 changes: 6 additions & 6 deletions TERMTERM/src/api/CurationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ import { get, post, put } from "./AxiosCreate";
class CurationApi {
/** 아카이브한 큐레이션 리스트 */
getArchivedCuration = async (): Promise<CurationPreview[]> => {
const data = await get<CurationPreview[]>(`/v1/curation/archived`);
const data = await get<CurationPreview[]>(`/v2/s/curation/archived`);
return data;
};

/** 특정 큐레이션 북마크하기 */
curationBookmark = async (id: number): Promise<string> => {
const data = await put<string>(`/v1/curation/bookmark/${id}`);
const data = await put<string>(`/v2/s/curation/bookmark/${id}`);
return data;
};

/** 특정 큐레이션의 상세 정보 */
getCurationDetail = async (id: number): Promise<CurationDetail> => {
const data = await get<CurationDetail>(`/v1/curation/detail/${id}`);
const data = await get<CurationDetail>(`/v2/s/curation/detail/${id}`);
return data;
};

/** 카테고리별 큐레이션 리스트 */
getCurationListByCategory = async (
category: Category
): Promise<MoreRecommendedCuration[]> => {
const data = await get<MoreRecommendedCuration[]>(`/v1/curation/list`, {
const data = await get<MoreRecommendedCuration[]>(`/v2/s/curation/list`, {
params: {
category: category,
},
Expand All @@ -40,13 +40,13 @@ class CurationApi {

/** 큐레이션 등록 */
registerCuration = async (content: CreateCuration): Promise<string> => {
const data = await post<string>(`/v1/curation/register`, content);
const data = await post<string>(`/v2/admin/curation/register`, content);
return data;
};

/** 큐레이션 북마크 소 */
cancelBookmarkCuration = async (id: number): Promise<string> => {
const data = await put<string>(`/v1/curation/unbookmark/${id}`);
const data = await put<string>(`/v2/s/curation/unbookmark/${id}`);
return data;
};
}
Expand Down
22 changes: 11 additions & 11 deletions TERMTERM/src/api/FolderApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,43 @@ import { get, post, put, remove } from "./AxiosCreate";
class FolderApi {
/** 폴더 삭제 */
removeFolder = async (id: number): Promise<string> => {
const data = await remove<string>(`/v1/folder/${id}`);
const data = await remove<string>(`/v2/s/folder/${id}`);
return data;
};

/** 폴더 상세 페이지_하나씩 보기 */
getEachFolderDetail = async (id: number): Promise<FolderDetail[]> => {
const data = await get<FolderDetail[]>(`/v1/folder/detail/each/${id}`);
const data = await get<FolderDetail[]>(`/v2/s/folder/detail/each/${id}`);
return data;
};

/** 폴더 상세 페이지_모아서 보기 */
getSumFolderDetail = async (id: number): Promise<FolderPreview> => {
const data = await get<FolderPreview>(`/v1/folder/detail/sum/${id}`);
const data = await get<FolderPreview>(`/v2/s/folder/detail/sum/${id}`);
return data;
};

/** 폴더 정보 수정 */
putFolderInfo = async (folderInfo: EditFolder): Promise<string> => {
const data = await put<string>(`/v1/folder/info`, folderInfo);
const data = await put<string>(`/v2/s/folder/info`, folderInfo);
return data;
};

/** 내 폴더 리스트 */
getMyFolderList = async (): Promise<UserFolderList[]> => {
const data = await get<UserFolderList[]>(`/v1/folder/list`);
const data = await get<UserFolderList[]>(`/v2/s/folder/list`);
return data;
};

/** 폴더 생성 */
registerFolder = async (folderInfo: CreateFolder): Promise<FolderInfo> => {
const data = await post<FolderInfo>(`/v1/folder/new`, folderInfo);
const data = await post<FolderInfo>(`/v2/s/folder/new`, folderInfo);
return data;
};

/** 폴더 관련 정보 모달 */
getFolderModal = async (): Promise<FolderModal> => {
const data = await get<FolderModal>(`/v1/folder/related-info`);
const data = await get<FolderModal>(`/v2/s/folder/related-info`);
return data;
};

Expand All @@ -60,23 +60,23 @@ class FolderApi {
folderIds: number[],
termId: number
): Promise<string> => {
const data = await post<string>(`/v1/folder/term`, { folderIds, termId });
const data = await post<string>(`/v2/s/folder/term`, { folderIds, termId });
return data;
};

/** 폴더에 용어 삭제 (아카이빙 해제) */
removeTermInFolder = async (
cancelArchiveInfo: CancelArchive
): Promise<string> => {
const data = await remove<string>(`/v1/folder/term`, {
const data = await remove<string>(`/v2/s/folder/term`, {
data: cancelArchiveInfo,
});
return data;
};

/** 홈 화면 - 아카이빙 한 단어들 중 10개를 랜덤으로 뽑아 리턴 */
getRandomArchiveTerms = async (): Promise<RandomTerms[]> => {
const data = await get<RandomTerms[]>(`/v1/folder/term/random-10`);
const data = await get<RandomTerms[]>(`/v2/s/folder/term/random-10`);
return data;
};

Expand All @@ -86,7 +86,7 @@ class FolderApi {
termId: number
): Promise<IncludeWord> => {
const data = await get<IncludeWord>(
`/v1/folder/${folderId}/including/${termId}`
`/v2/s/folder/${folderId}/including/${termId}`
);
return data;
};
Expand Down
8 changes: 4 additions & 4 deletions TERMTERM/src/api/HomeApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ import { get, post, remove } from "./AxiosCreate";
class HomeApi {
/** 서브타이틀 리스트 */
getSubTitleList = async (): Promise<SubTitles> => {
const data = await get<SubTitles>(`/v1/home/subtitle`);
const data = await get<SubTitles>(`/v2/home/subtitle`);
return data;
};

/** 서브타이틀 등록 (관리자용) */
registerSubTitle = async (): Promise<string> => {
const data = await post<string>(`/v1/home/subtitle`);
const data = await post<string>(`/v2/home/subtitle`);
return data;
};

/** 서브타이틀 삭제 (관리자용) */
removeSubTitle = async (): Promise<string> => {
const data = await remove<string>(`/v1/home/subtitle`);
const data = await remove<string>(`/v2/home/subtitle`);
return data;
};

/** 홈 화면 상단 UX Writing */
getUxWriting = async (): Promise<HomeUxWriting> => {
const data = await get<HomeUxWriting>(`/v1/home/title`);
const data = await get<HomeUxWriting>(`/v2/s/home/title`);
return data;
};
}
Expand Down
6 changes: 3 additions & 3 deletions TERMTERM/src/api/InquiryApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import { post, put } from "./AxiosCreate";
class InquiryApi {
/** 문의사항 접수 */
postInquiry = async (inquiry: InquiryContent): Promise<string> => {
const data = await post<string>(`/v1/inquiry`, inquiry);
const data = await post<string>(`/v2/inquiry`, inquiry);
return data;
};

/** 문의사항 답변 완료 */
completeInquiry = async (id: number): Promise<string> => {
const data = await put<string>(`/v1/inquiry/to-completed/${id}`);
const data = await put<string>(`/v2/inquiry/to-completed/${id}`);
return data;
};

/** 문의사항 대기 중 */
waitingInquiry = async (id: number): Promise<string> => {
const data = await put<string>(`/v1/inquiry/to-waiting/${id}`);
const data = await put<string>(`/v2/inquiry/to-waiting/${id}`);
return data;
};
}
Expand Down
22 changes: 11 additions & 11 deletions TERMTERM/src/api/MemberApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ import { get, put, remove } from "./AxiosCreate";
class MemberApi {
/** 사용자 정보 받아오기 */
getInfo = async (): Promise<MemberInfo> => {
const data = await get<MemberInfo>(`/v1/member/info`);
const data = await get<MemberInfo>(`/v2/s/member/info`);
return data;
};

/** 사용자 기본 정보 수정하기 */
putInfo = async (modifyInfo: ModifiedMemberInfo): Promise<string> => {
const data = await put<string>(`/v1/member/info`, modifyInfo);
const data = await put<string>(`/v2/s/member/info`, modifyInfo);
return data;
};

/** 사용자 관심사 수정하기 */
putCategory = async (categories: string[]): Promise<string> => {
const data = await put<string>(`/v1/member/info/category`, {
const data = await put<string>(`/v2/s/member/info/category`, {
categories: categories,
});
return data;
};

/** 사용자 닉네임 중복 검사하기 */
nicknameDoubleCheck = async (nickname: string): Promise<string> => {
const data = await get<string>(`/v1/member/nickname/check`, {
const data = await get<string>(`/v2/member/nickname/check`, {
params: {
nickname: nickname,
},
Expand All @@ -34,35 +34,35 @@ class MemberApi {

/** 프로필 이미지 받아오기 */
getProfileImage = async (): Promise<string> => {
const data = await get<string>(`/v1/member/info/profile-image`);
const data = await get<string>(`/v2/s/member/info/profile-image`);
return data;
};

/** 프로필 이미지 제거하기 */
removeProfileImage = async (): Promise<string> => {
const data = await remove<string>(`/v1/member/info/profile-image`);
const data = await remove<string>(`/v2/s/member/info/profile-image`);
return data;
};

/** S3로 이미지 업데이트할 수 있는 URL 발급.
* 발급 이후 하단의 syncPresignedUrl로 API 요청을 보내야함
*/
getPresignedUrl = async (): Promise<string> => {
const data = await get<string>(
`/v1/member/info/profile-image/presigned-url`
putPresignedUrl = async (): Promise<string> => {
const data = await put<string>(
`/v2/s/member/info/profile-image/presigned-url`
);
return data;
};

/** presigned url로 이미지 업데이트 후, 여기로 동기화 */
syncPresignedUrl = async (): Promise<string> => {
const data = await get<string>(`/v1/member/info/profile-image/sync`);
const data = await get<string>(`/v2/s/member/info/profile-image/sync`);
return data;
};

/** 회원 탈퇴 */
withdraw = async (): Promise<string> => {
const data = await get<string>(`/v1/member/withdraw`);
const data = await put<string>(`/v2/s/member/withdraw`);
return data;
};
}
Expand Down
8 changes: 4 additions & 4 deletions TERMTERM/src/api/PointApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ import { PointHistory } from "Point";
class PointApi {
/** 현재 포인트 가져오기 */
getCurPoint = async (): Promise<number> => {
const data = await get<number>("/v1/point/current");
const data = await get<number>("/v2/s/point/current");
return data;
};

/** (페이지네이션) 포인트 히스토리 조회 */
getPointHistory = async (curPage: number): Promise<PointHistory> => {
const data = await get<PointHistory>(
`/v1/point/history?page=${curPage}&size=5`
`/v2/s/point/history?page=${curPage}&size=5`
);
return data;
};

/** 큐레이션 구매 */
buyCuration = async (id: number) => {
await put(`/v1/point/pay/curation/${id}`);
await put(`/v2/s/point/pay/curation/${id}`);
};

/** 폴더 한도 1개 추가 (폴더 구매) */
buyFolder = async () => {
await put(`/v1/point/pay/folder`);
await put(`/v2/s/point/pay/folder`);
};
}

Expand Down
8 changes: 4 additions & 4 deletions TERMTERM/src/api/QuizApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { post, get } from "./AxiosCreate";
class QuizApi {
/** 데일리 퀴즈 */
getDailyQuiz = async (): Promise<QuizDetail[]> => {
const data = await get<QuizDetail[]>(`/v1/quiz/daily`);
const data = await get<QuizDetail[]>(`/v2/s/quiz/daily`);
return data;
};

/** 용어 퀴즈 리뷰 */
getFinalQuizReview = async (): Promise<QuizReviewDetail[]> => {
const data = await get<QuizReviewDetail[]>(`/v1/quiz/final-quiz-review`);
const data = await get<QuizReviewDetail[]>(`/v2/s/quiz/final-quiz-review`);
return data;
};

Expand All @@ -23,13 +23,13 @@ class QuizApi {

/** 용어 복습 퀴즈 */
getReviewQuiz = async (): Promise<QuizDetail[]> => {
const data = await get<QuizDetail[]>(`/v1/quiz/review`);
const data = await get<QuizDetail[]>(`/v2/s/quiz/review`);
return data;
};

/** 데일리 퀴즈 응시 여부 - 홈 화면 */
getDailyQuizStatus = async (): Promise<QuizStatus> => {
const data = await get<QuizStatus>(`/v1/quiz/status`);
const data = await get<QuizStatus>(`/v2/s/quiz/status`);
return data;
};
}
Expand Down
Loading

0 comments on commit 6c634eb

Please sign in to comment.