تغییرات کلی در backend و frontend

This commit is contained in:
parsa aghaei committed 2026-07-11 12:30:17 +03:30
1 parent a74f4bda48
commit 3dedc89ee1
41 files changed
+2373 -1957

No files matched your search

+27 -1
View File
@@ -1,4 +1,4 @@
import { Controller, Get, Patch, Post, Delete, Body, Param, UseGuards, Req, HttpStatus } from '@nestjs/common';
import { Controller, Get, Patch, Post, Delete, Body, Param, UseGuards, Req, HttpStatus, BadRequestException } from '@nestjs/common';
import { UsersService } from './users.service';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import { ApiTags, ApiBearerAuth, ApiOperation, ApiResponse, ApiOkResponse, ApiCreatedResponse, ApiBadRequestResponse } from '@nestjs/swagger';
@@ -169,4 +169,30 @@ export class UsersController {
setDefaultAddress(@Req() req: any, @Param('addressId') addressId: string) {
return this.usersService.setDefaultAddress(req.user.id, addressId);
}
@UseGuards(JwtAuthGuard)
@Post('wallet/top-up')
@ApiOperation({ summary: 'شارژ کیف پول کاربر' })
@ApiCreatedResponse({
description: 'کیف پول با موفقیت شارژ شد',
schema: {
example: {
id: 'txn-uuid',
userId: 'user-uuid',
amount: '500000.00',
type: 'deposit',
status: 'completed',
description: 'شارژ کیف پول',
createdAt: '2026-07-11T08:00:00.000Z'
}
}
})
@ApiBadRequestResponse({ description: 'مبلغ نامعتبر است' })
async topUpWallet(@Req() req: any, @Body() body: { amount: number }) {
const amount = Number(body.amount);
if (!amount || amount <= 0) {
throw new BadRequestException('مبلغ شارژ باید بزرگتر از صفر باشد');
}
return this.usersService.topUpWallet(req.user.id, amount);
}
}