Merge branch 'dev' into staging

This commit is contained in:
Vins 2024-05-30 16:25:15 +02:00
commit b47a54bdd3

View File

@ -34,8 +34,8 @@ export default class CustomersController extends ApiController {
} }
const officeId: string = req.body.user.office_Id; const officeId: string = req.body.user.office_Id;
if (query.where?.office_folders) delete query.where.office_folders; if (query.where?.office) delete query.where.office;
const customerWhereInput: Prisma.CustomersWhereInput = { ...query.where, office_folders: { some: { office_uid: officeId } } }; const customerWhereInput: Prisma.CustomersWhereInput = { ...query.where, office: { uid: officeId } };
query.where = customerWhereInput; query.where = customerWhereInput;
//call service to get prisma entity //call service to get prisma entity
@ -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 });