Skip to content

Commit

Permalink
feat: 즐긴 우리술 리스트 조회 api 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Leejha committed Sep 22, 2023
1 parent 1845d25 commit c7c63c2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 42 deletions.
62 changes: 20 additions & 42 deletions apps/jurumarble/src/lib/apis/drink.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { DrinkInfoSortType } from "src/types/common";
import { DrinkListResponse } from "src/types/drink";
import { baseApi } from "./http/base";
import { http } from "./http/http";

export interface GetDrinkListRequest {
page: number;
Expand All @@ -9,49 +11,8 @@ export interface GetDrinkListRequest {
sortBy: DrinkInfoSortType;
}

interface GetDrinkListResponse {
sort: Sort;
first: boolean;
last: boolean;
number: number;
numberOfElements: number;
pageable: Pageable;
size: number;
content: DrinkInfo[];
empty: boolean;
}

export interface DrinkInfo {
id: number;
name: string;
type: string;
productName: string;
alcoholicBeverage: string;
rawMaterial: string;
capacity: string;
manufactureAddress: string;
region: string;
price: string;
image: string;
latitude: number;
longitude: number;
enjoyCount: number;
}

interface Pageable {
sort: Sort;
pageNumber: number;
pageSize: number;
paged: boolean;
unpaged: boolean;
offset: number;
}
interface GetDrinkListResponse extends DrinkListResponse {}

interface Sort {
sorted: boolean;
unsorted: boolean;
empty: boolean;
}
export const getDrinkList = async (params: GetDrinkListRequest) => {
const response = await baseApi.get<GetDrinkListResponse>("api/drinks", {
params: {
Expand All @@ -71,3 +32,20 @@ export const getHotDrinkList = async () => {
const response = await baseApi.get<GetHotDrinkResponse[]>("api/drinks/hot");
return response.data;
};

interface GetEnjoyedDrinkListRequest {
page: number;
size: number;
region?: string;
}

interface GetEnjoyedDrinkListResponse extends DrinkListResponse {}

export const getEnjoyedDrinkList = async (params: GetEnjoyedDrinkListRequest) => {
const response = await http.get<GetEnjoyedDrinkListResponse>("api/drinks/enjoys", {
params: {
...params,
},
});
return response.data;
};
1 change: 1 addition & 0 deletions apps/jurumarble/src/lib/queryKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const queryKeys = {
VOTING_CHECK: "votingCheck" as const,
DETAIL_COMMENT_LIST: "commentByVoteId" as const,
DETAIL_VOTE_COUNT: "voteCountByVoteId" as const,
DRINK_STEMP_LIST: "drinkStempList" as const,
};

export const reactQueryKeys = {
Expand Down

0 comments on commit c7c63c2

Please sign in to comment.