feat: shared between company
This commit is contained in:
parent
2fff5f7e47
commit
2c8faef25c
3 changed files with 67 additions and 14 deletions
|
|
@ -226,6 +226,17 @@ export class ProductGroup extends Controller {
|
|||
);
|
||||
}
|
||||
|
||||
let companyBefore = (record.registeredBranch.headOffice || record.registeredBranch).code;
|
||||
let companyAfter = branch ? (branch.headOffice || branch).code : false;
|
||||
|
||||
if (companyBefore && companyAfter && companyBefore !== companyAfter) {
|
||||
throw new HttpError(
|
||||
HttpStatus.BAD_REQUEST,
|
||||
"Cannot move between different headoffice",
|
||||
"crossCompanyNotPermit",
|
||||
);
|
||||
}
|
||||
|
||||
const result = await prisma.productGroup.update({
|
||||
include: {
|
||||
createdBy: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue