Skip to content

Commit

Permalink
Merge pull request #99 from MoneyMakersClub/feature/#88
Browse files Browse the repository at this point in the history
Feature/#88 | 통계, 책정보 관련 api 연결
  • Loading branch information
yoonjin-C authored Nov 18, 2024
2 parents 2e8f903 + 9c837af commit 62b8ce4
Show file tree
Hide file tree
Showing 42 changed files with 1,006 additions and 279 deletions.
Binary file added bookduck/public/assets/items/hairband.glb
Binary file not shown.
Binary file added bookduck/public/assets/items/safetyhat.glb
Binary file not shown.
Binary file added bookduck/public/assets/items/spanner.glb
Binary file not shown.
8 changes: 6 additions & 2 deletions bookduck/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import BookInfoPage from "./pages/BookInfoPage/BookInfoPage";
import UserCommentPage from "./pages/BookInfoPage/UserCommentPage";
import BookInfoAddedPage from "./pages/BookInfoPage/BoonInfoAddedPage";
import StatisticsPage from "./pages/StatisticsPage/StatisticsPage";
import CharacterExportPage from "./pages/StatisticsPage/CharacterExportPage";
import CardDecorationPage from "./pages/RecordingPage/CardDecorationPage";
import LibraryPage from "./pages/LibraryPage/LibraryPage";
import EnterBookCasePage from "./pages/LibraryPage/EnterBookCasePage";
Expand Down Expand Up @@ -49,15 +50,18 @@ function App() {
<Route path="/setting" element={<SettingPage />} />
<Route path="/notification" element={<NotificationPage />} />
<Route path="/statistics" element={<StatisticsPage />} />

<Route
path="/statistics/export/character"
element={<CharacterExportPage />}
/>
<Route path="/" element={<Navigate to="/home" replace />} />
<Route path="/api/oauth" element={<OAuthRedierctPage />} />
<Route path="/home" element={<MainPage />} />
<Route path="/friend" element={<FriendListPage />} />
<Route path="/search" element={<SearchMainPage />} />
<Route path="/recording" element={<RecordingPage />} />
<Route path="/search/register" element={<RegisterPage />} />
<Route path="/info/book" element={<BookInfoPage />} />
<Route path="/info/book/:bookinfoId" element={<BookInfoPage />} />
<Route path="/info/book/user" element={<BookInfoAddedPage />} />
<Route path="/info/book/comment" element={<UserCommentPage />} />
<Route path="/selectcard" element={<SelectCardPage />} />
Expand Down
130 changes: 130 additions & 0 deletions bookduck/src/api/bookinfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { apiAuth } from "./api";
import { get, post, patch, put, del } from "./example";

// 한줄평,별점 목록 조회
export const getBookInfo = async ({ bookinfoId }) => {
try {
const res = await get(`/bookinfo/${bookinfoId}`);
console.log("책정보 조회 성공: ", res);
return res;
} catch (error) {
console.error("책정보 조회 실패: ", error);
throw error;
}
};

// 한줄평,별점 목록 조회
export const getOneLineRatingsInfo = async ({
bookinfoId,
orderBy,
page,
size,
}) => {
try {
// Query Parameter 생성 (값이 존재하는 경우에만 추가)
const queryParams = new URLSearchParams();
if (orderBy) queryParams.append("orderBy", orderBy);
if (page) queryParams.append("page", page);
if (size) queryParams.append("size", size);

// 최종 URL
const url = `/bookinfo/${bookinfoId}/onelineratings${
queryParams.toString() ? `?${queryParams}` : ""
}`;

const res = await get(url);
console.log("한줄평 목록 조회 성공: ", res);
return res;
} catch (error) {
console.error("한줄평 목록 조회 실패: ", error);
throw error;
}
};
// 별점 등록 및 수정
export const enrollRating = async (userbookId, rating) => {
const url = `books/${userbookId}/rating`;
const data = { rating };
try {
const res = await patch(url, data);
console.log("별점 등록 성공: ", res);
return res?.data;
} catch (error) {
console.error("별점 등록 실패:", error);
throw error;
}
};

//별점 삭제
export const deleteRating = async (userbookId) => {
const url = `books/${userbookId}/rating`;
try {
const res = await del(url);
console.log("별점 삭제 성공: ", res);
} catch (error) {
console.error("별점 삭제 실패: ", error);
throw error;
}
};

//한줄평 생성
export const enrollOneLine = async (userBookId, oneLineContent) => {
const url = `onelines`;
const data = { oneLineContent, userBookId };
try {
const res = await post(url, data);
console.log("한줄평 등록 성공: ", res);
return res?.data;
} catch (error) {
console.error("한줄평 등록 실패:", error);
throw error;
}
};
// 한줄평 수정
export const editOneLine = async (onelineId, oneLineContent) => {
const url = `onelines/${onelineId}`;
const data = { oneLineContent };
try {
const res = await put(url, data);
console.log("한줄평 수정 성공: ", res);
return res?.data;
} catch (error) {
console.error("한줄평 수정 실패:", error);
throw error;
}
};
//한줄평 삭제
export const deleteOneLine = async (onelineId) => {
const url = `onelines/${onelineId}`;
try {
const res = await del(url);
console.log("한줄평 삭제 성공: ", res);
} catch (error) {
console.error("한줄평 삭제 실패: ", error);
throw error;
}
};

//한줄평 좋아요
export const enrollLike = async (onelineId) => {
const url = `onelines/${onelineId}/like`;
try {
const res = await post(url);
console.log("한줄평 좋아요 성공: ", res);
return res;
} catch (error) {
console.error("한줄평 좋아요 실패:", error);
throw error;
}
};

//한줄평 좋아요 삭제
export const deleteLike = async (onelineId) => {
const url = `onelines/${onelineId}/like`;
try {
const res = await del(url);
console.log("한줄평 좋아요 삭제 성공: ", res);
} catch (error) {
console.error("한줄평 좋아요 삭제 실패: ", error);
throw error;
}
};
38 changes: 38 additions & 0 deletions bookduck/src/api/character.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { apiAuth } from "./api";
import { get, post, patch, put, del } from "./example";

// 유저 정보 조회 - 닉네임, 기록 수
export const getUserInfo = async (userId) => {
try {
const res = await get(`/users/${userId}`);
console.log("유저 정보 조회 성공: ", res);
return res;
} catch (error) {
console.error("유저 정보 조회 실패: ", error);
throw error;
}
};

// 유저 레벨 정보 조회
export const getUserLevelInfo = async (userId) => {
try {
const res = await get(`/users/${userId}/growth`);
console.log("유저 레벨 정보 조회 성공: ", res);
return res;
} catch (error) {
console.error("유저 레벨 정보 조회 실패: ", error);
throw error;
}
};

// 캐릭터 아이템 조회
export const getItemLists = async () => {
try {
const res = await get(`/useritems`);
console.log("아이템 리스트 조회 성공: ", res);
return res;
} catch (error) {
console.error("아이템 리스트 조회 실패: ", error);
throw error;
}
};
26 changes: 26 additions & 0 deletions bookduck/src/api/statistics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { apiAuth } from "./api";
import { get, post, patch, put, del } from "./example";

// 유저 정보 조회 - 닉네임, 기록 수
export const getUserInfo = async (userId) => {
try {
const res = await get(`/users/${userId}`);
console.log("유저 정보 조회 성공: ", res);
return res;
} catch (error) {
console.error("유저 정보 조회 실패: ", error);
throw error;
}
};

// 유저 독서 리포트 조회 - 통계
export const getUserStatisticsInfo = async (userId) => {
try {
const res = await get(`/users/${userId}/statistics`);
console.log("유저 통계 정보 조회 성공: ", res);
return res;
} catch (error) {
console.error("유저 통계 정보 조회 실패: ", error);
throw error;
}
};
5 changes: 5 additions & 0 deletions bookduck/src/assets/bookinfoPage/heart-no.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions bookduck/src/assets/bookinfoPage/heart-yes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions bookduck/src/assets/bookinfoPage/star-half.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions bookduck/src/assets/bookinfoPage/star-small-half.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions bookduck/src/assets/bookinfoPage/star-small-yes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 62b8ce4

Please sign in to comment.