Skip to content
Merged

Dev #189

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion share/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@grimity/dto",
"version": "1.0.29",
"version": "1.0.30",
"types": "dist/share/index.d.ts",
"exports": {
".": {
Expand Down
2 changes: 1 addition & 1 deletion src/module/album/dto/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './album.request';
export * from './album.response';
export * from './album.base.response';
19 changes: 19 additions & 0 deletions src/module/chat/dto/chat-message.base.response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ApiProperty } from '@nestjs/swagger';

export class ChatMessageBaseResponse {
@ApiProperty()
id: string;

@ApiProperty({ type: 'string', nullable: true })
content: string | null;

@ApiProperty({
type: 'string',
nullable: true,
example: 'https://image.grimity.com/chat/123.webp',
})
image: string | null;

@ApiProperty()
createdAt: Date;
}
21 changes: 2 additions & 19 deletions src/module/chat/dto/chat-message.response.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { CursorResponse } from '../../../shared/response';
import { UserBaseResponse } from '../../../module/user/dto';

export class ChatMessageBaseResponse {
@ApiProperty()
id: string;

@ApiProperty({ type: 'string', nullable: true })
content: string | null;

@ApiProperty({
type: 'string',
nullable: true,
example: 'https://image.grimity.com/chat/123.webp',
})
image: string | null;

@ApiProperty()
createdAt: Date;
}
import { UserBaseResponse } from '../../user/dto';
import { ChatMessageBaseResponse } from './chat-message.base.response';

export class ReplyToResponse extends ChatMessageBaseResponse {}

Expand Down
4 changes: 2 additions & 2 deletions src/module/chat/dto/chat.response.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { CursorResponse } from '../../../shared/response';
import { UserBaseResponse } from '../../../module/user/dto';
import { ChatMessageBaseResponse } from './chat-message.response';
import { UserBaseResponse } from '../../user/dto';
import { ChatMessageBaseResponse } from './chat-message.base.response';

export class LastChatMessageResponse extends ChatMessageBaseResponse {
@ApiProperty({
Expand Down
1 change: 1 addition & 0 deletions src/module/chat/dto/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './chat.request';
export * from './chat.response';

export * from './chat-message.base.response';
export * from './chat-message.request';
export * from './chat-message.response';
15 changes: 15 additions & 0 deletions src/module/feed-comment/dto/feed-comment.base.response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ApiProperty } from '@nestjs/swagger';

export class FeedCommentBaseResponse {
@ApiProperty()
id: string;

@ApiProperty()
content: string;

@ApiProperty()
createdAt: Date;

@ApiProperty()
likeCount: number;
}
21 changes: 5 additions & 16 deletions src/module/feed-comment/dto/feed-comment.response.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
import { ApiProperty } from '@nestjs/swagger';
import { UserBaseResponse } from '../../user/dto/user.dto.response';

export class FeedCommentBaseResponse {
@ApiProperty()
id: string;

@ApiProperty()
content: string;

@ApiProperty()
createdAt: Date;

@ApiProperty()
likeCount: number;
import { UserBaseResponse } from '../../user/dto/user.base.response';
import { FeedCommentBaseResponse } from './feed-comment.base.response';

export class FeedCommentWithWriterResponse extends FeedCommentBaseResponse {
@ApiProperty({ type: UserBaseResponse })
writer: UserBaseResponse;
}

export class ChildFeedCommentResponse extends FeedCommentBaseResponse {
export class ChildFeedCommentResponse extends FeedCommentWithWriterResponse {
@ApiProperty({ type: UserBaseResponse, nullable: true })
mentionedUser: UserBaseResponse | null;

@ApiProperty()
isLike: boolean;
}

export class ParentFeedCommentResponse extends FeedCommentBaseResponse {
export class ParentFeedCommentResponse extends FeedCommentWithWriterResponse {
@ApiProperty({ type: ChildFeedCommentResponse, isArray: true })
childComments: ChildFeedCommentResponse[];

Expand Down
2 changes: 2 additions & 0 deletions src/module/feed-comment/dto/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from './feed-comment.base.response';

export * from './feed-comment.request';
export * from './feed-comment.response';
32 changes: 32 additions & 0 deletions src/module/feed/dto/feed.base.response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ApiProperty } from '@nestjs/swagger';

export class FeedBaseResponse {
@ApiProperty()
id: string;

@ApiProperty()
title: string;

@ApiProperty({ example: 'feed/UUID.webp' })
thumbnail: string;

@ApiProperty()
likeCount: number;

@ApiProperty()
viewCount: number;
}

export class FeedResponse extends FeedBaseResponse {
@ApiProperty({ type: 'string', isArray: true, example: ['feed/UUID.webp'] })
cards: string[];

@ApiProperty()
createdAt: Date;

@ApiProperty()
content: string;

@ApiProperty()
tags: string[];
}
36 changes: 2 additions & 34 deletions src/module/feed/dto/feed.response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,13 @@ import { ApiProperty } from '@nestjs/swagger';
import {
UserBaseResponse,
UserBaseWithBlockedResponse,
} from '../../user/dto/user.dto.response';
} from '../../user/dto/user.base.response';
import {
CursorAndCountResponse,
CursorResponse,
} from '../../../shared/response/cursor.response';
import { AlbumBaseResponse } from '../../album/dto/album.response';
import { FeedCommentBaseResponse } from 'src/module/feed-comment/dto';

// 최소단위
export class FeedBaseResponse {
@ApiProperty()
id: string;

@ApiProperty()
title: string;

@ApiProperty({ example: 'feed/UUID.webp' })
thumbnail: string;

@ApiProperty()
likeCount: number;

@ApiProperty()
viewCount: number;
}

export class FeedResponse extends FeedBaseResponse {
@ApiProperty({ type: 'string', isArray: true, example: ['feed/UUID.webp'] })
cards: string[];

@ApiProperty()
createdAt: Date;

@ApiProperty()
content: string;

@ApiProperty()
tags: string[];
}
import { FeedBaseResponse, FeedResponse } from './feed.base.response';

export class SearchedFeedResponse extends FeedBaseResponse {
@ApiProperty({ type: UserBaseResponse })
Expand Down
2 changes: 2 additions & 0 deletions src/module/feed/dto/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from './feed.base.response';

export * from './feed.request';
export * from './feed.response';
2 changes: 2 additions & 0 deletions src/module/post-comment/dto/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from './post-comment.base.response';

export * from './post-comment.request';
export * from './post-comment.response';
18 changes: 18 additions & 0 deletions src/module/post-comment/dto/post-comment.base.response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ApiProperty } from '@nestjs/swagger';

export class PostCommentBaseResponse {
@ApiProperty()
id: string;

@ApiProperty()
content: string;

@ApiProperty()
createdAt: Date;

@ApiProperty()
likeCount: number;

@ApiProperty()
isLike: boolean;
}
24 changes: 5 additions & 19 deletions src/module/post-comment/dto/post-comment.response.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
import { ApiProperty } from '@nestjs/swagger';
import { UserBaseResponse } from '../../user/dto/user.dto.response';

export class PostCommentBaseResponse {
@ApiProperty()
id: string;

@ApiProperty()
content: string;

@ApiProperty()
createdAt: Date;

@ApiProperty()
likeCount: number;
import { UserBaseResponse } from '../../user/dto/user.base.response';
import { PostCommentBaseResponse } from './post-comment.base.response';

export class PostCommentWithWriterResponse extends PostCommentBaseResponse {
@ApiProperty({
type: UserBaseResponse,
nullable: true,
description: 'null이면 익명화',
})
writer: UserBaseResponse | null;

@ApiProperty()
isLike: boolean;
}

export class ChildPostCommentResponse extends PostCommentBaseResponse {
export class ChildPostCommentResponse extends PostCommentWithWriterResponse {
@ApiProperty({ type: UserBaseResponse, nullable: true })
mentionedUser: UserBaseResponse | null;
}

export class ParentPostCommentResponse extends PostCommentBaseResponse {
export class ParentPostCommentResponse extends PostCommentWithWriterResponse {
@ApiProperty()
isDeleted: boolean;

Expand Down
2 changes: 2 additions & 0 deletions src/module/post/dto/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from './post.base.response';

export * from './post.request';
export * from './post.response';
30 changes: 30 additions & 0 deletions src/module/post/dto/post.base.response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { ApiProperty } from '@nestjs/swagger';
import { postTypes } from '../../../common/constants/post.constant';

export class PostBaseResponse {
@ApiProperty()
id: string;

@ApiProperty()
title: string;

@ApiProperty()
content: string;

@ApiProperty({ type: 'string', nullable: true, description: 'FULL URL' })
thumbnail: string | null;

@ApiProperty()
createdAt: Date;
}

export class PostResponse extends PostBaseResponse {
@ApiProperty({ enum: postTypes })
type: (typeof postTypes)[number];

@ApiProperty()
viewCount: number;

@ApiProperty()
commentCount: number;
}
39 changes: 7 additions & 32 deletions src/module/post/dto/post.response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,19 @@ import { ApiProperty } from '@nestjs/swagger';
import { UserBaseResponse } from '../../user/dto';
import { TotalCountResponse } from '../../../shared/response/total-count.response';
import { postTypes } from '../../../common/constants/post.constant';
import { PostBaseResponse, PostResponse } from './post.base.response';

export class PostBaseResponse {
@ApiProperty()
id: string;

@ApiProperty()
title: string;

@ApiProperty()
content: string;

@ApiProperty({ type: 'string', nullable: true, description: 'FULL URL' })
thumbnail: string | null;

@ApiProperty()
createdAt: Date;
}

export class PostResponse extends PostBaseResponse {
@ApiProperty({ enum: postTypes })
type: (typeof postTypes)[number];

@ApiProperty()
viewCount: number;

@ApiProperty()
commentCount: number;

export class PostWithAuthorResponse extends PostResponse {
@ApiProperty({ type: UserBaseResponse })
author: UserBaseResponse;
}

export class PostsResponse extends TotalCountResponse {
@ApiProperty({ type: PostResponse, isArray: true })
posts: PostResponse[];
@ApiProperty({ type: PostWithAuthorResponse, isArray: true })
posts: PostWithAuthorResponse[];
}

export class PostDetailResponse extends PostResponse {
export class PostDetailResponse extends PostWithAuthorResponse {
@ApiProperty()
likeCount: number;

Expand All @@ -51,8 +26,8 @@ export class PostDetailResponse extends PostResponse {
}

export class MySavePostsResponse extends TotalCountResponse {
@ApiProperty({ type: PostResponse, isArray: true })
posts: PostResponse[];
@ApiProperty({ type: PostWithAuthorResponse, isArray: true })
posts: PostWithAuthorResponse[];
}

export class MyPostResponse extends PostBaseResponse {
Expand Down
Loading
Loading