feat: filter out if add new employee have no desired product

This commit is contained in:
Methapon2001 2024-12-27 09:57:50 +07:00
parent 614da2e452
commit f4bbfbbc08

View file

@ -958,7 +958,9 @@ export class QuotationActionController extends Controller {
? {
create: body
.filter(
(lhs) => !quotation.worker.find((rhs) => rhs.employeeId === lhs.workerId),
(lhs) =>
!quotation.worker.find((rhs) => rhs.employeeId === lhs.workerId) &&
lhs.productServiceId.length > 0,
)
.map((v, i) => ({
code: `TR${year}${month}${(lastRequest.value - quotation._count.worker + i + 1).toString().padStart(6, "0")}`,