feat: complete scheduled publishing, security remediation and DEV_TICKETS implementation
Deploy Canina / deploy (push) Successful in 2m29s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 6s

This commit is contained in:
parsa committed 2026-09-29 01:15:33 +03:30
1 parent d6d4158cbe
commit efb3c473c4
35 files changed
+685 -185

No files matched your search

+9 -4
View File
@@ -13,6 +13,8 @@ import {
} from '@nestjs/common';
import { UsersService } from './users.service';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import { RolesGuard } from '../common/guards/roles.guard';
import { Roles } from '../common/decorators/roles.decorator';
import {
ApiTags,
ApiBearerAuth,
@@ -202,9 +204,11 @@ export class UsersController {
return this.usersService.setDefaultAddress(req.user.id, addressId);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('Admin', 'ADMIN', 'SuperAdmin')
@ApiBearerAuth()
@Post('wallet/top-up')
@ApiOperation({ summary: 'شارژ کیف پول کاربر' })
@ApiOperation({ summary: 'شارژ دستی کیف پول کاربر (فقط مدیر سیستم)' })
@ApiCreatedResponse({
description: 'کیف پول با موفقیت شارژ شد',
schema: {
@@ -222,12 +226,13 @@ export class UsersController {
@ApiBadRequestResponse({ description: 'مبلغ نامعتبر است' })
async topUpWallet(
@Req() req: { user: { id: string } },
@Body() body: { amount: number },
@Body() body: { amount: number; targetUserId?: string },
) {
const amount = Number(body.amount);
if (!amount || amount <= 0) {
throw new BadRequestException('مبلغ شارژ باید بزرگتر از صفر باشد');
}
return this.usersService.topUpWallet(req.user.id, amount);
const targetUserId = body.targetUserId || req.user.id;
return this.usersService.topUpWallet(targetUserId, amount);
}
}
-58
View File
@@ -30,64 +30,6 @@ export class UsersService {
) {}
async findById(id: string) {
if (id === '12345678-1234-1234-1234-123456789012') {
const dbUser = await this.prisma.user.findUnique({
where: { id },
include: {
pets: {
include: {
medicalConditions: true,
reminders: {
include: {
completions: true,
},
},
healthLogs: true,
},
},
orders: {
orderBy: { createdAt: 'desc' },
include: {
orderItems: {
include: { product: true },
},
},
},
addresses: true,
walletTransactions: {
orderBy: { createdAt: 'desc' },
take: 50,
},
},
});
if (dbUser) {
const { password, ...safeUser } = dbUser;
return {
...safeUser,
hasPassword: !!password,
};
}
return {
id: '12345678-1234-1234-1234-123456789012',
firstName: 'مدیر',
lastName: 'سیستم',
email: process.env.ADMIN_EMAIL || 'admin@canina.ir',
mobile: '09120000000',
role: 'Admin',
walletBalance: new Prisma.Decimal(0),
charityDonationTotal: new Prisma.Decimal(0),
pets: [],
orders: [],
addresses: [],
walletTransactions: [],
hasPassword: true,
createdAt: new Date(),
updatedAt: new Date(),
};
}
const user = await this.prisma.user.findUnique({
where: { id },
include: {