This commit is contained in:
2026-03-11 20:42:34 +03:30
parent 8c5f1d4d49
commit 007db7f9bd
30 changed files with 393 additions and 219 deletions
+6 -2
View File
@@ -1,5 +1,5 @@
import { PrismaService } from '@/prisma/prisma.service'
import { Injectable } from '@nestjs/common'
import { Injectable, NotFoundException } from '@nestjs/common'
import { ResponseMapper } from 'common/response/response-mapper'
import { CreateUserDto, UpdateUserDto } from './dto/user.dto'
@@ -22,6 +22,10 @@ export class AdminUsersService {
const user = await this.prisma.user.findUnique({
where: { id },
})
if (!user) {
throw new NotFoundException('کاربری یافت نشد')
}
return ResponseMapper.single({
...user,
fullname: `${user?.first_name} ${user?.last_name}`,
@@ -33,7 +37,7 @@ export class AdminUsersService {
}
async update(id: string, data: UpdateUserDto) {
return this.prisma.user.update({ where: { id }, data: data as UpdateUserDto })
return this.prisma.user.update({ where: { id }, data })
}
async delete(id: string) {