style: apply standard ESLint & Prettier formatting across backend
Deploy Canina / deploy (push) Successful in 4m58s

This commit is contained in:
parsa aghaei committed 2026-07-29 15:41:53 +03:30
1 parent ae636c8b03
commit 62bd8811fa
66 files changed
+1398 -607

No files matched your search

+27 -5
View File
@@ -1,6 +1,19 @@
import { Controller, Get, Post, Put, Delete, Body, Param, UseGuards } from '@nestjs/common';
import {
Controller,
Get,
Post,
Put,
Delete,
Body,
Param,
UseGuards,
} from '@nestjs/common';
import { CmsService } from './cms.service';
import { CreateHeroBannerDto, CreateVetTestimonialDto, CreateSmartAdvisorRuleDto } from './dto/cms.dto';
import {
CreateHeroBannerDto,
CreateVetTestimonialDto,
CreateSmartAdvisorRuleDto,
} from './dto/cms.dto';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import { RolesGuard } from '../auth/roles.guard';
@@ -29,7 +42,10 @@ export class CmsController {
@Put('hero-banners/:id')
@ApiOperation({ summary: 'ویرایش بنر هیرو' })
updateHeroBanner(@Param('id') id: string, @Body() dto: Partial<CreateHeroBannerDto>) {
updateHeroBanner(
@Param('id') id: string,
@Body() dto: Partial<CreateHeroBannerDto>,
) {
return this.cmsService.updateHeroBanner(id, dto);
}
@@ -54,7 +70,10 @@ export class CmsController {
@Put('vet-testimonials/:id')
@ApiOperation({ summary: 'ویرایش نظر دامپزشک' })
updateVetTestimonial(@Param('id') id: string, @Body() dto: Partial<CreateVetTestimonialDto>) {
updateVetTestimonial(
@Param('id') id: string,
@Body() dto: Partial<CreateVetTestimonialDto>,
) {
return this.cmsService.updateVetTestimonial(id, dto);
}
@@ -79,7 +98,10 @@ export class CmsController {
@Put('smart-advisor-rules/:id')
@ApiOperation({ summary: 'ویرایش قانون مشاوره هوشمند' })
updateSmartAdvisorRule(@Param('id') id: string, @Body() dto: Partial<CreateSmartAdvisorRuleDto>) {
updateSmartAdvisorRule(
@Param('id') id: string,
@Body() dto: Partial<CreateSmartAdvisorRuleDto>,
) {
return this.cmsService.updateSmartAdvisorRule(id, dto);
}
+19 -5
View File
@@ -1,6 +1,10 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import { CreateHeroBannerDto, CreateVetTestimonialDto, CreateSmartAdvisorRuleDto } from './dto/cms.dto';
import {
CreateHeroBannerDto,
CreateVetTestimonialDto,
CreateSmartAdvisorRuleDto,
} from './dto/cms.dto';
@Injectable()
export class CmsService {
@@ -38,8 +42,13 @@ export class CmsService {
return this.prisma.vetTestimonial.create({ data: dto });
}
async updateVetTestimonial(id: string, dto: Partial<CreateVetTestimonialDto>) {
const exists = await this.prisma.vetTestimonial.findUnique({ where: { id } });
async updateVetTestimonial(
id: string,
dto: Partial<CreateVetTestimonialDto>,
) {
const exists = await this.prisma.vetTestimonial.findUnique({
where: { id },
});
if (!exists) throw new NotFoundException('Vet testimonial not found');
return this.prisma.vetTestimonial.update({ where: { id }, data: dto });
}
@@ -59,8 +68,13 @@ export class CmsService {
return this.prisma.smartAdvisorRule.create({ data: dto });
}
async updateSmartAdvisorRule(id: string, dto: Partial<CreateSmartAdvisorRuleDto>) {
const exists = await this.prisma.smartAdvisorRule.findUnique({ where: { id } });
async updateSmartAdvisorRule(
id: string,
dto: Partial<CreateSmartAdvisorRuleDto>,
) {
const exists = await this.prisma.smartAdvisorRule.findUnique({
where: { id },
});
if (!exists) throw new NotFoundException('Smart advisor rule not found');
return this.prisma.smartAdvisorRule.update({ where: { id }, data: dto });
}
+7 -1
View File
@@ -1,4 +1,10 @@
import { IsString, IsOptional, IsBoolean, IsNumber, IsUUID } from 'class-validator';
import {
IsString,
IsOptional,
IsBoolean,
IsNumber,
IsUUID,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
export class CreateHeroBannerDto {