feat: complete scheduled publishing, security remediation and DEV_TICKETS implementation
This commit is contained in:
1 parent
d6d4158cbe
commit
efb3c473c4
35 files changed
+685
-185
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user