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

+15 -8
View File
@@ -8,29 +8,36 @@ export class BlogsService {
async getBlogs(query: any) {
const { page = 1, limit = 10, search = '' } = query;
const skip = (Number(page) - 1) * Number(limit);
const where = search ? { title: { contains: search, mode: 'insensitive' as any } } : {};
const where = search
? { title: { contains: search, mode: 'insensitive' as any } }
: {};
const [data, total] = await Promise.all([
this.prisma.blog.findMany({
where,
skip,
take: Number(limit),
orderBy: { createdAt: 'desc' },
include: { author: { select: { firstName: true, lastName: true } } }
include: { author: { select: { firstName: true, lastName: true } } },
}),
this.prisma.blog.count({ where })
this.prisma.blog.count({ where }),
]);
return {
data,
meta: { total, page: Number(page), limit: Number(limit), lastPage: Math.ceil(total / Number(limit)) }
meta: {
total,
page: Number(page),
limit: Number(limit),
lastPage: Math.ceil(total / Number(limit)),
},
};
}
async createBlog(data: any, authorId: string) {
return this.prisma.blog.create({
data: { ...data, authorId }
return this.prisma.blog.create({
data: { ...data, authorId },
});
}