From bc5f676ceaeac2bf53249ca77d5dde772fcd7f4b Mon Sep 17 00:00:00 2001
From: Jose Selesan
Date: Wed, 28 Oct 2026 15:50:55 -0300
Subject: [PATCH] =?UTF-8?q?refactor(web):=20rutas=20de=20la=20app=20de=20a?=
=?UTF-8?q?lumnos=20en=20ingl=C3=A9s?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
/acceso → /access, /alumno/* → /student/* (welcome, classes, payments,
profile, notify-absence, report-payment). El link del mail de confirmación
pasa a /access/email/:token. AGENTS.md documenta que los paths van en inglés.
Co-Authored-By: Claude Opus 5.5
---
AGENTS.md | 3 +-
.../features/recovery-email/use-case.ts | 2 +-
.../ConfirmRecoveryEmailView.tsx | 2 +-
.../student-access/PasskeyLoginButton.tsx | 2 +-
.../student-access/StudentLinkProvider.tsx | 2 +-
apps/web/src/features/student-app/FeeCard.tsx | 2 +-
.../features/student-app/NextClassCard.tsx | 2 +-
.../student-app/NotifyAbsenceView.tsx | 6 +-
.../student-app/ReportPaymentView.tsx | 4 +-
.../student-app/StudentAppProvider.tsx | 6 +-
.../student-app/StudentClassesView.tsx | 2 +-
.../features/student-app/StudentLayout.tsx | 2 +-
.../student-app/StudentPaymentsView.tsx | 2 +-
.../src/features/student-app/WelcomeView.tsx | 2 +-
.../features/student-app/student-nav-items.ts | 12 +-
apps/web/src/routeTree.gen.ts | 317 +++++++++---------
...{alumno.clases.tsx => student.classes.tsx} | 2 +-
.../{alumno.index.tsx => student.index.tsx} | 2 +-
....avisar.tsx => student.notify-absence.tsx} | 2 +-
...{alumno.pagos.tsx => student.payments.tsx} | 2 +-
...{alumno.perfil.tsx => student.profile.tsx} | 2 +-
...ar-pago.tsx => student.report-payment.tsx} | 2 +-
...mno.bienvenida.tsx => student.welcome.tsx} | 2 +-
...ail.$token.tsx => access.email.$token.tsx} | 2 +-
.../{acceso.index.tsx => access.index.tsx} | 2 +-
25 files changed, 194 insertions(+), 192 deletions(-)
rename apps/web/src/routes/_student/{alumno.clases.tsx => student.classes.tsx} (72%)
rename apps/web/src/routes/_student/{alumno.index.tsx => student.index.tsx} (73%)
rename apps/web/src/routes/_student/{alumno.avisar.tsx => student.notify-absence.tsx} (85%)
rename apps/web/src/routes/_student/{alumno.pagos.tsx => student.payments.tsx} (72%)
rename apps/web/src/routes/_student/{alumno.perfil.tsx => student.profile.tsx} (72%)
rename apps/web/src/routes/_student/{alumno.informar-pago.tsx => student.report-payment.tsx} (69%)
rename apps/web/src/routes/_student/{alumno.bienvenida.tsx => student.welcome.tsx} (69%)
rename apps/web/src/routes/{acceso.mail.$token.tsx => access.email.$token.tsx} (83%)
rename apps/web/src/routes/{acceso.index.tsx => access.index.tsx} (78%)
diff --git a/AGENTS.md b/AGENTS.md
index 6019f4e..528c777 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -65,7 +65,7 @@ bun --filter @gruperly/web icons # regenera los iconos PWA de apps/web
- **zod en v3.24 (pin exacto)**, no v4: `better-call` (transitiva de better-auth) pide `zod ^4` — ese peer warning es conocido y aceptado. `validator` de hono (`hono/validator`) sustituyó a `@hono/zod-validator` (sus tipos duales zod v3/v4 causaban TS2589/exhaustion no resolubles con `ZodTypeAny`); las rutas tipan `c.req.valid` vía el `ValidationInput` derivado del schema.
- **PWA (`apps/web`)**: Workbox precachea todo lo que emite Vite, así que el tamaño del precache es un costo real de arranque offline. Cuatro trampas ya pisadas: (1) `globIgnores: ['**/workbox-*.js']` matchea también `workbox-window.*.js`, que es el módulo cliente de `virtual:pwa-register` — excluirlo rompe el registro del SW en cada carga; solo se excluye `**/sw.js`. (2) Importar `@fontsource-variable/inter/wght.css` arrastra los 7 subsets (~220 KB que el navegador nunca baja); por eso los `@font-face` de `latin`/`latin-ext` están escritos a mano en `src/index.css`. **No re-agregar `` a `fonts.googleapis.com`**: rompe el offline. (3) El SW necesita contexto seguro (HTTPS o `localhost`); por IP de LAN sobre `http://` no se registra y no avisa. (4) El aviso de instalación vive en `PwaProvider` (fuera del `RouterProvider`, así que sigue la ruta con `router.subscribe('onResolved')`) y **no** en `RootLayout`: `AppLayoutGuard` desmonta `RootLayout` cada vez que su query de onboarding vuelve a `pending`, y un `settled` de dwell en el hijo se perdería en cada navegación.
- **Aviso de instalación (`src/features/pwa/`)**: se ofrece solo con **sesión iniciada**, fuera de `/onboarding` y tras **20 s seguidos en la misma ruta** (navegar antes reinicia la cuenta; después de armado ya no se oculta). El descarte es definitivo vía `localStorage['pwa-install-dismissed']`. Ojo: `_authenticated` **no** es un guard de sesión —`AppLayoutGuard` renderiza `RootLayout` aunque no haya `user`—, así que el gate se chequea en el provider. Safari en iOS no dispara `beforeinstallprompt`: ahí se muestra `IosInstallHint` con la instrucción de Compartir → Agregar a pantalla de inicio (excluye CriOS/FxiOS/EdgiOS, que también usan WebKit pero se instalan desde Safari).
-- **App de alumnos (`modules/student-portal`, `modules/student-access`, web `/i/$token`, `/acceso`, `/alumno/*`)**: acceso sin contraseña y sin datos obligatorios nuevos. Ojo con esto:
+- **App de alumnos (`modules/student-portal`, `modules/student-access`, web `/i/$token`, `/access`, `/student/*`)**: acceso sin contraseña y sin datos obligatorios nuevos. Ojo con esto:
1. **No pasa por Better Auth**: tablas propias (`student_*`), cookie propia (`gruperly_student`, `__Host-` con HTTPS, 90 días deslizante, se reescribe como mucho cada 1 h) y middleware propio (`studentSession`). Todo `/api/v1/student-portal` está en `isPublicApiRequest` del profe; cada ruta privada declara `studentSession`. Así una sesión de alumno no llega a endpoints del profe y al revés. Nunca montes rutas del profe bajo `/student-portal`.
2. Tokens de 32 bytes base64url; **en la base solo el SHA-256**. Invitación 72 h, recuperación 15 min, confirmación de mail 24 h. El **GET del link no consume** (vistas previas de WhatsApp); el POST consume con `updateMany` condicional (`used_at IS NULL AND revoked_at IS NULL AND expires_at > now`) y `count === 1` gana. Todo link inválido responde el mismo `{ status: 'invalid' }` / 410.
3. **Reinvitar reinicia el acceso**: revoca tokens pendientes y sesiones, **borra las passkeys** y resetea `welcomed_at`.
@@ -81,6 +81,7 @@ bun --filter @gruperly/web icons # regenera los iconos PWA de apps/web
## Convenciones repo-específicas
- **Frontend en español**: copy de UI, comentarios y textos en español.
+- **Paths de rutas en inglés**: aunque el copy esté en español, los segmentos de URL van siempre en inglés, tanto en la web (nombres de archivo en `apps/web/src/routes/`, `createFileRoute`, `to=`/`navigate`) como en la API y en los links que arma el backend (p. ej. `/student/payments`, no `/alumno/pagos`; `/access`, no `/acceso`).
- **Base de datos**: todas las tablas y columnas físicas usan **snake_case**. Los modelos declaran `@@map` (p. ej. `User` → `users`, `WaitlistEntry` → `waitlist_entries`) y todo campo Prisma camelCase que cree una columna debe declarar `@map("nombre_campo")` (p. ej. `createdAt @map("created_at")`). Al agregar un modelo o campo nuevo, incluir siempre el mapping correspondiente sin cambiar la API camelCase de Prisma Client.
- **API** responde errores en **Problem Details RFC 7807** (`application/problem+json`) y resultados como `{ data, pagination }`; los "use cases" devuelven `Result` y nunca lanzan excepciones de dominio.
- **Tailwind v4** con tokens en `@theme` dentro de `apps/web/src/index.css` (p. ej. `--color-accent: #1e90ff`). Se usan como clases auto-generadas: `text-accent`, `bg-success-soft`, etc. Radius por defecto `0.75rem` (`rounded-xl`).
diff --git a/apps/backend/src/modules/student-portal/features/recovery-email/use-case.ts b/apps/backend/src/modules/student-portal/features/recovery-email/use-case.ts
index c1a3476..4bd12d1 100644
--- a/apps/backend/src/modules/student-portal/features/recovery-email/use-case.ts
+++ b/apps/backend/src/modules/student-portal/features/recovery-email/use-case.ts
@@ -75,7 +75,7 @@ export class SetRecoveryEmail {
await sender.sendStudentEmailConfirmation({
email,
name: account.name,
- url: `${webUrl()}/acceso/mail/${token}`,
+ url: `${webUrl()}/access/email/${token}`,
});
} catch (error) {
logger.error({ error, accountId }, 'Student recovery email confirmation could not be sent');
diff --git a/apps/web/src/features/student-access/ConfirmRecoveryEmailView.tsx b/apps/web/src/features/student-access/ConfirmRecoveryEmailView.tsx
index c89b7bb..d38b613 100644
--- a/apps/web/src/features/student-access/ConfirmRecoveryEmailView.tsx
+++ b/apps/web/src/features/student-access/ConfirmRecoveryEmailView.tsx
@@ -24,7 +24,7 @@ export function ConfirmRecoveryEmailView({ token }: { token: string }) {
Si algún día perdés el acceso, pedí un link a {mutation.data.email}.