chore(workspace): eradicate all tsc errors and eslint warnings across frontend, admin, and backend
Deploy Canina / deploy (push) Failing after 29s
Deploy Canina / deploy (push) Failing after 29s
This commit is contained in:
1 parent
4659a7b1de
commit
9f11d8fb2d
98 files changed
+1272
-1009
No files matched your search
@@ -10,7 +10,8 @@ import {
|
||||
UseGuards,
|
||||
Request,
|
||||
} from '@nestjs/common';
|
||||
import { BlogsService } from './blogs.service';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { BlogsService, BlogQuery } from './blogs.service';
|
||||
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
|
||||
import {
|
||||
ApiTags,
|
||||
@@ -31,20 +32,26 @@ export class BlogsController {
|
||||
@ApiQuery({ name: 'page', required: false, description: 'شماره صفحه' })
|
||||
@ApiQuery({ name: 'limit', required: false, description: 'تعداد آیتمها' })
|
||||
@ApiQuery({ name: 'search', required: false, description: 'جستجو' })
|
||||
async getBlogs(@Query() query: any) {
|
||||
async getBlogs(@Query() query: BlogQuery) {
|
||||
return this.blogsService.getBlogs(query);
|
||||
}
|
||||
|
||||
@Post()
|
||||
@ApiOperation({ summary: 'ایجاد مقاله جدید' })
|
||||
async createBlog(@Body() body: any, @Request() req: any) {
|
||||
async createBlog(
|
||||
@Body() body: Prisma.BlogCreateWithoutAuthorInput,
|
||||
@Request() req: { user: { id: string } },
|
||||
) {
|
||||
const data = await this.blogsService.createBlog(body, req.user.id);
|
||||
return { success: true, data };
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
@ApiOperation({ summary: 'ویرایش مقاله' })
|
||||
async updateBlog(@Param('id') id: string, @Body() body: any) {
|
||||
async updateBlog(
|
||||
@Param('id') id: string,
|
||||
@Body() body: Prisma.BlogUpdateInput,
|
||||
) {
|
||||
const data = await this.blogsService.updateBlog(id, body);
|
||||
return { success: true, data };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user