fix(api/orders): update master validation logic to handle optional masters
This commit is contained in:
parent
b7a217787d
commit
7f86fc164d
@ -52,10 +52,11 @@ export class OrdersService extends BaseService {
|
||||
throw new Error(ERRORS.INVALID_CLIENT);
|
||||
}
|
||||
|
||||
const masters = await customersService.getMasters(this.customer);
|
||||
const { customers } = await customersService.getMasters(this.customer);
|
||||
const masters = customers.at(0)?.masters;
|
||||
|
||||
const masterId = slot?.master?.documentId;
|
||||
if (!masters.customers.some((master) => master?.documentId === masterId)) {
|
||||
if (!masters?.some((master) => master?.documentId === masterId)) {
|
||||
throw new Error(ERRORS.INVALID_MASTER);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user