import { findOneWithDecryption } from "@open-mercato/shared/lib/encryption/find";
import { SalesOrder } from "../data/entities.js";
class DefaultSalesOrderService {
  constructor(em) {
    this.em = em;
  }
  async findByExternalReference(externalReference, scope) {
    if (!externalReference) return null;
    return findOneWithDecryption(
      this.em,
      SalesOrder,
      {
        externalReference,
        organizationId: scope.organizationId,
        tenantId: scope.tenantId,
        deletedAt: null
      },
      void 0,
      { tenantId: scope.tenantId, organizationId: scope.organizationId }
    );
  }
}
export {
  DefaultSalesOrderService
};
//# sourceMappingURL=salesOrderService.js.map
