fix(model):users-management fix
This commit is contained in:
parent
de5dbb1d1b
commit
012fd83517
|
|
@ -2,7 +2,6 @@ import { Injectable, NotFoundException } from "@nestjs/common";
|
|||
import { PrismaService } from "src/prisma/prisma.service";
|
||||
import { CreateShiftDto } from "../dtos/create-shifts.dto";
|
||||
import { Shifts } from "@prisma/client";
|
||||
import { notDeepEqual } from "assert";
|
||||
import { UpdateShiftsDto } from "../dtos/update-shifts.dto";
|
||||
|
||||
@Injectable()
|
||||
|
|
@ -26,7 +25,7 @@ export class ShiftsService {
|
|||
end_time
|
||||
},
|
||||
include: {
|
||||
timesheet: {
|
||||
shift: {
|
||||
include: {
|
||||
employee: {
|
||||
include: { user: true }
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@ export abstract class AbstractUserService {
|
|||
return this.prisma.users.findMany();
|
||||
}
|
||||
|
||||
async findOne(user_id: number): Promise<Users> {
|
||||
const user = await this.prisma.users.findUnique({ where: { user_id } });
|
||||
async findOne(id: string): Promise<Users> {
|
||||
const user = await this.prisma.users.findUnique({ where: { id } });
|
||||
if (!user) {
|
||||
throw new NotFoundException(`User #${user_id} not found`);
|
||||
throw new NotFoundException(`User #${id} not found`);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
async remove(user_id: number): Promise<Users> {
|
||||
await this.findOne(user_id);
|
||||
return this.prisma.users.delete({ where: { user_id } });
|
||||
async remove(id: string): Promise<Users> {
|
||||
await this.findOne(id);
|
||||
return this.prisma.users.delete({ where: { id } });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ import { PrismaModule } from 'src/prisma/prisma.module';
|
|||
@Module({
|
||||
imports: [PrismaModule],
|
||||
providers: [UsersService],
|
||||
controllers: [],
|
||||
exports: [UsersModule],
|
||||
})
|
||||
export class UsersModule {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user