import { DeepPartial, FindManyOptions, FindOneOptions, Repository, UpdateResult } from 'typeorm'; import { IBasePerTenantAndOrganizationEntityModel, ID } from '@metad/contracts'; import { TenantOrganizationBaseEntity, User } from '../entities/internal'; import { ICrudService } from './icrud.service'; import { TenantAwareCrudService } from './tenant-aware-crud.service'; import { ITryRequest } from './try-request'; import { FindOptionsWhere } from './FindOptionsWhere'; /** * This abstract class adds tenantId and organizationId to all query filters if a user is available in the current RequestContext * If a user is not available in RequestContext, then it behaves exactly the same as CrudService */ export declare abstract class TenantOrganizationAwareCrudService extends TenantAwareCrudService implements ICrudService { protected readonly repository: Repository; protected constructor(repository: Repository); protected findConditionsWithTenantByUser(user: User): FindOptionsWhere; protected findConditionsWithTenant(user: User, where?: FindOptionsWhere | FindOptionsWhere[]): FindOptionsWhere | FindOptionsWhere[]; private findConditionsWithoutOrgByUser; private findConditionsWithoutOrg; private findManyWithoutOrganization; findAllWithoutOrganization(filter?: FindManyOptions): Promise<{ items: T[]; total: number; }>; /** * @internal */ findOneOrFailWithoutOrg(id: ID | FindOneOptions | FindOptionsWhere, options?: FindOneOptions): Promise; /** * Try to find T entity in organization or tenant */ findOneInOrganizationOrTenant(id: string, options?: FindOneOptions): Promise; findAllInOrganizationOrTenant(options?: FindManyOptions): Promise<{ total: number; items: T[]; }>; create(entity: DeepPartial, ...options: any[]): Promise; /** * Alternatively, You can recover the soft deleted rows by using the restore() method: */ restoreSoftDelete(id: string, options?: IBasePerTenantAndOrganizationEntityModel): Promise; }