From f23c8ae809a4d7e431ca23504e28c9d50b57feb3 Mon Sep 17 00:00:00 2001 From: young Date: Fri, 8 Nov 2024 02:16:08 +0900 Subject: [PATCH 1/5] =?UTF-8?q?Fix:=20api=20=EB=8F=84=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=ED=8F=B4=EB=8D=94=EB=AA=85=20=EB=B3=80=EA=B2=BD=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=A5=B8=20=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PostBase/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/PostBase/index.tsx b/src/components/PostBase/index.tsx index cb71c346..5e19716e 100644 --- a/src/components/PostBase/index.tsx +++ b/src/components/PostBase/index.tsx @@ -36,8 +36,8 @@ import { useRecoilState } from 'recoil'; import { postIdAtom, userIdAtom, userNameAtom } from '../../recoil/Post/PostAtom'; import { PostBaseProps } from './dto'; -import { GetPostDetailResponse } from '../../apis/Post/dto'; -import { GetUserResponse } from '../../apis/User/dto'; +import { GetPostDetailResponse } from '../../apis/post/dto'; +import { GetUserResponse } from '../../apis/user/dto'; import { UpdatePostLikeResponse } from '../../apis/post-like/dto'; import request from '../../apis/core'; From 48e6353f895ed88791e65f176bc55a98e9618ddd Mon Sep 17 00:00:00 2001 From: young Date: Fri, 8 Nov 2024 02:19:32 +0900 Subject: [PATCH 2/5] =?UTF-8?q?Feat:=20=EB=A7=A4=EC=B9=AD=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20api=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/Matching/dto.ts | 101 +++---------------------------------- src/apis/Matching/index.ts | 5 ++ 2 files changed, 13 insertions(+), 93 deletions(-) create mode 100644 src/apis/Matching/index.ts diff --git a/src/apis/Matching/dto.ts b/src/apis/Matching/dto.ts index 3fc1f023..06078c3e 100644 --- a/src/apis/Matching/dto.ts +++ b/src/apis/Matching/dto.ts @@ -1,103 +1,18 @@ import { BaseApiResponse } from '../util/dto'; -import { User } from '../user/dto'; // 매칭 요청 -//Request -export type CreateMatchingRequest = MatchingRequest; -//Response -export type CreateMatchingResponse = BaseApiResponse; - -// 매칭 요청 수락/거부 -//Request -export type UpdateMatchingAcceptRequest = MatchingAcceptRequest; -//Response -export type UpdateMatchingAcceptResponse = BaseApiResponse; - -// 매칭 리스트 조회 -// Response -export type GetMatchingListResponse = BaseApiResponse; - -// 매칭 요청 데이터 -export interface MatchingRequest { +//request +export interface CreateMatchingRequest { requesterId: number; targetId: number; message: string; } -// 매칭 상태 업데이트 (수락/거부) 데이터 -export interface MatchingAcceptRequest { - id: number; - requestStatus: 'rejected' | 'accepted'; -} - -// 매칭 응답 데이터 (요청 수락/거부 포함) -export interface MatchingResult { - id: number; - requester: User; - target: User; - message: string; - requestStatus: 'pending' | 'rejected' | 'accepted'; - rejectedAt?: string | null; - acceptedAt?: string | null; - createdAt: string; -} - -// 매칭 리스트 조회 시 응답 데이터 -export interface MatchingListResult { - id: number; - status: string; // 요청의 현재 상태 - createdAt: string; - updatedAt: string; - deletedAt?: string | null; - message: string; - requestStatus: 'pending' | 'rejected' | 'accepted'; - rejectedAt?: string | null; - acceptedAt?: string | null; - target: User; - requester: User; - representativePost?: RepresentativePost; // 선택적 대표 게시물 정보 -} - -// 대표 게시물 정보 -export interface RepresentativePost { - id: number; - status: 'activated' | 'deactivated'; - createdAt: string; - updatedAt: string; - deletedAt?: string | null; - content: string; - isRepresentative: boolean; - images: PostImage[]; - postStyletags: StyleTag[]; - postClothings: PostClothing[]; -} - -// 게시물 이미지 정보 -export interface PostImage { - id: number; - status: 'activated' | 'deactivated'; - createdAt: string; - updatedAt: string; - deletedAt?: string | null; - postId: number; - url: string; - order: number; -} - -// 스타일 태그 정보 -export interface StyleTag { - id: number; - status: 'activated' | 'deactivated'; - createdAt: string; - updatedAt: string; - deletedAt?: string | null; -} +// response +export type CreateMatchingResponse = BaseApiResponse; -// 의류 항목 정보 -export interface PostClothing { - id: number; - status: 'activated' | 'deactivated'; - createdAt: string; - updatedAt: string; - deletedAt?: string | null; +export interface CreateMatchingData { + chatRoomId: number; + fromUserId: number; + toUserId: number; } diff --git a/src/apis/Matching/index.ts b/src/apis/Matching/index.ts new file mode 100644 index 00000000..6e2fd04c --- /dev/null +++ b/src/apis/Matching/index.ts @@ -0,0 +1,5 @@ +import { newRequest } from '../core'; +import { CreateMatchingRequest, CreateMatchingResponse } from './dto'; + +export const createMatchingApi = (data: CreateMatchingRequest) => + newRequest.post('/matching', data); From d36df5e87d664ed82d8df57ab4983866e16fd250 Mon Sep 17 00:00:00 2001 From: young Date: Fri, 8 Nov 2024 02:23:44 +0900 Subject: [PATCH 3/5] =?UTF-8?q?Refactor:=20api=20core=20dto=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/core/dto.ts | 9 +++++++++ src/apis/core/index.ts | 7 ------- 2 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 src/apis/core/dto.ts diff --git a/src/apis/core/dto.ts b/src/apis/core/dto.ts new file mode 100644 index 00000000..75621511 --- /dev/null +++ b/src/apis/core/dto.ts @@ -0,0 +1,9 @@ +// 새로운 서버 응답 타입 +export type BaseSuccessResponse = { + isSuccess: boolean; + code: string; + data: T; +}; + +// 응답 body가 없을 경우 +export type EmptySuccessResponse = BaseSuccessResponse; diff --git a/src/apis/core/index.ts b/src/apis/core/index.ts index 6d2db9b0..3a66718e 100644 --- a/src/apis/core/index.ts +++ b/src/apis/core/index.ts @@ -7,13 +7,6 @@ import axios, { } from 'axios'; import { JWT_KEY, NEW_JWT_KEY } from '../../config/constant'; -// 새로운 서버 응답 타입 -export type BaseSuccessResponse = { - isSuccess: boolean; - code: string; - data: T; -}; - // 기존 서버 응답 타입 export type BaseResponse = { isSuccess: boolean; From f203856341ee6a851010a4e92ba907d9f427f088 Mon Sep 17 00:00:00 2001 From: young Date: Fri, 8 Nov 2024 02:24:02 +0900 Subject: [PATCH 4/5] =?UTF-8?q?Fix:=20=EB=A7=A4=EC=B9=AD=20api=20base=20re?= =?UTF-8?q?sponse=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/Matching/dto.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apis/Matching/dto.ts b/src/apis/Matching/dto.ts index 06078c3e..ef98a69c 100644 --- a/src/apis/Matching/dto.ts +++ b/src/apis/Matching/dto.ts @@ -1,4 +1,4 @@ -import { BaseApiResponse } from '../util/dto'; +import { BaseSuccessResponse } from '../core/dto'; // 매칭 요청 //request @@ -9,7 +9,7 @@ export interface CreateMatchingRequest { } // response -export type CreateMatchingResponse = BaseApiResponse; +export type CreateMatchingResponse = BaseSuccessResponse; export interface CreateMatchingData { chatRoomId: number; From 8ffd5e38746afb29ae57d33a556161a25f5bb813 Mon Sep 17 00:00:00 2001 From: young Date: Fri, 8 Nov 2024 02:27:55 +0900 Subject: [PATCH 5/5] =?UTF-8?q?Comment:=20api=20=EB=AA=A8=EB=93=88=20?= =?UTF-8?q?=EC=86=8C=EA=B0=9C=20=EC=A3=BC=EC=84=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/Matching/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apis/Matching/index.ts b/src/apis/Matching/index.ts index 6e2fd04c..88178579 100644 --- a/src/apis/Matching/index.ts +++ b/src/apis/Matching/index.ts @@ -1,5 +1,6 @@ import { newRequest } from '../core'; import { CreateMatchingRequest, CreateMatchingResponse } from './dto'; +// 매칭 생성 export const createMatchingApi = (data: CreateMatchingRequest) => newRequest.post('/matching', data);