mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 23:53:05 +00:00
- ~190 findings zerados: knip --fix (grafo corrigido: tests como entries, migrations como consumidores) + delecao guardada dos orfaos (git grep -w antes de deletar) + reparos manuais dos corpos arrow pendurados - pecas nao usadas do kit ui deletadas (PaginationLink/Next/Previous, familias Sidebar/Combobox/Sheet/Drawer/Dialog etc.) - shadcn add recoloca se precisar - acoes mortas removidas (updateCampaignDemandDetails*, *Record orfaos), schemas/tipos mortos (campaignDemandDetailsUpdateSchema, Contact do zod), helpers mortos - tipos de eleicao derivam direto das *_OPTIONS (consts intermediarias eliminadas) - knip.json: rules exports/types/enumMembers=error, duplicates=off (unicos hits: 6 aliases deliberados canUpdateX=canReadX); hints aplicados (payload.config entry redundante, ignores de tsx/sharp/playwright/payload-types desnecessarios) - ledger: linha P2 dos unused exports fechada
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import type { SupporterVoteIntention } from '@/lib/schemas/supporter'
|
|
|
|
type SupporterImportRowStatus =
|
|
| 'ok'
|
|
| 'duplicado_pelo_telefone'
|
|
| 'telefone_invalido'
|
|
| 'municipio_nao_reconhecido'
|
|
| 'nome_invalido'
|
|
| 'intencao_invalida'
|
|
|
|
export type SupporterImportPreviewRowBase = {
|
|
line: number
|
|
nome: string
|
|
telefone: string
|
|
municipio: string
|
|
intencao: string
|
|
}
|
|
|
|
export type SupporterImportOkRow = SupporterImportPreviewRowBase & {
|
|
status: 'ok'
|
|
normalizedPhone: string
|
|
canonicalCity?: string
|
|
voteIntention?: SupporterVoteIntention
|
|
}
|
|
|
|
export type SupporterImportPreviewRow =
|
|
| SupporterImportOkRow
|
|
| (SupporterImportPreviewRowBase & {
|
|
status: Exclude<SupporterImportRowStatus, 'ok'>
|
|
normalizedPhone?: string
|
|
canonicalCity?: string
|
|
voteIntention?: SupporterVoteIntention
|
|
})
|
|
|
|
export type SupporterImportPreviewResult = {
|
|
counts: {
|
|
ok: number
|
|
duplicate: number
|
|
error: number
|
|
}
|
|
/** First N rows for the on-screen preview table (the full set stays server-side). */
|
|
sampleRows: SupporterImportPreviewRow[]
|
|
/** Precomputed CSV of every error row, for the "Baixar relatório de erros" button. */
|
|
errorReportCsv: string
|
|
/** HMAC-signed token that `confirmSupporterImport` exchanges for the staged batch. */
|
|
importToken: string
|
|
}
|
|
|
|
export const isSupporterImportOkRow = (
|
|
row: SupporterImportPreviewRow,
|
|
): row is SupporterImportOkRow => row.status === 'ok'
|
|
|
|
export const isPreviewErrorRow = (row: SupporterImportPreviewRow): boolean =>
|
|
row.status !== 'ok' && row.status !== 'duplicado_pelo_telefone'
|