sinka/api/src/tenancy/public-tenant.ts

17 lines
428 B
TypeScript

import { NotFoundException } from '@nestjs/common';
export type PublicTenant = {
name: string;
slug: string;
status: string;
};
export function publicTenantView(
tenant: { name: string; slug: string; status: string } | null,
): PublicTenant {
if (!tenant) {
throw new NotFoundException('Este cliente não existe.');
}
return { name: tenant.name, slug: tenant.slug, status: tenant.status };
}