Files
SeConectai_Vendas/frontend/lib/api/alert-logs.ts
T
tiagoandClaude Sonnet 5 323912748f Frontend completo (Etapas 11-18) e extensões de backend (Etapas 13 e 18)
Adiciona o frontend Next.js em frontend/ (setup, design system,
autenticação/tema, layout/navegação, área master, área tenant completa:
clientes, produtos, vendas, recebimentos, whatsapp, e-mail, alertas,
equipe e perfil). Estende o backend de forma aditiva e autorizada:
cookie httpOnly para refresh token (Etapa 13) e CRUD de equipe +
edição de perfil do tenant (Etapa 18, módulo src/modules/equipe/ novo
e PUT /tenant/perfil). Detalhes completos em Etapas/V2/*.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-16 09:41:13 -03:00

36 lines
1.1 KiB
TypeScript

import { apiClient } from '@/lib/api/client';
import { buildQuery, type PaginatedResult } from '@/lib/api/types';
import type { CanalTemplate, TipoTemplate } from '@/lib/api/alert-templates';
export const ALERT_LOG_STATUSES = ['enviado', 'falhou', 'entregue', 'lido'] as const;
export type AlertLogStatus = (typeof ALERT_LOG_STATUSES)[number];
/** Espelha o model `alert_logs` + `include: { template: { tipo } }`. */
export interface AlertLog {
id: string;
tenant_id: string | null;
destinatario_tipo: string;
destinatario_id: string;
canal: CanalTemplate;
template_id: string | null;
conteudo_enviado: string | null;
status: AlertLogStatus;
erro: string | null;
enviado_em: string;
template: { tipo: TipoTemplate } | null;
}
export interface ListAlertLogsParams {
canal?: CanalTemplate;
status?: AlertLogStatus;
data_inicio?: string;
data_fim?: string;
tenant_id?: string;
page?: number;
limit?: number;
}
export function listAlertLogs(params: ListAlertLogsParams) {
return apiClient.get<PaginatedResult<AlertLog>>(`/master/alertas/logs${buildQuery(params)}`);
}