refactor: remover funções, tipos e exports não utilizados

Remove createActionHandler, validateHashToken, decimalSchema,
optionalPeriodSchema, dateStringSchema, amountSchema, FeedbackDialog
standalone, CalendarEventType, parseDateKey, entre outros.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Felipe Coutinho
2026-02-27 15:40:59 +00:00
parent e644d67022
commit 3f3488c8a0
12 changed files with 1 additions and 261 deletions

View File

@@ -12,19 +12,6 @@ export const uuidSchema = (entityName: string = "ID") =>
.string({ message: `${entityName} inválido.` })
.uuid(`${entityName} inválido.`);
/**
* Decimal string schema - parses string with comma/period to number
*/
export const decimalSchema = z
.string()
.trim()
.transform((value) => value.replace(/\s/g, "").replace(",", "."))
.refine(
(value) => !Number.isNaN(Number.parseFloat(value)),
"Informe um valor numérico válido.",
)
.transform((value) => Number.parseFloat(value));
/**
* Optional/nullable decimal string schema
*/
@@ -61,38 +48,6 @@ export const periodSchema = z
.trim()
.regex(/^\d{4}-(0[1-9]|1[0-2])$/, "Período inválido.");
/**
* Optional period schema
*/
export const optionalPeriodSchema = z
.string()
.trim()
.regex(/^(\d{4})-(\d{2})$/, {
message: "Selecione um período válido.",
})
.optional();
/**
* Date string schema
*/
export const dateStringSchema = z
.string({ message: "Informe a data." })
.trim()
.refine((value) => !Number.isNaN(new Date(value).getTime()), {
message: "Data inválida.",
});
/**
* Optional date string schema
*/
export const optionalDateStringSchema = z
.string()
.trim()
.refine((value) => !value || !Number.isNaN(new Date(value).getTime()), {
message: "Informe uma data válida.",
})
.optional();
/**
* Note/observation schema (max 500 chars, trimmed, nullable)
*/
@@ -102,35 +57,3 @@ export const noteSchema = z
.max(500, "A anotação deve ter no máximo 500 caracteres.")
.optional()
.transform((value) => (value && value.length > 0 ? value : null));
/**
* Optional string that becomes null if empty
*/
export const optionalStringToNull = z
.string()
.trim()
.optional()
.transform((value) => (value && value.length > 0 ? value : null));
/**
* Required non-empty string schema
*/
export const requiredStringSchema = (fieldName: string) =>
z
.string({ message: `Informe ${fieldName}.` })
.trim()
.min(1, `Informe ${fieldName}.`);
/**
* Amount schema with minimum value validation
*/
export const amountSchema = z.coerce
.number({ message: "Informe o valor." })
.min(0, "Informe um valor maior ou igual a zero.");
/**
* Positive amount schema
*/
export const positiveAmountSchema = z.coerce
.number({ message: "Informe o valor." })
.positive("Informe um valor maior que zero.");

View File

@@ -64,6 +64,4 @@ export const InsightsResponseSchema = z.object({
/**
* TypeScript types derived from schemas
*/
export type InsightItem = z.infer<typeof InsightItemSchema>;
export type InsightCategory = z.infer<typeof InsightCategorySchema>;
export type InsightsResponse = z.infer<typeof InsightsResponseSchema>;