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