Commit Graph

162 Commits

Author SHA1 Message Date
djalim 6b8b5e6aa3 fix(ci): start postgres with pg_ctlcluster instead of systemctl 2026-04-26 11:30:33 +00:00
djalim d1c3b93755 fix(ci): install postgres via apt-get instead of docker 2026-04-26 11:30:33 +00:00
djalim f42df29f06 fix(ci): use docker run instead of services for postgres 2026-04-26 11:30:33 +00:00
djalim c8b808f509 fix(ci): use bash /dev/tcp for postgres readiness check 2026-04-26 11:30:33 +00:00
djalim fdfdd74894 fix(ci): replace pg_isready with nc for postgres readiness check 2026-04-26 11:30:33 +00:00
djalim 60dde4675c fix(ci): use deno install for unit tests, add postgres readiness check 2026-04-26 11:30:33 +00:00
djalim fef9457795 fix(ci): install npm deps before running unit tests 2026-04-26 11:30:33 +00:00
djalim 6db04045f4 fix(lint): add version to drizzle-orm imports and prefix unused NOT_FOUND 2026-04-26 11:30:33 +00:00
djalim cdd9c0bf06 chore(test): set up integration test framework with postgres
- Generate Drizzle migrations (databases/migrations/)
- Add databases/schema.kit.ts for drizzle-kit (Node-compatible imports)
- Update drizzle.config.ts to use schema.kit.ts
- Add deno tasks: test:unit, test:integration, migrate
- Add tests/helpers/db_integration.ts: testDb, truncateAll, seed helpers
- Add .gitea/workflows/test.yml: CI with postgres service container
- Update lint.yml: run test:unit only (no DB needed)
- Update deploy.yml: add check-code job, gate deploy on it
2026-04-26 11:30:33 +00:00
djalim 980efcfbc3 ci: add Deno code check job and enable lint on develop
Check Deno code / Check Deno code (pull_request) Failing after 9s
Check Deno code / Check Deno code (push) Failing after 6s
2026-04-23 14:29:08 +02:00
anys 66183c2ad8 feat(api): implement UE-Module coefficient update and deletion endpoint
- PUT /ue-modules/{idModule}/{idUE}/{idPromo}: update coeff for
  UE-Module-Promo association
- DELETE /ue-modules/{idModule}/{idUE}/{idPromo}: remove UE-Module-Promo
  association
- requires employee role
2026-04-23 14:01:40 +02:00
anys 9976b9e2b4 feat(api): implement UE-Module association get endpoint
- GET /ue-modules/{idModule}/{idUE}/{idPromo}: recover the detail of an
  ue-module association by its composite key
- requires employee role
2026-04-23 11:57:30 +00:00
Clément Oudelet 457b008ba3 PMPR-46/47 : PUT et DELETE /notes/{numEtud}/{idModule} 2026-04-23 11:56:20 +00:00
anys 22750ba07e feat(api): implement ajustement delete endpoint
- DELETE /ajustements/{numEtud}/{idUE}: remove ajustement from DB
- Requires employee role
- Returns 204 on success
2026-04-23 13:55:24 +02:00
anys 49876339bf feat(api): implement ajustement update endpoint
- PUT /ajustements/{numEtud}/{idUE}: update ajustement valeur
- Requires employee role
2026-04-23 11:48:31 +00:00
Clément Oudelet eeb087ea76 PMPR-36 : DELETE /ues/{idUE} - supprimer une UE 2026-04-23 13:44:43 +02:00
Clément Oudelet 7ad70c4525 GET /notes/{numEtud}/{idModule} - récupérer le détail d'une note pour un étudiant dans un module 2026-04-23 13:11:48 +02:00
Clément Oudelet 79669d60cf PMPR-38 : POST /ue-modules - associer un module à une UE 2026-04-22 20:40:28 +02:00
anys d3f1f433e1 feat(api): implement single ajustement retrieval endpoint
- GET /ajustements/{numEtud}/{idUE}: get ajustement by student numEtud
  and UE id
- Requires employee role
2026-04-22 17:24:39 +00:00
anys 022994e5a7 feat(api): implement ajustements list and create endpoints
- GET /ajustements: list all ajustements with optional numEtud/idUE
  filters
- POST /ajustements: create new ajustement for student in UE
- Both require employee role
2026-04-22 17:24:07 +00:00
Clément Oudelet 33d023986c PMPR-34 : GET /ues/{idUE} - récupérer une UE par son id 2026-04-22 17:20:20 +00:00
Clément Oudelet bbc9ea58e2 PMPR-37 : GET /ue-modules - liste les associations UE-Module 2026-04-22 17:15:54 +00:00
Clément Oudelet 96b7edf77f PMPR-43 : POST /notes - créer une note 2026-04-22 17:14:45 +00:00
anys a19a1e6c13 test(api): remove enseignements unit tests
Unit tests removed as they only used mocks without real value.
2026-04-22 17:13:14 +00:00
anys 2739a01ab5 fix(api): align enseignements route with Fresh file routing
- Replace flat file `[idProf]_[idModule]_[idPromo].ts`
  with nested structure `[idProf]/[idModule]/[idPromo].ts`
- Ensures URL matches `/enseignements/{idProf}/{idModule}/{idPromo}`
2026-04-22 17:13:14 +00:00
anys f3c1f10999 feat(api): implement enseignements CRUD endpoints
Add CRUD API for enseignements (prof-module-promo associations):

- POST /enseignements: Create with validation (201/409)
- GET /enseignements/{idProf}/{idModule}/{idPromo}: Read by composite
  key (200/404)
- DELETE /enseignements/{idProf}/{idModule}/{idPromo}: Delete by
  composite key (204/404)

Access control: Employee-only (403 Forbidden)
Tests: 7 unit tests added

Note: RBAC implementation pending (current access control is temporary)
2026-04-22 17:13:14 +00:00
djalim 92182b952f feat(modules): add CRUD endpoints for module resource
Implement GET, PUT, DELETE for /modules/{idModule} with 404 handling.
2026-04-22 14:47:08 +02:00
djalim cf3c7c0693 feat(admin/api): add modules endpoint with GET and POST handlers 2026-04-22 14:46:00 +02:00
djalim 5229453169 chore(drizzle.config.ts): import process for env variable support 2026-04-22 14:40:19 +02:00
djalim 6c18189d9f chore(deps): update drizzle-orm to 0.45.2 and pg to 8.20.0 2026-04-22 14:40:19 +02:00
djalim 2c1fd7e5ad feat(promotions): add CRUD endpoints for promotion by id
- GET /promotions/{idPromo} returns promotion or 404
- PUT /promotions/{idPromo} updates year or 404
- DELETE /promotions/{idPromo} deletes promotion or 404
- Only employees allowed, otherwise 403
2026-04-22 14:40:19 +02:00
Clément Oudelet 2f15efe21e PMPR-33 : POST /ues - créer une UE 2026-04-22 14:28:03 +02:00
Clément Oudelet b2847a4a7d PMPR-42 : GET /notes - récupère les notes 2026-04-22 12:20:59 +00:00
djalim 3f0c8d079f feat(students): add promotions API for employees 2026-04-22 14:13:59 +02:00
djalim 4eaea48ebd feat(students): add CRUD endpoints for student by numEtud 2026-04-22 14:11:29 +02:00
djalim f959cf0d3a feat(students): add CSV import endpoint for student data 2026-04-22 14:10:18 +02:00
djalim 0d45bd4c1c refactor(students): simplify API, remove unused imports and helpers
refactor(students): add query param filtering, enforce employee role for POST
refactor(students): return created student in POST response
2026-04-22 14:06:01 +02:00
djalim b5f134d016 feat(roles): add CRUD endpoints for role by id 2026-04-22 13:45:59 +02:00
djalim 9a3f49ecfe feat(admin/api): add roles endpoint with GET and POST 2026-04-22 13:44:30 +02:00
djalim 5a86f69093 feat: add CRUD endpoints for users by id 2026-04-22 13:42:29 +02:00
djalim 03b58e7b0a feat(admin/api/users): add GET and POST endpoints for users 2026-04-22 13:41:33 +02:00
djalim 9168ca53da feat(admin): scaffold admin module and add GET /permissions endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 13:30:19 +02:00
djalim b8d359a507 feat(database): add roles, permissions, users, modules, and related tables
Add tables for role-based access control and academic entities.
Includes modules, UEs, notes, and adjustments.
Update students and mobility tables to reference new primary keys.
This enables richer data modeling for the application.
2026-04-22 13:17:08 +02:00
Clément Oudelet 32ffbb7cda PMPR-32 : GET /ues - liste toutes les UEs 2026-04-22 12:50:46 +02:00
djalim ce5acacca6 refactor(api_mock.ts): remove async from mockFetch to match signature 2026-04-21 10:14:25 +00:00
djalim 4211df32a8 style: format api mock return type and test imports/JSON body 2026-04-21 10:14:25 +00:00
djalim 50afe2ae66 test: add mock DB helper for unit tests
test: add tests for fixtures, mock fetch, mock db, and happy-dom

- Add comprehensive fixture shape tests.
- Expand mockFetch to support methods, status codes, and body tracking.
- Introduce getFetchCalls to inspect intercepted requests.
- Add mockDb helper for in-memory DB operations.
- Reorganize tests for clarity and coverage.
- Ensure happy-dom setup/cleanup works correctly.
2026-04-21 10:14:25 +00:00
djalim 17c5b33a5b refactor(test): improve fetch mock and update fixture types
Add support for HTTP methods, status codes, body and headers in the fetch
mock. Track calls and expose getFetchCalls for assertions. Update fixture
interfaces to use string IDs, add ImportResult and ApiError types, and
provide standard error constants. Adjust fixture data to match new types.
2026-04-21 10:14:25 +00:00
djalim 01fd6e9984 test: add e2e, integration, and unit tests for fixtures and mockFetch 2026-04-21 10:14:25 +00:00
djalim 332286c085 test: add API mock, fixtures, and DOM helpers for tests 2026-04-21 10:14:25 +00:00