Skip to content

Commit

Permalink
feat: 입덕 포인트 추가, 조회 api 추가 #303
Browse files Browse the repository at this point in the history
  • Loading branch information
imdaxsz committed Nov 21, 2023
1 parent 0b23a05 commit 626c0b3
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
32 changes: 32 additions & 0 deletions src/features/reviews/api/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ export interface UserEvaluation {
score: number;
}

export type AttractionType =
| "STORY"
| "CHARACTER"
| "DRAWING"
| "VOICE_ACTOR"
| "MUSIC";

export default class ReviewApi {
/** @description 리뷰 작성 요청 */
async addReview(review: AddReviewDto): Promise<void> {
Expand Down Expand Up @@ -106,4 +113,29 @@ export default class ReviewApi {
async getEvaluation(animeId: number) {
return get<UserEvaluation>(`/ratings/${animeId}`);
}

// 입덕 포인트

/** @description 입덕 포인트 남기기 */
async addAttractionPoint(
animeId: number,
attractionElements: AttractionType[],
) {
return post(`/attraction-points`, {
animeId,
attractionElements,
});
}

/** @description 입덕 포인트 존재 여부 조회 */
async getUserAttractionPointStatus(animeId: number) {
return get<{ isAttractionPoint: boolean }>(`/attraction-points/${animeId}`);
}

/** @description 리뷰 수정 시 입덕 포인트 조회 */
async getUserAttractionPoint(animeId: number, name: string) {
return get<AttractionPoint>(`/short-reviews/attraction-points`, {
params: { animeId, name },
});
}
}
30 changes: 29 additions & 1 deletion src/features/reviews/api/reviewDev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import recentReviewMock1 from "./mock/recentReview1.json";
import recentReviewMock2 from "./mock/recentReview2.json";
import recentReviewMock3 from "./mock/recentReview3.json";
import recentReviewOnlyOneMock from "./mock/recentReviewOnlyOne.json";
import { AddReviewDto, ReviewInfo, UserEvaluation } from "./review";
import {
AddReviewDto,
AttractionType,
ReviewInfo,
UserEvaluation,
} from "./review";

export default class ReviewDevApi {
/** @description 리뷰 작성 요청*/
Expand Down Expand Up @@ -71,4 +76,27 @@ export default class ReviewDevApi {
async getEvaluation(animeId: number) {
return get<UserEvaluation>(`/ratings/${animeId}`);
}

/** @description 입덕 포인트 남기기 */
async addAttractionPoint(
animeId: number,
attractionElements: AttractionType[],
) {
return post(`/attraction-points`, {
animeId,
attractionElements,
});
}

/** @description 입덕 포인트 존재 여부 조회 */
async getUserAttractionPointStatus(animeId: number) {
return get<{ isAttractionPoint: boolean }>(`/attraction-points/${animeId}`);
}

/** @description 리뷰 수정 시 입덕 포인트 조회 */
async getUserAttractionPoint(animeId: number, name: string) {
return get<AttractionPoint>(`/short-reviews/attraction-points`, {
params: { animeId, name },
});
}
}

0 comments on commit 626c0b3

Please sign in to comment.