feat(header-refill-videos): restore full DB seeding, wire homepage videos to backend API, upgrade Refill to Cashback Loyalty system, and refactor Header into 2-tier Mega-Menu layout
This commit is contained in:
1 parent
83ccdc19ef
commit
2b1bd9efcb
7 files changed
+390
-515
No files matched your search
@@ -44,18 +44,19 @@ export class VideosService {
|
||||
};
|
||||
}
|
||||
|
||||
async findOne(id: string) {
|
||||
async findOne(id: string, incrementView = false) {
|
||||
const video = await this.prisma.video.findUnique({
|
||||
where: { id },
|
||||
});
|
||||
if (!video) {
|
||||
throw new NotFoundException('ویدئوی مورد نظر یافت نشد');
|
||||
}
|
||||
// Increment view count
|
||||
await this.prisma.video.update({
|
||||
where: { id },
|
||||
data: { viewsCount: { increment: 1 } },
|
||||
});
|
||||
if (incrementView) {
|
||||
await this.prisma.video.update({
|
||||
where: { id },
|
||||
data: { viewsCount: { increment: 1 } },
|
||||
}).catch(() => {});
|
||||
}
|
||||
return video;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user