import { HttpStatus, UnprocessableEntityException } from '@nestjs/common'; export async function validateRelation(dataService, id) { const haveRelation = await dataService.getOneByOptions({ where: { bundling_items: { id: id, }, }, }); if (haveRelation) { throw new UnprocessableEntityException({ statusCode: HttpStatus.UNPROCESSABLE_ENTITY, message: `Gagal! data telah digunakan untuk bundling`, error: 'Unprocessable Entity', }); } }