Added office to customer creation

This commit is contained in:
Vins 2024-05-29 09:33:38 +02:00
parent 74b4f7f582
commit 0e9aa692a6

View File

@ -60,6 +60,8 @@ export default class CustomersController extends ApiController {
try { try {
//init IUser resource with request body values //init IUser resource with request body values
const customerEntity = Customer.hydrate<Customer>(req.body); const customerEntity = Customer.hydrate<Customer>(req.body);
const officeId: string = req.body.user.office_Id;
customerEntity.office = { uid: officeId } as any;
//validate user //validate user
try { try {
await validateOrReject(customerEntity, { groups: ["createCustomer"], forbidUnknownValues: false }); await validateOrReject(customerEntity, { groups: ["createCustomer"], forbidUnknownValues: false });