From 8233f915327d36af7a984df0604b904edfe1c5e8 Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 7 May 2025 14:50:42 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20POSTS=20->=20POSTS=5FUSER=20=EC=97=94?= =?UTF-8?q?=EB=93=9C=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/entities/post/api/post-service.ts | 22 ++++++++++++------- .../src/entities/post/model/post-interface.ts | 10 ++++----- .../src/pages/notice/ui/modify-page.tsx | 2 +- .../src/pages/notice/ui/notice-page.tsx | 6 ++--- apps/common/features/src/shared/config/api.ts | 2 +- .../features/src/widgets/post/ui/post.tsx | 2 +- 6 files changed, 24 insertions(+), 20 deletions(-) diff --git a/apps/common/features/src/entities/post/api/post-service.ts b/apps/common/features/src/entities/post/api/post-service.ts index 96c0377fc..0d0b442aa 100644 --- a/apps/common/features/src/entities/post/api/post-service.ts +++ b/apps/common/features/src/entities/post/api/post-service.ts @@ -11,23 +11,27 @@ import type { } from "../model/post-interface"; export class PostApiService implements PostService { - public async getPostList(params: PostParams): Promise { - const response = await client.get(ENDPOINT.BOARD_SERVICE.POSTS, { - params, - }); + public async getPostList( + bbsId: string, + params: PostParams, + ): Promise { + const response = await client.get( + `${ENDPOINT.BOARD_SERVICE.POSTS_USER}/${bbsId}`, + { params }, + ); return response.data; } public async getPostInfo(bbsId: string, pstNo: string): Promise { const response = await client.get( - `${ENDPOINT.BOARD_SERVICE.POSTS}/${bbsId}/${pstNo}`, + `${ENDPOINT.BOARD_SERVICE.POSTS_USER}/${bbsId}/${pstNo}`, ); return response.data; } public async createPost(data: PostFormData): Promise { const response = await client.post( - `${ENDPOINT.BOARD_SERVICE.POSTS}`, + `${ENDPOINT.BOARD_SERVICE.POSTS_USER}`, data, ); return response.data; @@ -39,14 +43,16 @@ export class PostApiService implements PostService { data: PostUpdateFormData, ): Promise { const response = await client.put( - `${ENDPOINT.BOARD_SERVICE.POSTS}/${bbsId}/${pstNo}`, + `${ENDPOINT.BOARD_SERVICE.POSTS_USER}/${bbsId}/${pstNo}`, data, ); return response.data; } public async deletePost(bbsId: string, pstNo: string): Promise { - await client.delete(`${ENDPOINT.BOARD_SERVICE.POSTS}/${bbsId}/${pstNo}`); + await client.delete( + `${ENDPOINT.BOARD_SERVICE.POSTS_USER}/${bbsId}/${pstNo}`, + ); } } diff --git a/apps/common/features/src/entities/post/model/post-interface.ts b/apps/common/features/src/entities/post/model/post-interface.ts index 7a7f95108..00b8cc403 100644 --- a/apps/common/features/src/entities/post/model/post-interface.ts +++ b/apps/common/features/src/entities/post/model/post-interface.ts @@ -7,10 +7,10 @@ import { export interface PostParams extends PageableParams { keywordType?: string; keyword?: string; - bbsId?: number; - delYn?: string; - frDateYmd?: string; - toDateYmd?: string; + popupYn?: string; + upndFixYn?: string; + prdPstgYn?: string; + siteId?: string; } export interface Post { @@ -65,7 +65,7 @@ export type PostFormData = z.infer; export type PostUpdateFormData = z.infer; export interface PostService { - getPostList(params: PostParams): Promise; + getPostList(bbsId: string, params: PostParams): Promise; getPostInfo(bbsId: string, pstNo: string): Promise; createPost(data: PostFormData): Promise; updatePost( diff --git a/apps/common/features/src/pages/notice/ui/modify-page.tsx b/apps/common/features/src/pages/notice/ui/modify-page.tsx index e769af78e..10f3c19ed 100644 --- a/apps/common/features/src/pages/notice/ui/modify-page.tsx +++ b/apps/common/features/src/pages/notice/ui/modify-page.tsx @@ -17,7 +17,7 @@ function ModifyPage({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { const { setMessage: alert } = useAlertStore((state) => state); const { data: postInfo } = useQuery({ - queryKey: [ENDPOINT.BOARD_SERVICE.POSTS, bbsId, pstNo], + queryKey: [ENDPOINT.BOARD_SERVICE.POSTS_USER, bbsId, pstNo], queryFn: () => PostApi.getPostInfo(bbsId, pstNo), }); diff --git a/apps/common/features/src/pages/notice/ui/notice-page.tsx b/apps/common/features/src/pages/notice/ui/notice-page.tsx index d43355f27..2ca1624dc 100644 --- a/apps/common/features/src/pages/notice/ui/notice-page.tsx +++ b/apps/common/features/src/pages/notice/ui/notice-page.tsx @@ -32,7 +32,6 @@ function NoticePage({ bbsId }: { bbsId: string }) { const [postParams, setPostParams] = useState({ keywordType: "title", keyword: "", - delYn: "N", }); const [pagination, setPagination] = useState({ pageIndex: 0, @@ -40,11 +39,10 @@ function NoticePage({ bbsId }: { bbsId: string }) { }); const { data: postList, refetch } = useQuery({ - queryKey: [ENDPOINT.BOARD_SERVICE.POSTS], + queryKey: [ENDPOINT.BOARD_SERVICE.POSTS_USER, bbsId], queryFn: () => - PostApi.getPostList({ + PostApi.getPostList(bbsId, { ...postParams, - bbsId: parseInt(bbsId), page: pagination.pageIndex, size: pagination.pageSize, }), diff --git a/apps/common/features/src/shared/config/api.ts b/apps/common/features/src/shared/config/api.ts index aea8fbcbf..1ab27e341 100644 --- a/apps/common/features/src/shared/config/api.ts +++ b/apps/common/features/src/shared/config/api.ts @@ -37,7 +37,7 @@ export const ENDPOINT = { }, BOARD_SERVICE: { BBS: "/board-service/api/v1/bbs", - POSTS: "/board-service/api/v1/posts", + POSTS_USER: "/board-service/api/v1/posts/user", }, }; diff --git a/apps/common/features/src/widgets/post/ui/post.tsx b/apps/common/features/src/widgets/post/ui/post.tsx index c3419792b..3f3d187e2 100644 --- a/apps/common/features/src/widgets/post/ui/post.tsx +++ b/apps/common/features/src/widgets/post/ui/post.tsx @@ -17,7 +17,7 @@ function Post({ bbsId, pstNo }: { bbsId: string; pstNo: string }) { useState(null); const { data: postData } = useQuery({ - queryKey: [ENDPOINT.BOARD_SERVICE.POSTS], + queryKey: [ENDPOINT.BOARD_SERVICE.POSTS_USER, bbsId, pstNo], queryFn: () => PostApi.getPostInfo(bbsId, pstNo), });