From 626c0b343cf104670cdf6b59aacf21bf28a4aac4 Mon Sep 17 00:00:00 2001 From: mihee Date: Tue, 21 Nov 2023 22:32:14 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9E=85=EB=8D=95=20=ED=8F=AC=EC=9D=B8?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80,=20=EC=A1=B0=ED=9A=8C=20api=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20#303?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/reviews/api/review.ts | 32 +++++++++++++++++++++++++++ src/features/reviews/api/reviewDev.ts | 30 ++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/src/features/reviews/api/review.ts b/src/features/reviews/api/review.ts index 57650bf2..6304cf7f 100644 --- a/src/features/reviews/api/review.ts +++ b/src/features/reviews/api/review.ts @@ -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 { @@ -106,4 +113,29 @@ export default class ReviewApi { async getEvaluation(animeId: number) { return get(`/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(`/short-reviews/attraction-points`, { + params: { animeId, name }, + }); + } } diff --git a/src/features/reviews/api/reviewDev.ts b/src/features/reviews/api/reviewDev.ts index eccb84a8..861476ec 100644 --- a/src/features/reviews/api/reviewDev.ts +++ b/src/features/reviews/api/reviewDev.ts @@ -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 리뷰 작성 요청*/ @@ -71,4 +76,27 @@ export default class ReviewDevApi { async getEvaluation(animeId: number) { return get(`/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(`/short-reviews/attraction-points`, { + params: { animeId, name }, + }); + } }