feat: app de alumnos sin contraseña (invitación de un solo uso, avisos de falta y pagos informados)

- Acceso del alumno o tutor con link de un solo uso (hash SHA-256, consumo
  atómico, el GET no consume), sesión propia de 90 días deslizante, passkeys
  opcionales (SimpleWebAuthn) y mail de recuperación con rate limit.
- Lado alumno (/i/:token, /acceso, /alumno/*): inicio, clases, avisar falta,
  pagos, informar pago con comprobante (S3 privado, magic bytes) y perfil.
- Lado profe: acceso a la app en la ficha del alumno (invitar/reinvitar),
  "Pagos para verificar" en Cobros con badge, faltas avisadas en la ficha de
  grupo y datos para transferir en Ajustes.
- "Requiere atención" y el recordatorio de WhatsApp excluyen cuotas informadas.
- Zona horaria por defecto: Buenos Aires.
- Migración add_student_access, tests contra Postgres real (test:db) y docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-10-28 15:39:09 -03:00
parent b99bc4d519
commit 060a4f09e4
146 changed files with 7994 additions and 32 deletions

View File

@@ -2,11 +2,15 @@ import type { auth } from '@/modules/auth/auth';
type AuthSession = typeof auth.$Infer.Session;
/** Signed-in student (attendee or guardian): set only on /student-portal. */
export type StudentContext = { accountId: string; sessionId: string };
export type BackendEnv = {
Variables: {
user: AuthSession['user'] | null;
session: AuthSession['session'] | null;
requestId: string;
student: StudentContext | null;
};
};
@@ -15,5 +19,6 @@ declare module 'hono' {
user: AuthSession['user'] | null;
session: AuthSession['session'] | null;
requestId: string;
student: StudentContext | null;
}
}

View File

@@ -57,6 +57,9 @@ export function isPublicApiRequest(method: string, path: string): boolean {
|| matchesPublicPrefix(normalizedPath, '/api/v1/auth')
|| matchesPublicPrefix(normalizedPath, '/api/auth')
|| matchesPublicPrefix(normalizedPath, '/api/v1/invitations')
// Student app: its own cookie and middleware (modules/student-portal), never
// the teacher's session.
|| matchesPublicPrefix(normalizedPath, '/api/v1/student-portal')
);
}