chore(workspace): eradicate all tsc errors and eslint warnings across frontend, admin, and backend
Deploy Canina / deploy (push) Failing after 29s

This commit is contained in:
parsa committed 2026-08-07 07:39:26 +03:30
1 parent 4659a7b1de
commit 9f11d8fb2d
98 files changed
+1272 -1009

No files matched your search

+11 -8
View File
@@ -78,7 +78,10 @@ export class PetsController {
},
},
})
create(@Req() req: any, @Body() createPetDto: CreatePetDto) {
create(
@Req() req: { user: { id: string } },
@Body() createPetDto: CreatePetDto,
) {
return this.petsService.create(req.user.id, createPetDto);
}
@@ -111,7 +114,7 @@ export class PetsController {
},
},
})
findAll(@Req() req: any, @Query() query: PaginationDto) {
findAll(@Req() req: { user: { id: string } }, @Query() query: PaginationDto) {
return this.petsService.findAllByUser(req.user.id, query);
}
@@ -148,7 +151,7 @@ export class PetsController {
},
},
})
findOne(@Req() req: any, @Param('id') id: string) {
findOne(@Req() req: { user: { id: string } }, @Param('id') id: string) {
return this.petsService.findOne(id, req.user.id);
}
@@ -180,7 +183,7 @@ export class PetsController {
},
})
update(
@Req() req: any,
@Req() req: { user: { id: string } },
@Param('id') id: string,
@Body() updatePetDto: UpdatePetDto,
) {
@@ -209,14 +212,14 @@ export class PetsController {
},
},
})
remove(@Req() req: any, @Param('id') id: string) {
remove(@Req() req: { user: { id: string } }, @Param('id') id: string) {
return this.petsService.remove(id, req.user.id);
}
@Post(':petId/reminders')
@ApiOperation({ summary: 'ثبت یادآور جدید برای پت' })
addReminder(
@Req() req: any,
@Req() req: { user: { id: string } },
@Param('petId') petId: string,
@Body() createReminderDto: CreateReminderDto,
) {
@@ -226,7 +229,7 @@ export class PetsController {
@Post(':petId/reminders/:reminderId/toggle')
@ApiOperation({ summary: 'تغییر وضعیت انجام یادآور در یک تاریخ خاص' })
toggleReminder(
@Req() req: any,
@Req() req: { user: { id: string } },
@Param('petId') petId: string,
@Param('reminderId') reminderId: string,
@Body('date') date: string,
@@ -242,7 +245,7 @@ export class PetsController {
@Post(':petId/health-logs')
@ApiOperation({ summary: 'ثبت لاگ سلامت جدید برای پت' })
addHealthLog(
@Req() req: any,
@Req() req: { user: { id: string } },
@Param('petId') petId: string,
@Body() createHealthLogDto: CreateHealthLogDto,
) {
+20 -5
View File
@@ -1,9 +1,24 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { Prisma } from '@prisma/client';
import { PrismaService } from '../prisma/prisma.service';
import { PaginationDto } from '../common/dto/pagination.dto';
import { CreatePetDto } from './dto/create-pet.dto';
import { UpdatePetDto } from './dto/update-pet.dto';
export interface ReminderInput {
productId?: string | null;
title: string;
time: string;
frequency: string;
}
export interface HealthLogInput {
appetite: string;
energy: string;
digestion: string;
note?: string | null;
}
@Injectable()
export class PetsService {
constructor(private prisma: PrismaService) {}
@@ -40,7 +55,7 @@ export class PetsService {
sortOrder = 'desc',
} = filters;
const whereClause: any = {};
const whereClause: Prisma.PetWhereInput = {};
if (search) {
whereClause.OR = [
{ name: { contains: search, mode: 'insensitive' } },
@@ -100,7 +115,7 @@ export class PetsService {
sortOrder = 'desc',
} = filters;
const whereClause: any = { userId };
const whereClause: Prisma.PetWhereInput = { userId };
if (search) {
whereClause.OR = [
{ name: { contains: search, mode: 'insensitive' } },
@@ -144,7 +159,7 @@ export class PetsService {
}
async update(id: string, userId: string, updatePetDto: UpdatePetDto) {
await this.findOne(id, userId); // Ensure it exists and belongs to user
await this.findOne(id, userId);
if (updatePetDto.medicalConditions) {
await this.prisma.petMedicalCondition.deleteMany({
@@ -180,7 +195,7 @@ export class PetsService {
});
}
async addReminder(userId: string, petId: string, data: any) {
async addReminder(userId: string, petId: string, data: ReminderInput) {
await this.findOne(petId, userId);
return this.prisma.reminder.create({
data: {
@@ -242,7 +257,7 @@ export class PetsService {
}
}
async addHealthLog(userId: string, petId: string, data: any) {
async addHealthLog(userId: string, petId: string, data: HealthLogInput) {
await this.findOne(petId, userId);
return this.prisma.healthLog.create({
data: {