template-saas/apps/backend/dist/modules/superadmin/superadmin.service.d.ts
rckrdmrd 50a821a415
Some checks failed
CI / Backend CI (push) Has been cancelled
CI / Frontend CI (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / CI Summary (push) Has been cancelled
[SIMCO-V38] feat: Actualizar a SIMCO v3.8.0
- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8
- Actualizaciones de configuracion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 08:53:08 -06:00

92 lines
2.9 KiB
TypeScript

import { Repository } from 'typeorm';
import { Tenant } from '../tenants/entities/tenant.entity';
import { User } from '../auth/entities/user.entity';
import { Subscription } from '../billing/entities/subscription.entity';
import { CreateTenantDto, UpdateTenantDto, UpdateTenantStatusDto, ListTenantsQueryDto } from './dto';
export interface TenantWithStats extends Tenant {
userCount?: number;
subscription?: Subscription | null;
}
export interface PaginatedResult<T> {
data: T[];
total: number;
page: number;
limit: number;
totalPages: number;
}
export declare class SuperadminService {
private readonly tenantRepository;
private readonly userRepository;
private readonly subscriptionRepository;
constructor(tenantRepository: Repository<Tenant>, userRepository: Repository<User>, subscriptionRepository: Repository<Subscription>);
listTenants(query: ListTenantsQueryDto): Promise<PaginatedResult<TenantWithStats>>;
getTenant(id: string): Promise<TenantWithStats>;
createTenant(dto: CreateTenantDto): Promise<Tenant>;
updateTenant(id: string, dto: UpdateTenantDto): Promise<Tenant>;
updateTenantStatus(id: string, dto: UpdateTenantStatusDto): Promise<Tenant>;
deleteTenant(id: string): Promise<void>;
getTenantUsers(tenantId: string, page?: number, limit?: number): Promise<PaginatedResult<User>>;
getDashboardStats(): Promise<{
totalTenants: number;
activeTenants: number;
trialTenants: number;
suspendedTenants: number;
totalUsers: number;
newTenantsThisMonth: number;
}>;
getTenantGrowth(months?: number): Promise<{
month: string;
count: number;
}[]>;
getUserGrowth(months?: number): Promise<{
month: string;
count: number;
}[]>;
getPlanDistribution(): Promise<{
plan: string;
count: number;
percentage: number;
}[]>;
getStatusDistribution(): Promise<{
status: string;
count: number;
percentage: number;
}[]>;
getTopTenants(limit?: number): Promise<{
id: string;
name: string;
slug: string;
userCount: number;
status: string;
planName: string;
}[]>;
getMetricsSummary(): Promise<{
tenantGrowth: {
month: string;
count: number;
}[];
userGrowth: {
month: string;
count: number;
}[];
planDistribution: {
plan: string;
count: number;
percentage: number;
}[];
statusDistribution: {
status: string;
count: number;
percentage: number;
}[];
topTenants: {
id: string;
name: string;
slug: string;
userCount: number;
status: string;
planName: string;
}[];
}>;
}