import { CompositeSpecification, UniqueID } from "@repo/rdx-ddd"; import { CustomerService } from "../../domain"; export class CustomerNotExistsInCompanySpecification extends CompositeSpecification { constructor( private readonly service: CustomerService, private readonly companyId: UniqueID, private readonly transaction?: any ) { super(); } public async isSatisfiedBy(customerId: UniqueID): Promise { const exists = await this.service.existsByIdInCompany( customerId, this.companyId, this.transaction ); return !exists; } }