Skip to content

Commit

Permalink
feat: 피드 수정, 작성 Request DTO를 entities/feed/model/types.ts 에 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
suhwan2004 committed Nov 5, 2024
1 parent 892359f commit aea5cc1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
19 changes: 3 additions & 16 deletions src/app/mocks/handlers/feed.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
import { http } from 'msw';

import { feedMockData } from '../data';
import { IReportFeedReqDTO, IWriteFeedReqDTO } from '@/entities/feed';

import { feedMockData } from '../data';
import { createHttpErrorResponse, createHttpSuccessResponse } from '../lib';

interface IReportFeedReqDTO {
category: string;
content: string;
isBlind: boolean;
}

interface IWriteFeedReqDTO {
content: string;
images: string[];
scope: TFeedScope;
}

type TFeedScope = 'public' | 'friends' | 'private';

export const feedHandlers = [
// 1️⃣ 피드 신고
http.post('http://api.example.com/v2/feeds/:feedId/reports', async ({ request, params }) => {
const { feedId } = params;

const { category, content } = (await request.json()) as IReportFeedReqDTO;
const { category, isBlind } = (await request.json()) as IReportFeedReqDTO;

if (!feedId || !category) {
return createHttpErrorResponse('피드 ID, 신고 카테고리가 필수로 입력되어야 합니다.');
Expand Down
2 changes: 1 addition & 1 deletion src/entities/feed/model/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './type';
export * from './types';
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,17 @@ export interface IFeed {
createdAt: string;
updatedAt: string;
}

export interface IReportFeedReqDTO {
category: string;
content: string;
isBlind: boolean;
}

export interface IWriteFeedReqDTO {
content: string;
images: string[];
scope: TFeedScope;
}

export type TFeedScope = 'public' | 'friends' | 'private';

0 comments on commit aea5cc1

Please sign in to comment.