test: comprehensive test suites and quality gates pass across backend, storefront and admin
- Backend (NestJS): 82 suites, 641 tests passing; 0 ESLint errors; 0 tsc errors. Hardened SSL cert/key matching, SSRF IP pinning, and eBank validation. - Admin Panel (Vite/React): 48 suites, 300 tests passing; 0 ESLint errors; 0 tsc errors. Full coverage across all pages and settings. - Storefront (Next.js): 62 suites, 368 tests passing; 0 ESLint errors; 0 tsc errors. - Fixed unmount lifecycle guards, promise error handling, and component edge cases.
This commit is contained in:
1 parent
1e73715169
commit
ddbf1ca026
439 files changed
+32911
-6107
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { Injectable, NotFoundException, OnModuleInit } from '@nestjs/common';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import { Injectable, NotFoundException, OnModuleInit } from "@nestjs/common";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { PrismaService } from "../prisma/prisma.service";
|
||||
|
||||
export class CategoryQuery {
|
||||
page?: number | string;
|
||||
@@ -20,39 +20,39 @@ export class CategoriesService implements OnModuleInit {
|
||||
try {
|
||||
const defaultCategories = [
|
||||
{
|
||||
name: 'مفاصل و استخوان',
|
||||
slug: 'joints',
|
||||
description: 'مکملهای ارتوپدی و مفاصل حاوی عصاره صدف سبز و GAG',
|
||||
name: "مفاصل و استخوان",
|
||||
slug: "joints",
|
||||
description: "مکملهای ارتوپدی و مفاصل حاوی عصاره صدف سبز و GAG",
|
||||
},
|
||||
{
|
||||
name: 'سیستم ایمنی و گوارش',
|
||||
slug: 'immune',
|
||||
description: 'تقویت سیستم دفاعی بدن و پروبیوتیکهای تخصصی',
|
||||
name: "سیستم ایمنی و گوارش",
|
||||
slug: "immune",
|
||||
description: "تقویت سیستم دفاعی بدن و پروبیوتیکهای تخصصی",
|
||||
},
|
||||
{
|
||||
name: 'ویتامینها و انرژیبخشها',
|
||||
slug: 'energy',
|
||||
description: 'مولتیویتامینها و تونیکهای انرژیبخش',
|
||||
name: "ویتامینها و انرژیبخشها",
|
||||
slug: "energy",
|
||||
description: "مولتیویتامینها و تونیکهای انرژیبخش",
|
||||
},
|
||||
{
|
||||
name: 'مراقبتهای ویژه (پوست، دندان و چشم)',
|
||||
slug: 'special-care',
|
||||
description: 'محلولهای نقره، قطرههای شستشو و ژل دندان',
|
||||
name: "مراقبتهای ویژه (پوست، دندان و چشم)",
|
||||
slug: "special-care",
|
||||
description: "محلولهای نقره، قطرههای شستشو و ژل دندان",
|
||||
},
|
||||
{
|
||||
name: 'تقویت عمومی',
|
||||
slug: 'general',
|
||||
description: 'مکملهای پایهای و روزانه سگ و گربه',
|
||||
name: "تقویت عمومی",
|
||||
slug: "general",
|
||||
description: "مکملهای پایهای و روزانه سگ و گربه",
|
||||
},
|
||||
{
|
||||
name: 'تغذیه تخصصی',
|
||||
slug: 'nutrition',
|
||||
description: 'شیر خشک، پودر خون گاو و مکملهای تخصصی پرورش',
|
||||
name: "تغذیه تخصصی",
|
||||
slug: "nutrition",
|
||||
description: "شیر خشک، پودر خون گاو و مکملهای تخصصی پرورش",
|
||||
},
|
||||
{
|
||||
name: 'مکملهای غذایی و درمانی',
|
||||
slug: 'supplements',
|
||||
description: 'طیف کامل مکملهای گرید دارویی Canina',
|
||||
name: "مکملهای غذایی و درمانی",
|
||||
slug: "supplements",
|
||||
description: "طیف کامل مکملهای گرید دارویی Canina",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -79,7 +79,7 @@ export class CategoriesService implements OnModuleInit {
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
'[CategoriesService] Failed to seed default categories:',
|
||||
"[CategoriesService] Failed to seed default categories:",
|
||||
err,
|
||||
);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ export class CategoriesService implements OnModuleInit {
|
||||
const skip = (page - 1) * limit;
|
||||
|
||||
const where: Prisma.CategoryWhereInput = query.search
|
||||
? { name: { contains: query.search, mode: 'insensitive' } }
|
||||
? { name: { contains: query.search, mode: "insensitive" } }
|
||||
: {};
|
||||
|
||||
const [data, total] = await Promise.all([
|
||||
@@ -99,7 +99,7 @@ export class CategoriesService implements OnModuleInit {
|
||||
where,
|
||||
skip,
|
||||
take: limit,
|
||||
orderBy: { createdAt: 'desc' },
|
||||
orderBy: { createdAt: "desc" },
|
||||
}),
|
||||
this.prisma.category.count({ where }),
|
||||
]);
|
||||
@@ -116,12 +116,12 @@ export class CategoriesService implements OnModuleInit {
|
||||
}
|
||||
|
||||
async getAllCategoriesRaw() {
|
||||
return this.prisma.category.findMany({ orderBy: { name: 'asc' } });
|
||||
return this.prisma.category.findMany({ orderBy: { name: "asc" } });
|
||||
}
|
||||
|
||||
async createCategory(data: Prisma.CategoryCreateInput) {
|
||||
const nameStr = data.name || '';
|
||||
const slugStr = data.slug || nameStr.replace(/\s+/g, '-').toLowerCase();
|
||||
const nameStr = data.name || "";
|
||||
const slugStr = data.slug || nameStr.replace(/\s+/g, "-").toLowerCase();
|
||||
|
||||
return this.prisma.category.create({
|
||||
data: {
|
||||
@@ -133,14 +133,14 @@ export class CategoriesService implements OnModuleInit {
|
||||
|
||||
async updateCategory(id: string, data: Prisma.CategoryUpdateInput) {
|
||||
const category = await this.prisma.category.findUnique({ where: { id } });
|
||||
if (!category) throw new NotFoundException('Category not found');
|
||||
if (!category) throw new NotFoundException("Category not found");
|
||||
|
||||
return this.prisma.category.update({ where: { id }, data });
|
||||
}
|
||||
|
||||
async deleteCategory(id: string) {
|
||||
const category = await this.prisma.category.findUnique({ where: { id } });
|
||||
if (!category) throw new NotFoundException('Category not found');
|
||||
if (!category) throw new NotFoundException("Category not found");
|
||||
return this.prisma.category.delete({ where: { id } });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user