feat(i18n): traducir Requiere atención y redactar las alertas en cada idioma
Las alertas de shared suman razon + valores para que la web las redacte; etiqueta/detalle se mantienen en español para el backend. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,30 @@ export type StudentAlertType = z.output<typeof studentAlertTypeSchema>;
|
||||
export const studentAlertSeveritySchema = z.enum(['urgente', 'vigilar']);
|
||||
export type StudentAlertSeverity = z.output<typeof studentAlertSeveritySchema>;
|
||||
|
||||
/** Why the alert fired, so a client can word it in its own language
|
||||
* (`etiqueta`/`detalle` keep the Spanish wording). */
|
||||
export const studentAlertReasonSchema = z.enum([
|
||||
/** N absences in a row (`faltas`). */
|
||||
'racha',
|
||||
/** `faltas` out of the last `clases`. */
|
||||
'ventana',
|
||||
/** The last `faltas` classes (window == streak). */
|
||||
'ultimas',
|
||||
/** Two or more overdue fees (`cuotas`, `vencimientos`). */
|
||||
'cuotas',
|
||||
/** One overdue fee (`vencimientos[0]`). */
|
||||
'cuota',
|
||||
]);
|
||||
export type StudentAlertReason = z.output<typeof studentAlertReasonSchema>;
|
||||
|
||||
export const StudentAlertValuesSchema = z.object({
|
||||
faltas: z.number().int().optional(),
|
||||
clases: z.number().int().optional(),
|
||||
cuotas: z.number().int().optional(),
|
||||
/** Due dates (ISO) of the overdue fees, oldest first. */
|
||||
vencimientos: z.array(z.string()).optional(),
|
||||
});
|
||||
|
||||
export const StudentAlertSchema = z.object({
|
||||
tipo: studentAlertTypeSchema,
|
||||
gravedad: studentAlertSeveritySchema,
|
||||
@@ -19,6 +43,8 @@ export const StudentAlertSchema = z.object({
|
||||
etiqueta: z.string(),
|
||||
/** Natural-language line: "Faltó a 4 de las últimas 6 clases." */
|
||||
detalle: z.string(),
|
||||
razon: studentAlertReasonSchema.optional(),
|
||||
valores: StudentAlertValuesSchema.optional(),
|
||||
/** What the alert is about (last absence / overdue payments). "Resuelto"
|
||||
* stores it, so a new absence or a new overdue fee brings the alert back. */
|
||||
firma: z.string(),
|
||||
|
||||
Reference in New Issue
Block a user