feat(admin): implement complete User CRUD with create, edit, delete, and direct wallet adjust capabilities
Deploy Canina / deploy (push) Successful in 1m53s

This commit is contained in:
parsa aghaei committed 2026-08-16 15:16:47 +03:30
1 parent 6ae35efb3e
commit ad854a717b
4 files changed
+970 -206

No files matched your search

+37
View File
@@ -19,6 +19,8 @@ import {
ApiQuery,
} from '@nestjs/swagger';
import { CreateUserDto, UpdateUserDto } from './dto/user.dto';
@ApiTags('Admin - مدیریت سیستم')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@@ -43,6 +45,17 @@ export class AdminController {
return { success: true, ...result };
}
@Post('users')
@ApiOperation({ summary: 'ایجاد کاربر جدید توسط ادمین' })
async createUser(@Body() dto: CreateUserDto) {
const user = await this.adminService.createUser(dto);
return {
success: true,
message: 'کاربر جدید با موفقیت ایجاد شد',
data: user,
};
}
@Get('users/:id')
@ApiOperation({ summary: 'جزئیات کاربر' })
async getUserDetails(@Param('id') id: string) {
@@ -50,6 +63,30 @@ export class AdminController {
return { success: true, data };
}
@Put('users/:id')
@ApiOperation({ summary: 'ویرایش مشخصات کامل کاربر' })
async updateUser(
@Param('id') id: string,
@Body() dto: UpdateUserDto,
) {
const user = await this.adminService.updateUser(id, dto);
return {
success: true,
message: 'اطلاعات کاربر با موفقیت ویرایش شد',
data: user,
};
}
@Delete('users/:id')
@ApiOperation({ summary: 'حذف کاربر و داده‌های مرتبط' })
async deleteUser(@Param('id') id: string) {
await this.adminService.deleteUser(id);
return {
success: true,
message: 'کاربر با موفقیت از سیستم حذف شد',
};
}
@Put('users/:id/role')
@ApiOperation({ summary: 'تغییر نقش کاربر' })
async updateUserRole(@Param('id') id: string, @Body('role') role: string) {