fix: also take duplicate worker into account
This commit is contained in:
parent
c913b92cd9
commit
b1a1a83051
1 changed files with 6 additions and 1 deletions
|
|
@ -869,7 +869,12 @@ export class QuotationActionController extends Controller {
|
|||
if (!quotation) throw relationError("Quotation");
|
||||
if (ids.employee.length !== employee.length) throw relationError("Worker");
|
||||
if (ids.productService.length !== productService.length) throw relationError("Product");
|
||||
if (quotation._count.worker + body.length > (quotation.workerMax || 0)) {
|
||||
if (
|
||||
quotation._count.worker +
|
||||
body.filter((lhs) => !quotation.worker.find((rhs) => rhs.employeeId === lhs.workerId))
|
||||
.length >
|
||||
(quotation.workerMax || 0)
|
||||
) {
|
||||
if (body.length === 0) return;
|
||||
throw new HttpError(
|
||||
HttpStatus.PRECONDITION_FAILED,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue