style: apply standard ESLint & Prettier formatting across backend
Deploy Canina / deploy (push) Successful in 4m58s

This commit is contained in:
parsa aghaei committed 2026-07-29 15:41:53 +03:30
1 parent ae636c8b03
commit 62bd8811fa
66 files changed
+1398 -607

No files matched your search

+9 -2
View File
@@ -1,13 +1,20 @@
import { Controller, Get, Param, HttpStatus, Query } from '@nestjs/common';
import { BlogsService } from './blogs.service';
import { ApiTags, ApiOperation, ApiResponse, ApiOkResponse, ApiNotFoundResponse, ApiQuery } from '@nestjs/swagger';
import {
ApiTags,
ApiOperation,
ApiResponse,
ApiOkResponse,
ApiNotFoundResponse,
ApiQuery,
} from '@nestjs/swagger';
import { PaginationDto } from '../common/dto/pagination.dto';
@ApiTags('Blogs - مجله سلامت')
@Controller('blogs')
@ApiResponse({
status: HttpStatus.INTERNAL_SERVER_ERROR,
description: 'خطای داخلی سرور'
description: 'خطای داخلی سرور',
})
export class BlogsController {
constructor(private readonly blogsService: BlogsService) {}
+18 -12
View File
@@ -7,8 +7,14 @@ export class BlogsService {
constructor(private prisma: PrismaService) {}
async findAll(filters: PaginationDto) {
const { search, page = 1, limit = 10, sortBy = 'createdAt', sortOrder = 'desc' } = filters;
const {
search,
page = 1,
limit = 10,
sortBy = 'createdAt',
sortOrder = 'desc',
} = filters;
const whereClause: any = { isPublished: true };
if (search) {
whereClause.OR = [
@@ -27,11 +33,11 @@ export class BlogsService {
orderBy: { [sortBy]: sortOrder },
include: {
author: {
select: { firstName: true, lastName: true }
}
}
select: { firstName: true, lastName: true },
},
},
}),
this.prisma.blog.count({ where: whereClause })
this.prisma.blog.count({ where: whereClause }),
]);
return {
@@ -41,7 +47,7 @@ export class BlogsService {
page,
lastPage: Math.ceil(total / limit),
limit,
}
},
};
}
@@ -50,15 +56,15 @@ export class BlogsService {
where: { slug, isPublished: true },
include: {
author: {
select: { firstName: true, lastName: true }
}
}
select: { firstName: true, lastName: true },
},
},
});
if (!blog) {
throw new NotFoundException('مقاله یافت نشد');
}
return blog;
}
}