feat(perf): implement comprehensive Core Web Vitals, ISR caching, and media optimizations
Deploy Canina / deploy (push) Successful in 1m48s

This commit is contained in:
parsa aghaei committed 2026-08-24 17:23:43 +03:30
1 parent 2a31a9f8e4
commit fe6a900665
42 files changed
+12941 -10561

No files matched your search

+25 -12
View File
@@ -29,10 +29,7 @@ export class BlogsService {
const whereClause: Prisma.BlogWhereInput = {
isPublished: true,
status: 'PUBLISHED',
OR: [
{ publishedAt: null },
{ publishedAt: { lte: now } },
],
OR: [{ publishedAt: null }, { publishedAt: { lte: now } }],
};
if (search) {
@@ -67,7 +64,9 @@ export class BlogsService {
where: whereClause,
skip,
take: Number(limit),
orderBy: { [sortBy === 'createdAt' ? 'createdAt' : 'publishedAt']: sortOrder },
orderBy: {
[sortBy === 'createdAt' ? 'createdAt' : 'publishedAt']: sortOrder,
},
include: {
author: {
select: { firstName: true, lastName: true },
@@ -184,7 +183,11 @@ export class BlogsService {
let relatedBlogs: any[] = [];
if (blog.relatedBlogIds && blog.relatedBlogIds.length > 0) {
relatedBlogs = await this.prisma.blog.findMany({
where: { id: { in: blog.relatedBlogIds }, isPublished: true, status: 'PUBLISHED' },
where: {
id: { in: blog.relatedBlogIds },
isPublished: true,
status: 'PUBLISHED',
},
select: {
id: true,
title: true,
@@ -219,10 +222,12 @@ export class BlogsService {
}
// Increment view count asynchronously
await this.prisma.blog.update({
where: { id: blog.id },
data: { viewCount: { increment: 1 } },
}).catch(() => null);
await this.prisma.blog
.update({
where: { id: blog.id },
data: { viewCount: { increment: 1 } },
})
.catch(() => null);
return {
...blog,
@@ -237,7 +242,11 @@ export class BlogsService {
orderBy: { order: 'asc' },
include: {
children: true,
_count: { select: { blogs: { where: { isPublished: true, status: 'PUBLISHED' } } } },
_count: {
select: {
blogs: { where: { isPublished: true, status: 'PUBLISHED' } },
},
},
},
});
}
@@ -246,7 +255,11 @@ export class BlogsService {
return this.prisma.blogTag.findMany({
orderBy: { createdAt: 'desc' },
include: {
_count: { select: { blogs: { where: { isPublished: true, status: 'PUBLISHED' } } } },
_count: {
select: {
blogs: { where: { isPublished: true, status: 'PUBLISHED' } },
},
},
},
});
}