Files
canina/backend/src/testimonials/testimonials.controller.ts
T
devops ddbf1ca026
Deploy Canina / deploy (push) Successful in 4m1s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s
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.
2026-10-13 16:01:00 +00:00

62 lines
1.9 KiB
TypeScript

import {
Controller,
Get,
Post,
Patch,
Delete,
Body,
Param,
UseGuards,
} from "@nestjs/common";
import { Prisma } from "@prisma/client";
import { TestimonialsService } from "./testimonials.service";
import { ApiTags, ApiOperation, ApiBearerAuth } from "@nestjs/swagger";
import { JwtAuthGuard } from "../auth/jwt-auth.guard";
import { RolesGuard } from "../common/guards/roles.guard";
import { Roles } from "../common/decorators/roles.decorator";
@ApiTags("Testimonials - نظرات و رضایت‌نامه‌ها")
@Controller("testimonials")
export class TestimonialsController {
constructor(private readonly testimonialsService: TestimonialsService) {}
@Get()
@ApiOperation({ summary: "دریافت لیست نظرات و رضایت‌نامه‌ها" })
findAll() {
return this.testimonialsService.findAll();
}
@Get("homepage")
@ApiOperation({ summary: "دریافت نظرات فعال برای نمایش در صفحه اصلی" })
findHomepage() {
return this.testimonialsService.findHomepage();
}
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles("Admin")
@ApiBearerAuth()
@Post()
@ApiOperation({ summary: "ایجاد نظر جدید (نیازمند ادمین)" })
create(@Body() body: Prisma.TestimonialCreateInput) {
return this.testimonialsService.create(body);
}
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles("Admin")
@ApiBearerAuth()
@Patch(":id")
@ApiOperation({ summary: "ویرایش نظر (نیازمند ادمین)" })
update(@Param("id") id: string, @Body() body: Prisma.TestimonialUpdateInput) {
return this.testimonialsService.update(id, body);
}
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles("Admin")
@ApiBearerAuth()
@Delete(":id")
@ApiOperation({ summary: "حذف نظر (نیازمند ادمین)" })
remove(@Param("id") id: string) {
return this.testimonialsService.remove(id);
}
}