updating
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user