Documentation / @tenancy-node/core / InMemoryTenantRepository
Class: InMemoryTenantRepository
Defined in: core/src/infrastructure/memory/in-memory-tenant-repository.ts:10
Repositorio en memoria. Útil para tests, prototipos y apps sin base central.
Implements
Constructors
Constructor
new InMemoryTenantRepository():
InMemoryTenantRepository
Returns
InMemoryTenantRepository
Methods
exists()
exists(
id):Promise<boolean>
Defined in: core/src/infrastructure/memory/in-memory-tenant-repository.ts:22
true si el id está ocupado, incluso por un tenant eliminado.
Parameters
id
Returns
Promise<boolean>
Implementation of
findById()
findById(
id,options?):Promise<Tenant|undefined>
Defined in: core/src/infrastructure/memory/in-memory-tenant-repository.ts:13
Devuelve el tenant, o undefined si no existe o está eliminado (salvo withDeleted).
Parameters
id
options?
withDeleted?
boolean
Returns
Promise<Tenant | undefined>
Implementation of
insert()
insert(
tenant):Promise<void>
Defined in: core/src/infrastructure/memory/in-memory-tenant-repository.ts:49
Inserta un tenant nuevo. Lanza TenantAlreadyExistsError si el id ya existe (aunque sea en paralelo).
Parameters
tenant
Returns
Promise<void>
Implementation of
list()
Defined in: core/src/infrastructure/memory/in-memory-tenant-repository.ts:26
Parameters
query?
TenantListQuery = {}
Returns
Implementation of
save()
save(
tenant):Promise<void>
Defined in: core/src/infrastructure/memory/in-memory-tenant-repository.ts:54
Guarda los cambios de un tenant existente.
Parameters
tenant
Returns
Promise<void>