Added post editing

This commit is contained in:
2023-11-22 20:59:26 +03:00
parent ac778289d0
commit 11f2dd71eb
3 changed files with 33 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { ApiOperation, ApiParam, ApiTags } from '@nestjs/swagger';
import { EGetAll } from 'libs/enums/getAll.enum';
import { ICreatePost } from './post.dto';
import { ICreatePost, IEditPost } from './post.dto';
import { PostService } from './post.service';
@ApiTags('Post')
@@ -22,7 +22,7 @@ export class PostController {
return await this.postService.getAllPosts(status || EGetAll.all);
}
@ApiOperation({ description: 'Getting a post bu uuid' })
@ApiOperation({ description: 'Getting a post by uuid' })
@Get('get/:postId')
async getPost(@Param('postId') postId: string) {
return await this.postService.getPost(postId);
@@ -33,4 +33,10 @@ export class PostController {
async getByMediaGroup(@Param('mediaGroupId') mediaGroupId: string) {
return await this.postService.getByMediaGroup(mediaGroupId);
}
@ApiOperation({ description: 'Editing a post by its uuid' })
@Post('edit/:postId')
async editPost(@Param('postId') postId: string, @Body() data: IEditPost) {
return await this.postService.editPost(postId, data);
}
}