refactor!: change typo field and reset migration
This commit is contained in:
parent
d0d59cea0d
commit
0e2cc3cb21
58 changed files with 327 additions and 784 deletions
|
|
@ -79,7 +79,7 @@ export class BranchContactController extends Controller {
|
|||
throw new HttpError(HttpStatus.BAD_REQUEST, "Branch cannot be found.", "branchBadReq");
|
||||
}
|
||||
const record = await prisma.branchContact.create({
|
||||
data: { ...body, branchId, createdBy: req.user.name, updateBy: req.user.name },
|
||||
data: { ...body, branchId, createdBy: req.user.name, updatedBy: req.user.name },
|
||||
});
|
||||
|
||||
this.setStatus(HttpStatus.CREATED);
|
||||
|
|
@ -107,7 +107,7 @@ export class BranchContactController extends Controller {
|
|||
}
|
||||
|
||||
const record = await prisma.branchContact.update({
|
||||
data: { ...body, updateBy: req.user.name },
|
||||
data: { ...body, updatedBy: req.user.name },
|
||||
where: { id: contactId, branchId },
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ export class BranchController extends Controller {
|
|||
subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined },
|
||||
headOffice: { connect: headOfficeId ? { id: headOfficeId } : undefined },
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
@ -403,7 +403,7 @@ export class BranchController extends Controller {
|
|||
connect: headOfficeId ? { id: headOfficeId } : undefined,
|
||||
disconnect: headOfficeId === null || undefined,
|
||||
},
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
where: { id: branchId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ export class BranchUserController extends Controller {
|
|||
branchId,
|
||||
userId: v.id,
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
})),
|
||||
}),
|
||||
]);
|
||||
|
|
@ -250,7 +250,7 @@ export class UserBranchController extends Controller {
|
|||
branchId: v.id,
|
||||
userId,
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
})),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ export class CustomerBranchController extends Controller {
|
|||
district: { connect: districtId ? { id: districtId } : undefined },
|
||||
subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined },
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
@ -381,7 +381,7 @@ export class CustomerBranchController extends Controller {
|
|||
disconnect: subDistrictId === null || undefined,
|
||||
},
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -306,12 +306,12 @@ export class CustomerController extends Controller {
|
|||
branchNo: i + 1,
|
||||
code: `${last.key.slice(9)}${last.value.toString().padStart(6, "0")}-${(i + 1).toString().padStart(2, "0")}`,
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
})) || [],
|
||||
},
|
||||
},
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
@ -437,19 +437,19 @@ export class CustomerController extends Controller {
|
|||
branchNo: i + 1,
|
||||
code: `${customer.code}-${(i + 1).toString().padStart(2, "0")}`,
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
id: undefined,
|
||||
},
|
||||
update: {
|
||||
...v,
|
||||
branchNo: i + 1,
|
||||
code: `${customer.code}-${(i + 1).toString().padStart(2, "0")}`,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
})),
|
||||
}) ||
|
||||
undefined,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
})
|
||||
.then((v) => {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export class EmployeeCheckupController extends Controller {
|
|||
province: { connect: provinceId ? { id: provinceId } : undefined },
|
||||
employee: { connect: { id: employeeId } },
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ export class EmployeeCheckupController extends Controller {
|
|||
...rest,
|
||||
province: { connect: provinceId ? { id: provinceId } : undefined },
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -419,7 +419,7 @@ export class EmployeeController extends Controller {
|
|||
subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined },
|
||||
customerBranch: { connect: { id: customerBranchId } },
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
@ -578,12 +578,12 @@ export class EmployeeController extends Controller {
|
|||
create: {
|
||||
...v,
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
id: undefined,
|
||||
},
|
||||
update: {
|
||||
...v,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
})),
|
||||
}
|
||||
|
|
@ -601,12 +601,12 @@ export class EmployeeController extends Controller {
|
|||
create: {
|
||||
...v,
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
id: undefined,
|
||||
},
|
||||
update: {
|
||||
...v,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
})),
|
||||
}
|
||||
|
|
@ -630,7 +630,7 @@ export class EmployeeController extends Controller {
|
|||
disconnect: subDistrictId === null || undefined,
|
||||
},
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export class EmployeeOtherInfo extends Controller {
|
|||
...body,
|
||||
employee: { connect: { id: employeeId } },
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ export class EmployeeOtherInfo extends Controller {
|
|||
|
||||
const record = await prisma.employeeOtherInfo.update({
|
||||
where: { id: otherInfoId, employeeId },
|
||||
data: { ...body, createdBy: req.user.name, updateBy: req.user.name },
|
||||
data: { ...body, createdBy: req.user.name, updatedBy: req.user.name },
|
||||
});
|
||||
|
||||
this.setStatus(HttpStatus.CREATED);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ export class EmployeeWorkController extends Controller {
|
|||
...body,
|
||||
employee: { connect: { id: employeeId } },
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ export class EmployeeWorkController extends Controller {
|
|||
|
||||
const record = await prisma.employeeWork.update({
|
||||
where: { id: workId, employeeId },
|
||||
data: { ...body, createdBy: req.user.name, updateBy: req.user.name },
|
||||
data: { ...body, createdBy: req.user.name, updatedBy: req.user.name },
|
||||
});
|
||||
|
||||
this.setStatus(HttpStatus.CREATED);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export class ProductServiceController extends Controller {
|
|||
"productTypeId",
|
||||
"createdBy",
|
||||
"createdAt",
|
||||
"updateBy",
|
||||
"updatedBy",
|
||||
"updatedAt",
|
||||
'product' as "type"
|
||||
FROM "Product"
|
||||
|
|
@ -49,7 +49,7 @@ export class ProductServiceController extends Controller {
|
|||
null as "productTypeId",
|
||||
"createdBy",
|
||||
"createdAt",
|
||||
"updateBy",
|
||||
"updatedBy",
|
||||
"updatedAt",
|
||||
'service' as "type"
|
||||
FROM "Service"
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ export class ProductGroup extends Controller {
|
|||
statusOrder: +(body.status === "INACTIVE"),
|
||||
code: `G${last.value.toString().padStart(2, "0")}`,
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
@ -141,7 +141,7 @@ export class ProductGroup extends Controller {
|
|||
}
|
||||
|
||||
const record = await prisma.productGroup.update({
|
||||
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updateBy: req.user.name },
|
||||
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updatedBy: req.user.name },
|
||||
where: { id: groupId },
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ export class ProductController extends Controller {
|
|||
statusOrder: +(body.status === "INACTIVE"),
|
||||
code: `${body.code.toLocaleUpperCase()}${last.value.toString().padStart(3, "0")}`,
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
@ -230,7 +230,7 @@ export class ProductController extends Controller {
|
|||
}
|
||||
|
||||
const record = await prisma.product.update({
|
||||
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updateBy: req.user.name },
|
||||
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updatedBy: req.user.name },
|
||||
where: { id: productId },
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ export class ProductType extends Controller {
|
|||
statusOrder: +(body.status === "INACTIVE"),
|
||||
code: `T${productGroup.code}${last.value.toString().padStart(2, "0")}`,
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
@ -173,7 +173,7 @@ export class ProductType extends Controller {
|
|||
}
|
||||
|
||||
const record = await prisma.productType.update({
|
||||
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updateBy: req.user.name },
|
||||
data: { ...body, statusOrder: +(body.status === "INACTIVE"), updatedBy: req.user.name },
|
||||
where: { id: typeId },
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ export class ServiceController extends Controller {
|
|||
code: `${body.code.toLocaleUpperCase()}${last.value.toString().padStart(3, "0")}`,
|
||||
work: { connect: workList.map((v) => ({ id: v.id })) },
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
@ -308,7 +308,7 @@ export class ServiceController extends Controller {
|
|||
deleteMany: {},
|
||||
connect: workList.map((v) => ({ id: v.id })),
|
||||
},
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
where: { id: serviceId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ export class UserController extends Controller {
|
|||
district: { connect: districtId ? { id: districtId } : undefined },
|
||||
subDistrict: { connect: subDistrictId ? { id: subDistrictId } : undefined },
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -438,7 +438,7 @@ export class UserController extends Controller {
|
|||
connect: subDistrictId ? { id: subDistrictId } : undefined,
|
||||
disconnect: subDistrictId === null || undefined,
|
||||
},
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
where: { id: userId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -184,12 +184,12 @@ export class WorkController extends Controller {
|
|||
order: i + 1,
|
||||
productId: v,
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
})),
|
||||
},
|
||||
},
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -282,12 +282,12 @@ export class WorkController extends Controller {
|
|||
order: i + 1,
|
||||
productId: v,
|
||||
createdBy: req.user.name,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
})),
|
||||
}
|
||||
: undefined,
|
||||
updateBy: req.user.name,
|
||||
updatedBy: req.user.name,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue