Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
92442d5
feat(calendar): modal form, toast improvements, pagination; prepare f…
Nov 17, 2025
e8c9a22
feat(calendar): attempt FullCalendar UMD via CDN; add wrapper and fal…
Nov 17, 2025
126288a
chore(frontend): remove local fullcalendar packages, use CDN UMD; upd…
Nov 17, 2025
e0c4907
fix(dashboard): replace accidental Login component with Dashboard view
Nov 17, 2025
0e35968
docs: add REQUIREMENTS.md (requisitos funcionales pulidos)
Nov 18, 2025
97e4f9f
docs: link REQUIREMENTS.md from README
Nov 18, 2025
24f78aa
feat(users): add basic user endpoints (list, get, update, set role)
Nov 18, 2025
6360be7
chore: remove frontend/node_modules from index and add .gitignore
Nov 18, 2025
746ee10
feat(users): add pagination to GET /api/users with meta (page, per_pa…
Nov 18, 2025
2f287cb
test(courses): add pagination tests for GET /api/courses
Nov 19, 2025
8e2b2b1
test(courses): fix duplicated tests
Nov 19, 2025
2c8d2a1
fix(courses): interpolate LIMIT/OFFSET to avoid mysql placeholder error
Nov 19, 2025
6b655fc
ci(tests): add GitHub Actions workflow for backend tests
Nov 19, 2025
a96a0f7
test(users): add PUT user and role-assignment access control tests
Nov 19, 2025
af3b525
test(users): accept 500 for admin PUT when DB schema missing
Nov 19, 2025
0b78f23
test(e2e): añadir test E2E (.mjs) y configuración de Jest; añadir scr…
Nov 27, 2025
dcc2d94
feat(representatives): add frontend RepresentativeDashboard and route…
Nov 28, 2025
3324836
chore(pr): add PR draft + template for representatives feature
Nov 28, 2025
79c7e6b
feat(representatives): add Toast and confirmations to RepresentativeD…
Nov 28, 2025
ec5cf07
e2e(playwright): estabilizar smoke tests; añadir intercepts y permiti…
Dec 2, 2025
e5c2545
chore(openapi): add OpenAPI stub and README to start Phase 2
Dec 2, 2025
e2d7386
feat(openapi): expand API-first spec for users, imports, course struc…
Dec 2, 2025
aefdea6
feat(phase3): add messaging, cohorts and calendar admin scaffolding +…
Dec 2, 2025
4c689ee
test: fix duplicated tests, hoist mocks and exclude e2e from vitest
Dec 3, 2025
3c5f0ec
ci: add GitHub Action to run Vitest and Playwright E2E (start mock + …
Dec 3, 2025
e961e96
docs(e2e): add README with local run instructions
Dec 3, 2025
7750b13
chore(e2e): add run-e2e.sh helper and document it in README
Dec 3, 2025
79b18ed
ci: use run-e2e.sh helper to start servers and run Playwright E2E
Dec 3, 2025
ff812b6
ci: scope npm cache to frontend lockfile
Dec 3, 2025
31813b2
chore(frontend): update package-lock.json to match package.json
Dec 3, 2025
e07eda8
test(ci): import vitest globals in tests and increase testTimeout
Dec 3, 2025
6d3557c
ci: wait for mock /api/subjects in run-e2e.sh to avoid 404 root
Dec 3, 2025
b5f3a3b
test: robust jsdom alert shim in setupTests
Dec 5, 2025
a518c1a
Merge feat/representatives into master (auto-resolve frontend and bac…
Dec 6, 2025
0d51783
chore: prefer feat/representatives package.json and package-lock.json…
Dec 6, 2025
2a790c9
Version post Accidente: recovery, seeders, admin dashboard y fixes
Jan 19, 2026
c7681ee
CI: run jest with explicit config to avoid multiple-config error
Jan 19, 2026
4cfc0ed
CI: wait for /health before running tests; start backend with NODE_EN…
Jan 19, 2026
aa2d4b2
ci: prefer IPv4 and set TEST_BASE_URL; server: bind HOST and allow FO…
Jan 21, 2026
d4e6bea
ci: set NODE_OPTIONS and TEST_BASE_URL at job env
Jan 21, 2026
d0ef2a4
ci: preparar backend antes de E2E; ajustar Playwright E2E timing y lo…
Jan 25, 2026
e9a6106
teacher: mis cursos + actividades rapidas; ensure_schema y migracion
Jan 26, 2026
6071523
student: mis tareas y entregas; endpoints my assignments/submissions
Jan 26, 2026
23971c9
ci: start backend in backend-tests, wait for /api/health; disable rat…
Jan 26, 2026
c267845
ci: trigger workflows after health endpoint fix
Jan 27, 2026
6ad1101
ci: pass JWT_SECRET to backend server
Jan 27, 2026
6fe5eec
ci: add mysql service, run migrations/seed, pass DB env
Jan 27, 2026
9358ff9
ci/migrations: add assignments table before submissions; switch to No…
Jan 27, 2026
642c322
test(frontend): mock axios api and set password input to avoid prompt…
Jan 27, 2026
7937062
docs(bitacora): add per-role evaluation and quick wins
Jan 28, 2026
8c23cb4
admin: add health panel and role filter; stabilize tests
Feb 4, 2026
9acfa71
test/admin: align calendar admin UI + user admin test labels
Feb 4, 2026
cd672f9
admin: add reset-password endpoint and UI
Feb 4, 2026
29c14f2
docs(bitacora): record reset-password change
Feb 4, 2026
e853719
ux: move ErrorBoundary to app entry
Feb 4, 2026
3379de1
teacher: submissions inbox uses real API
Feb 4, 2026
457a1f6
student: improve submissions feedback UI
Feb 4, 2026
2bf8eef
admin: export audits as CSV
Feb 4, 2026
c82fd20
feat: importar usuarios por CSV
Feb 4, 2026
1ff9606
chore: registrar CI en verde
Feb 5, 2026
0a5933f
feat: mejorar flujo de representantes
Feb 5, 2026
29f5e2c
test: ajustar RepresentativeDashboard
Feb 5, 2026
165069d
fix: corregir solicitud en RepresentativeDashboard
Feb 5, 2026
03166a5
chore: registrar CI verde representantes
Feb 5, 2026
a7af320
feat: importar inscripciones por CSV
Feb 5, 2026
970a628
feat: reglas de visibilidad en calendario
Feb 5, 2026
7c0d993
test: flujo e2e representantes
Feb 5, 2026
31bd5de
feat: preferencias de notificaciones
Feb 5, 2026
e959aab
feat: feature flags y rollout
Feb 5, 2026
fd8098f
fix: compatibilidad FK notification_settings
Feb 5, 2026
6a9c50b
chore: registrar CI verde migraciones
Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Qué hace este PR

- Añade el soporte inicial para el rol Representante: DB, endpoints, tests y UI mínima.

## Checklist técnico
- [ ] Migraciones incluidas en `database/migrations`.
- [ ] Tests unitarios e integración pasan (Jest).
- [ ] Documentación mínima incluida (`PULL_REQUEST.md`).
- [ ] Revisiones de seguridad y privacidad realizadas.

## Cómo probar localmente
Ver `PULL_REQUEST.md` en la raíz para pasos de ejecución.

## Notas
- Si la base remota no permite push, crear PR desde la interfaz web con este contenido.
102 changes: 102 additions & 0 deletions .github/workflows/backend-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Backend tests

on:
push:
paths:
- 'backend/**'
- 'database/**'
pull_request:
paths:
- 'backend/**'
- 'database/**'

jobs:
test-backend:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: smartstudio_lms
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot --silent"
--health-interval=5s
--health-timeout=5s
--health-retries=20

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Wait for MySQL
run: |
for i in {1..30}; do
if mysqladmin ping -h 127.0.0.1 -uroot -proot --silent; then
echo "MySQL is up"; break
fi
echo "Waiting for MySQL... ($i)"; sleep 2
done

- name: Install backend deps
run: |
cd backend
npm install

- name: Apply DB migrations (Node), ensure schema, seed
env:
DB_HOST: 127.0.0.1
DB_USER: root
DB_PASSWORD: root
DB_NAME: smartstudio_lms
run: |
cd backend
DB_HOST=$DB_HOST DB_USER=$DB_USER DB_PASSWORD=$DB_PASSWORD DB_NAME=$DB_NAME npm run migrate:js
node ./scripts/ensure_schema.js
node scripts/seed_sample_data.js || true
node scripts/seed_additional_data.js || true

- name: Start backend server and wait for /api/health
env:
DB_HOST: 127.0.0.1
DB_USER: root
DB_PASSWORD: root
DB_NAME: smartstudio_lms
RATE_LIMITS_DISABLED: '1'
NODE_ENV: test
JWT_SECRET: test_secret
run: |
cd backend
HOST=0.0.0.0 FORCE_START=1 RATE_LIMITS_DISABLED=$RATE_LIMITS_DISABLED NODE_ENV=$NODE_ENV JWT_SECRET=$JWT_SECRET nohup node server.js > server.log 2>&1 &
export TEST_BASE_URL=http://127.0.0.1:5000
for i in {1..30}; do
if curl -sSf "$TEST_BASE_URL/api/health" >/dev/null 2>&1; then
echo "backend ready"; break
fi
echo "waiting for backend ($i)"; sleep 1
done
if ! curl -sSf "$TEST_BASE_URL/api/health" >/dev/null 2>&1; then
echo "Server failed to start, last server.log:";
tail -n 200 server.log || true
exit 1
fi

- name: Run backend tests
env:
DB_HOST: 127.0.0.1
DB_USER: root
DB_PASSWORD: root
DB_NAME: smartstudio_lms
JWT_SECRET: test_secret
RATE_LIMITS_DISABLED: '1'
TEST_BASE_URL: http://127.0.0.1:5000
run: |
cd backend
npm test --silent
100 changes: 100 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: CI

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: smartstudio_lms
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=10

env:
DB_HOST: 127.0.0.1
DB_USER: root
DB_PASSWORD: root
DB_NAME: smartstudio_lms
RATE_LIMITS_DISABLED: '1'
NODE_ENV: test
NODE_OPTIONS: '--dns-result-order=ipv4first'
TEST_BASE_URL: 'http://127.0.0.1:5000'
JWT_SECRET: test_secret

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install backend dependencies
working-directory: backend
run: npm ci

- name: Apply DB migrations (Node), ensure schema, seed
working-directory: backend
env:
DB_HOST: ${{ env.DB_HOST }}
DB_USER: ${{ env.DB_USER }}
DB_PASSWORD: ${{ env.DB_PASSWORD }}
DB_NAME: ${{ env.DB_NAME }}
run: |
DB_HOST=$DB_HOST DB_USER=$DB_USER DB_PASSWORD=$DB_PASSWORD DB_NAME=$DB_NAME npm run migrate:js
node ./scripts/ensure_schema.js
node scripts/seed_sample_data.js || true
node scripts/seed_additional_data.js || true

- name: Start backend server and wait for /health
working-directory: backend
run: |
# Start server bound to 0.0.0.0 and allow test-mode start, disable rate limits
HOST=0.0.0.0 FORCE_START=1 NODE_ENV=test RATE_LIMITS_DISABLED=1 JWT_SECRET=$JWT_SECRET nohup node server.js > server.log 2>&1 &
# prefer IPv4 for test runner to avoid ::1/localhost ambiguity
export NODE_OPTIONS=--dns-result-order=ipv4first
export TEST_BASE_URL=http://127.0.0.1:5000
# wait for health endpoint
for i in {1..30}; do
if curl -sSf "$TEST_BASE_URL/api/health" >/dev/null 2>&1; then
echo "backend ready"
break
fi
sleep 1
done
# show server log tail if not ready
if ! curl -sSf "$TEST_BASE_URL/api/health" >/dev/null 2>&1; then
echo "Server failed to start, last server.log:";
tail -n 200 server.log || true
exit 1
fi

- name: Run backend tests (Jest)
working-directory: backend
env:
RATE_LIMITS_DISABLED: '1'
NODE_OPTIONS: ${{ env.NODE_OPTIONS }}
TEST_BASE_URL: ${{ env.TEST_BASE_URL }}
run: npm test --silent

- name: Install frontend dependencies
working-directory: frontend
run: npm ci

- name: Run frontend tests (Vitest)
working-directory: frontend
run: npm test --silent
89 changes: 89 additions & 0 deletions .github/workflows/playwright-vitest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: CI - Vitest + Playwright

on:
push:
branches: [ main, feat/representatives ]
pull_request:
branches: [ main, feat/representatives ]

jobs:
test:
name: Run unit tests and Playwright E2E
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: smartstudio_lms
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install frontend dependencies
run: |
cd frontend
npm ci

- name: Prepare and start backend for E2E
run: |
# Install backend deps, apply migrations and ensure supplemental schema
cd backend
npm ci
chmod +x ./scripts/run_migrations.sh
./scripts/run_migrations.sh
node ./scripts/ensure_schema.js
# seed data used by tests
node ./scripts/seed_sample_data.js || true
node ./scripts/seed_additional_data.js || true
# start backend server in background bound to 0.0.0.0
HOST=0.0.0.0 FORCE_START=1 NODE_ENV=test nohup node server.js > ../backend-server.log 2>&1 &
# wait for health endpoint
for i in {1..30}; do
if curl -sSf "http://127.0.0.1:5000/health" >/dev/null 2>&1; then
echo "backend ready"
break
fi
sleep 1
done
if ! curl -sSf "http://127.0.0.1:5000/health" >/dev/null 2>&1; then
echo "Backend failed to start, logs:"; tail -n 200 ../backend-server.log || true; exit 1
fi

- name: Install Playwright browsers
run: |
cd frontend
npx playwright install --with-deps

# Use helper script to start mock + vite and run Playwright

- name: Run unit tests (Vitest)
run: |
cd frontend
npm test --silent

- name: Run Playwright E2E (helper)
run: |
chmod +x frontend/scripts/run-e2e.sh
./frontend/scripts/run-e2e.sh

- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: frontend/e2e/playwright-report
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignorar dependencias de frontend
/frontend/node_modules/
node_modules/
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
CHANGELOG — SmartStudio LMS

2026-01-08 — Seeders, Admin dashboard, tests, recovery

Added
- backend/scripts/seed_sample_data.js — seeds courses, modules, lessons, cohorts, enrollments, assignment.
- backend/scripts/seed_additional_data.js — seeds quiz_submissions, forum_threads/posts, submissions, representatives.
- frontend/src/pages/AdminDashboard.jsx — admin metrics + recent assignments view.
- frontend/src/components/ErrorBoundary.jsx — global React error boundary.
- frontend/src/contexts/ToastContext.jsx and frontend/src/components/ToastContainer.jsx — toast UX for feedback.
- RECOVERY_REPORT.md — report of recovery steps and instructions.
- database/dump_seeded.sql — SQL dump of the seeded DB (snapshot).

Changed
- backend/server.js
- Expanded `/api/admin/summary` to include `forum_threads`, `quiz_submissions`, `assignments` and `recent_assignments`.
- Implemented runtime-checkable rate-limit wrappers so `RATE_LIMITS_DISABLED` can bypass limiters during tests.
- Fixed prepared-statement usage for `LIMIT/OFFSET` in courses pagination.

Tests
- Executed backend tests (Jest) and frontend tests (Vitest). All tests now pass locally after fixes.

Notes
- If you want these changes committed and pushed, tell me which commit message and branch to use.
- For CI, ensure `RATE_LIMITS_DISABLED=1` or whitelist CI IPs to avoid rate-limit flakiness during automated test runs.

Files touched (high level)
- backend/server.js
- backend/scripts/seed_sample_data.js
- backend/scripts/seed_additional_data.js
- backend/tests/* (tests executed)
- frontend/src/pages/AdminDashboard.jsx
- frontend/src/components/ErrorBoundary.jsx
- frontend/src/contexts/ToastContext.jsx
- frontend/src/components/ToastContainer.jsx
- RECOVERY_REPORT.md
- database/dump_seeded.sql

-- End of changelog
42 changes: 42 additions & 0 deletions PULL_REQUEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Pull Request: feat/representatives

Resumen
- Implementa soporte inicial para el rol Representante (DB, API, tests y UI mínima).

Cambios principales
- Migración: `database/migrations/20251128120000_create_representatives_tables.sql` (tables: `representatives`, `consents`, `representative_access_logs`).
- Backend: `backend/routes/representatives.js` (endpoints para solicitar, conceder/revocar consentimiento, listar requests, ver progreso como representante). Registro en `backend/server.js`.
- Tests: `backend/tests/representatives.test.js` (flujo integración).
- Frontend: `frontend/src/pages/RepresentativeDashboard.jsx` y ruta `/representative` en `frontend/src/App.jsx`.

Checklist (DoD)
- [ ] Migraciones incluidas y con rollback documentado (archivo en `/database/migrations`).
- [ ] Tests unit/integration pasan en CI (Jest).
- [ ] UI mínima integrada y accesible desde header.
- [ ] PR description y changelog actualizados.
- [ ] Reviewer asignado (Tech Lead).

Comandos para probar localmente
1. Backend
```bash
cd backend
npm install
set -o allexport; source .env; set +o allexport
./scripts/run_migrations.sh
RATE_LIMITS_DISABLED=1 NODE_ENV=development node server.js
```

2. Frontend
```bash
cd frontend
npm install
npm run dev
```

Notas de seguridad y privacidad
- Todos los accesos por parte de representantes registran filas en `representative_access_logs` y en `audits`.
- El estudiante debe conceder consentimiento explícito; la operación es revocable.

Testing adicional recomendado
- E2E UI: flujo solicitar → conceder → visualizar (Playwright/ Cypress).
- Stress test para endpoints de consent y requests.
Loading