Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: post 리스트 응답 누락 스키마 추가, swagger 타입 오류 수정 #82

Merged
merged 2 commits into from
Jul 26, 2024
Merged
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
12 changes: 8 additions & 4 deletions src/modules/folders/responses/post.response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ export class PostResponse {
@ApiProperty({ description: '생성 시간' })
createdAt: Date;

@ApiProperty({ type: Keyword, isArray: true })
keywords: KeywordItem[];

@ApiProperty({ nullable: true, description: 'URL og 이미지' })
thumbnailImgUrl: string | null;

Expand All @@ -58,22 +55,29 @@ export class PostResponse {
})
aiStatus: PostAiStatus;

@ApiProperty({
type: KeywordItem,
isArray: true,
description: 'ai 키워드 리스트',
})
keywords: KeywordItem[];
constructor(
data: Post & {
_id: Types.ObjectId;
keywords: (Keyword & { _id: Types.ObjectId })[];
},
) {
this.id = data._id.toString();
this.userId = data.userId.toString();
this.folderId = data.folderId.toString();
this.url = data.url;
this.title = data.title;
this.description = data.description;
this.keywords = data.keywords.map((keyword) => new KeywordItem(keyword));
this.isFavorite = data.isFavorite;
this.readAt = data.readAt;
this.createdAt = data.createdAt;
this.thumbnailImgUrl = data.thumbnailImgUrl;
this.aiStatus = data.aiStatus;
this.keywords = data.keywords.map((keyword) => new KeywordItem(keyword));
}
}