fix(build): resolve linter and tsconfig project service errors, guarantee dist/main existence in start-dev
Deploy Canina / deploy (push) Has been cancelled

This commit is contained in:
parsa aghaei committed 2026-08-18 20:23:59 +03:30
1 parent a291fa0c4a
commit 6362750dea
50 files changed
+12128 -10959

No files matched your search

+22 -4
View File
@@ -1,4 +1,11 @@
import { IsString, IsNotEmpty, IsInt, Min, Max, IsOptional } from 'class-validator';
import {
IsString,
IsNotEmpty,
IsInt,
Min,
Max,
IsOptional,
} from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
export class CreateReviewDto {
@@ -8,17 +15,28 @@ export class CreateReviewDto {
@Max(5)
rating: number;
@ApiProperty({ description: 'متن دیدگاه یا نظر کاربر', example: 'کیفیت عالی و اثربخشی فوق‌العاده' })
@ApiProperty({
description: 'متن دیدگاه یا نظر کاربر',
example: 'کیفیت عالی و اثربخشی فوق‌العاده',
})
@IsString()
@IsNotEmpty({ message: 'متن نظر نمی‌تواند خالی باشد' })
comment: string;
@ApiProperty({ description: 'نام نمایشی کاربر', required: false, example: 'امیر رضایی' })
@ApiProperty({
description: 'نام نمایشی کاربر',
required: false,
example: 'امیر رضایی',
})
@IsString()
@IsOptional()
userName?: string;
@ApiProperty({ description: 'شماره تماس کاربر', required: false, example: '09123456789' })
@ApiProperty({
description: 'شماره تماس کاربر',
required: false,
example: '09123456789',
})
@IsString()
@IsOptional()
userPhone?: string;
+5 -1
View File
@@ -2,7 +2,11 @@ import { IsString, IsIn, IsOptional } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
export class UpdateReviewDto {
@ApiProperty({ description: 'وضعیت بررسی نظر', enum: ['PENDING', 'APPROVED', 'REJECTED'], required: false })
@ApiProperty({
description: 'وضعیت بررسی نظر',
enum: ['PENDING', 'APPROVED', 'REJECTED'],
required: false,
})
@IsString()
@IsIn(['PENDING', 'APPROVED', 'REJECTED'])
@IsOptional()
+25 -6
View File
@@ -1,4 +1,9 @@
import { Injectable, NotFoundException, BadRequestException, Logger } from '@nestjs/common';
import {
Injectable,
NotFoundException,
BadRequestException,
Logger,
} from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import { CreateReviewDto } from './dto/create-review.dto';
import { UpdateReviewDto } from './dto/update-review.dto';
@@ -32,7 +37,9 @@ export class ReviewsService {
});
if (user) {
if (!resolvedName) {
resolvedName = `${user.firstName || ''} ${user.lastName || ''}`.trim() || 'کاربر کنینا';
resolvedName =
`${user.firstName || ''} ${user.lastName || ''}`.trim() ||
'کاربر کنینا';
}
if (!resolvedPhone) {
resolvedPhone = user.mobile;
@@ -58,7 +65,8 @@ export class ReviewsService {
return {
success: true,
message: 'دیدگاه شما با موفقیت ثبت شد و پس از بررسی و تایید کارشناسان در سایت نمایش داده می‌شود.',
message:
'دیدگاه شما با موفقیت ثبت شد و پس از بررسی و تایید کارشناسان در سایت نمایش داده می‌شود.',
data: review,
};
}
@@ -66,7 +74,11 @@ export class ReviewsService {
/**
* 2. Get approved reviews for a single product with pagination and rating statistics
*/
async getProductReviews(productId: string, page: number = 1, limit: number = 10) {
async getProductReviews(
productId: string,
page: number = 1,
limit: number = 10,
) {
const skip = (Math.max(1, page) - 1) * limit;
const [reviews, total, aggregateRating] = await Promise.all([
@@ -157,7 +169,13 @@ export class ReviewsService {
take: limit,
include: {
product: {
select: { id: true, nameFa: true, nameEn: true, slug: true, imageUrl: true },
select: {
id: true,
nameFa: true,
nameEn: true,
slug: true,
imageUrl: true,
},
},
user: {
select: { id: true, firstName: true, lastName: true, mobile: true },
@@ -195,7 +213,8 @@ export class ReviewsService {
where: { id },
data: {
status: dto.status || review.status,
adminReply: dto.adminReply !== undefined ? dto.adminReply : review.adminReply,
adminReply:
dto.adminReply !== undefined ? dto.adminReply : review.adminReply,
},
});