21 lines
724 B
TypeScript
21 lines
724 B
TypeScript
/**
|
|
* Repository for TenantAgentConfig.
|
|
* Extends TenantAwareRepository for schema-per-tenant isolation (SET search_path).
|
|
*/
|
|
import { Injectable } from '@nestjs/common';
|
|
import { DataSource } from 'typeorm';
|
|
import { TenantAwareRepository } from '@it0/database';
|
|
import { TenantAgentConfig } from '../../domain/entities/tenant-agent-config.entity';
|
|
|
|
@Injectable()
|
|
export class TenantAgentConfigRepository extends TenantAwareRepository<TenantAgentConfig> {
|
|
constructor(dataSource: DataSource) {
|
|
super(dataSource, TenantAgentConfig);
|
|
}
|
|
|
|
async findByTenantId(tenantId: string): Promise<TenantAgentConfig | null> {
|
|
const repo = await this.getRepository();
|
|
return repo.findOneBy({ tenantId } as any);
|
|
}
|
|
}
|