- 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.
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Delete,
|
|
Param,
|
|
Query,
|
|
UseGuards,
|
|
} from "@nestjs/common";
|
|
import { PetsService } from "./pets.service";
|
|
import { JwtAuthGuard } from "../auth/jwt-auth.guard";
|
|
import {
|
|
ApiTags,
|
|
ApiBearerAuth,
|
|
ApiOperation,
|
|
ApiQuery,
|
|
} from "@nestjs/swagger";
|
|
|
|
import { PaginationDto } from "../common/dto/pagination.dto";
|
|
|
|
import { RolesGuard } from "../common/guards/roles.guard";
|
|
import { Roles } from "../common/decorators/roles.decorator";
|
|
|
|
@ApiTags("Admin - مدیریت حیوانات خانگی")
|
|
@ApiBearerAuth()
|
|
@UseGuards(JwtAuthGuard, RolesGuard)
|
|
@Roles("Admin", "SUPER_ADMIN")
|
|
@Controller("admin/pets")
|
|
export class PetsController {
|
|
constructor(private readonly petsService: PetsService) {}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: "لیست حیوانات خانگی" })
|
|
@ApiQuery({ name: "page", required: false, description: "شماره صفحه" })
|
|
@ApiQuery({ name: "limit", required: false, description: "تعداد آیتمها" })
|
|
@ApiQuery({ name: "search", required: false, description: "جستجو" })
|
|
async getPets(@Query() query: PaginationDto) {
|
|
return this.petsService.getPets(query);
|
|
}
|
|
|
|
@Delete(":id")
|
|
@ApiOperation({ summary: "حذف حیوان خانگی" })
|
|
async deletePet(@Param("id") id: string) {
|
|
await this.petsService.deletePet(id);
|
|
return { success: true };
|
|
}
|
|
}
|