From 730e15bccb73bd0cd5efabc8c73275de3cbaed79 Mon Sep 17 00:00:00 2001 From: trungpd0911 Date: Mon, 22 Apr 2024 17:06:15 +0700 Subject: [PATCH 1/2] fixbug(blog): fix bug thumbnailImage --- src/posts/posts.controller.ts | 1 + src/schemas/Post.schema.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/posts/posts.controller.ts b/src/posts/posts.controller.ts index 30b0845..42c33f2 100644 --- a/src/posts/posts.controller.ts +++ b/src/posts/posts.controller.ts @@ -171,6 +171,7 @@ export class PostsController { @UseGuards(new RoleGuard(['admin'])) @UseGuards(AuthGuard) async createPost(@Request() req, @Body() createPostDto: CreatePostDto) { + console.log(createPostDto); const userId = req.currentUser._id; return await this.postsService.createPost(createPostDto, userId); } diff --git a/src/schemas/Post.schema.ts b/src/schemas/Post.schema.ts index 082032e..86c8c60 100644 --- a/src/schemas/Post.schema.ts +++ b/src/schemas/Post.schema.ts @@ -39,8 +39,8 @@ export class Post { publicId: string; }[]; - @Prop({ required: true, type: Boolean }) - thumbNailImage: string; + @Prop({ required: true, type: String }) + thumbnailImage: string; } export const PostSchema = SchemaFactory.createForClass(Post); From c596ebc4544df7934d15b1dfbd1b366c7ef3190f Mon Sep 17 00:00:00 2001 From: trungpd0911 Date: Mon, 22 Apr 2024 17:13:30 +0700 Subject: [PATCH 2/2] fixbug(blog): fix bug thumbnailImage --- src/posts/posts.controller.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/posts/posts.controller.ts b/src/posts/posts.controller.ts index 42c33f2..30b0845 100644 --- a/src/posts/posts.controller.ts +++ b/src/posts/posts.controller.ts @@ -171,7 +171,6 @@ export class PostsController { @UseGuards(new RoleGuard(['admin'])) @UseGuards(AuthGuard) async createPost(@Request() req, @Body() createPostDto: CreatePostDto) { - console.log(createPostDto); const userId = req.currentUser._id; return await this.postsService.createPost(createPostDto, userId); }