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
@@ -296,10 +296,8 @@ async function main() {
|
||||
// 3. Seed Products & Categories
|
||||
console.log('Seeding Products & Categories...');
|
||||
try {
|
||||
const seedProductsModule: any = await import('./seed-products.js');
|
||||
if (typeof seedProductsModule.main === 'function') {
|
||||
await seedProductsModule.main();
|
||||
}
|
||||
const { execSync } = require('child_process');
|
||||
execSync('npx ts-node prisma/seed-products.ts', { stdio: 'inherit' });
|
||||
} catch (err) {
|
||||
console.error('Failed to seed products:', err);
|
||||
}
|
||||
@@ -307,10 +305,8 @@ async function main() {
|
||||
// 4. Seed Home Components & Testimonials
|
||||
console.log('Seeding Home Components...');
|
||||
try {
|
||||
const seedHomeModule: any = await import('./seed-home.js');
|
||||
if (typeof seedHomeModule.main === 'function') {
|
||||
await seedHomeModule.main();
|
||||
}
|
||||
const { execSync } = require('child_process');
|
||||
execSync('npx ts-node prisma/seed-home.ts', { stdio: 'inherit' });
|
||||
} catch (err) {
|
||||
console.error('Failed to seed home components:', err);
|
||||
}
|
||||
|
||||
@@ -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