Skip to content

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 ​

TenantId

Returns ​

Promise<boolean>

Implementation of ​

TenantRepository.exists


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 ​

TenantId

options? ​
withDeleted? ​

boolean

Returns ​

Promise<Tenant | undefined>

Implementation of ​

TenantRepository.findById


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 ​

Tenant

Returns ​

Promise<void>

Implementation of ​

TenantRepository.insert


list() ​

list(query?): Promise<Page<Tenant>>

Defined in: core/src/infrastructure/memory/in-memory-tenant-repository.ts:26

Parameters ​

query? ​

TenantListQuery = {}

Returns ​

Promise<Page<Tenant>>

Implementation of ​

TenantRepository.list


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 ​

Tenant

Returns ​

Promise<void>

Implementation of ​

TenantRepository.save

Publicado bajo la licencia MIT.