fix: employee code
This commit is contained in:
parent
d97b1260cf
commit
d8a6565abe
4 changed files with 28 additions and 28 deletions
|
|
@ -46,7 +46,7 @@ export class EmployeeWorkController extends Controller {
|
|||
where: { id: workId, employeeId },
|
||||
});
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Employee work cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Employee work cannot be found.", "employeeWorkNotFound");
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ export class EmployeeWorkController extends Controller {
|
|||
throw new HttpError(
|
||||
HttpStatus.BAD_REQUEST,
|
||||
"Employee cannot be found.",
|
||||
"missing_or_invalid_parameter",
|
||||
"employeeBadReq",
|
||||
);
|
||||
|
||||
const record = await prisma.employeeWork.create({
|
||||
|
|
@ -86,7 +86,7 @@ export class EmployeeWorkController extends Controller {
|
|||
@Body() body: EmployeeWorkPayload,
|
||||
) {
|
||||
if (!(await prisma.employeeWork.findUnique({ where: { id: workId, employeeId } }))) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Employee work cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Employee work cannot be found.", "employeeWorkNotFound");
|
||||
}
|
||||
|
||||
const record = await prisma.employeeWork.update({
|
||||
|
|
@ -104,7 +104,7 @@ export class EmployeeWorkController extends Controller {
|
|||
const record = await prisma.employeeWork.findFirst({ where: { id: workId, employeeId } });
|
||||
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Employee work cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Employee work cannot be found.", "employeeWorkNotFound");
|
||||
}
|
||||
|
||||
return await prisma.employeeWork.delete({ where: { id: workId, employeeId } });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue