docs: update CLAUDE.md to reflect completed API layer
Mark all implemented endpoints as ✅, document the 3-level test architecture, and clarify that UI pages are the next priority. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,8 +18,8 @@ role-based administration.
|
|||||||
|
|
||||||
### Current Status
|
### Current Status
|
||||||
|
|
||||||
🚧 **In Progress** - Application is far from complete. The schema below is the
|
🚧 **In Progress** - API layer largely complete, UI pages not yet built.
|
||||||
**final/definitive schema** that should guide all development.
|
The schema below is the **final/definitive schema** that guides all development.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -133,15 +133,11 @@ erDiagram
|
|||||||
AJUSTEMENT }o--|| UE : "dans"
|
AJUSTEMENT }o--|| UE : "dans"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Current Schema (Incomplete)
|
### Current Schema
|
||||||
|
|
||||||
The current Drizzle ORM schema in `/databases/schema.ts` only implements:
|
The Drizzle ORM schema in `/databases/schema.ts` implements all tables:
|
||||||
|
`roles`, `permissions`, `rolePermissions`, `users`, `promotions`, `students`,
|
||||||
- `promotions`
|
`modules`, `enseignements`, `ues`, `ueModules`, `notes`, `ajustements`, `mobility`.
|
||||||
- `students`
|
|
||||||
- `mobility`
|
|
||||||
|
|
||||||
**Migration needed**: Update schema to match the final ER diagram above.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -186,71 +182,73 @@ The current Drizzle ORM schema in `/databases/schema.ts` only implements:
|
|||||||
|
|
||||||
### API Endpoints
|
### API Endpoints
|
||||||
|
|
||||||
|
Legend: ✅ implemented & tested | 📋 not yet implemented
|
||||||
|
|
||||||
**Students API**
|
**Students API**
|
||||||
|
|
||||||
- 📋 GET `/students` (#7)
|
- ✅ GET `/students` (#7)
|
||||||
- 📋 POST `/students` (#8)
|
- ✅ POST `/students` (#8)
|
||||||
- 📋 POST `/students/import-csv` (#9)
|
- ✅ POST `/students/import-csv` (#9)
|
||||||
- 📋 GET `/students/{numEtud}` (#10)
|
- ✅ GET `/students/{numEtud}` (#10)
|
||||||
- 📋 PUT `/students/{numEtud}` (#11)
|
- ✅ PUT `/students/{numEtud}` (#11)
|
||||||
- 📋 DELETE `/students/{numEtud}` (#12)
|
- ✅ DELETE `/students/{numEtud}` (#12)
|
||||||
- 📋 GET `/promotions` (#13)
|
- ✅ GET `/promotions` (#13)
|
||||||
- 📋 POST `/promotions` (#14)
|
- ✅ POST `/promotions` (#14)
|
||||||
- 📋 GET `/promotions/{idPromo}` (#15)
|
- ✅ GET `/promotions/{idPromo}` (#15)
|
||||||
- 📋 PUT `/promotions/{idPromo}` (#16)
|
- ✅ PUT `/promotions/{idPromo}` (#16)
|
||||||
- 📋 DELETE `/promotions/{idPromo}` (#17)
|
- ✅ DELETE `/promotions/{idPromo}` (#17)
|
||||||
|
|
||||||
**Administration API - Modules & Enseignements**
|
**Administration API - Modules & Enseignements**
|
||||||
|
|
||||||
- 📋 GET `/modules` (#23)
|
- ✅ GET `/modules` (#23)
|
||||||
- 📋 POST `/modules` (#24)
|
- ✅ POST `/modules` (#24)
|
||||||
- 📋 GET `/modules/{idModule}` (#25)
|
- ✅ GET `/modules/{idModule}` (#25)
|
||||||
- 📋 PUT `/modules/{idModule}` (#26)
|
- ✅ PUT `/modules/{idModule}` (#26)
|
||||||
- 📋 DELETE `/modules/{idModule}` (#27)
|
- ✅ DELETE `/modules/{idModule}` (#27)
|
||||||
- 📋 POST `/enseignements` (#29)
|
- ✅ POST `/enseignements` (#29)
|
||||||
- 📋 GET `/enseignements/{idProf}/{idModule}/{idPromo}` (#30)
|
- ✅ GET `/enseignements/{idProf}/{idModule}/{idPromo}` (#30)
|
||||||
- 📋 DELETE `/enseignements/{idProf}/{idModule}/{idPromo}` (#31)
|
- ✅ DELETE `/enseignements/{idProf}/{idModule}/{idPromo}` (#31)
|
||||||
|
|
||||||
**Notes API - UEs & UE-Modules**
|
**Notes API - UEs & UE-Modules**
|
||||||
|
|
||||||
- 📋 GET `/ues` (#32)
|
- ✅ GET `/ues` (#32)
|
||||||
- 📋 POST `/ues` (#33)
|
- ✅ POST `/ues` (#33)
|
||||||
- 📋 GET `/ues/{idUE}` (#34)
|
- ✅ GET `/ues/{idUE}` (#34)
|
||||||
- 📋 PUT `/ues/{idUE}` (#35)
|
- ✅ PUT `/ues/{idUE}` (#35)
|
||||||
- 📋 DELETE `/ues/{idUE}` (#36)
|
- ✅ DELETE `/ues/{idUE}` (#36)
|
||||||
- 📋 GET `/ue-modules` (#37)
|
- ✅ GET `/ue-modules` (#37)
|
||||||
- 📋 POST `/ue-modules` (#38)
|
- ✅ POST `/ue-modules` (#38)
|
||||||
- 📋 GET `/ue-modules/{idModule}/{idUE}/{idPromo}` (#39)
|
- ✅ GET `/ue-modules/{idModule}/{idUE}/{idPromo}` (#39)
|
||||||
- 📋 PUT `/ue-modules/{idModule}/{idUE}/{idPromo}` (#40)
|
- ✅ PUT `/ue-modules/{idModule}/{idUE}/{idPromo}` (#40)
|
||||||
- 📋 DELETE `/ue-modules/{idModule}/{idUE}/{idPromo}` (#41)
|
- ✅ DELETE `/ue-modules/{idModule}/{idUE}/{idPromo}` (#41)
|
||||||
|
|
||||||
**Notes API - Notes & Ajustements**
|
**Notes API - Notes & Ajustements**
|
||||||
|
|
||||||
- 📋 GET `/notes` (#42)
|
- ✅ GET `/notes` (#42)
|
||||||
- 📋 POST `/notes` (#43)
|
- ✅ POST `/notes` (#43)
|
||||||
- 📋 POST `/notes/import-xlsx` (#44)
|
- 📋 POST `/notes/import-xlsx` (#44)
|
||||||
- 📋 GET `/notes/{numEtud}/{idModule}` (#45)
|
- ✅ GET `/notes/{numEtud}/{idModule}` (#45)
|
||||||
- 📋 PUT `/notes/{numEtud}/{idModule}` (#46)
|
- ✅ PUT `/notes/{numEtud}/{idModule}` (#46)
|
||||||
- 📋 DELETE `/notes/{numEtud}/{idModule}` (#47)
|
- ✅ DELETE `/notes/{numEtud}/{idModule}` (#47)
|
||||||
- 📋 GET `/ajustements` (#48)
|
- ✅ GET `/ajustements` (#48)
|
||||||
- 📋 POST `/ajustements` (#49)
|
- ✅ POST `/ajustements` (#49)
|
||||||
- 📋 GET `/ajustements/{numEtud}/{idUE}` (#50)
|
- ✅ GET `/ajustements/{numEtud}/{idUE}` (#50)
|
||||||
- 📋 PUT `/ajustements/{numEtud}/{idUE}` (#51)
|
- ✅ PUT `/ajustements/{numEtud}/{idUE}` (#51)
|
||||||
- 📋 DELETE `/ajustements/{numEtud}/{idUE}` (#52)
|
- ✅ DELETE `/ajustements/{numEtud}/{idUE}` (#52)
|
||||||
|
|
||||||
**Administration API - Users, Roles & Permissions**
|
**Administration API - Users, Roles & Permissions**
|
||||||
|
|
||||||
- 📋 GET `/users` (#60)
|
- ✅ GET `/users` (#60)
|
||||||
- 📋 POST `/users` (#61)
|
- ✅ POST `/users` (#61)
|
||||||
- 📋 GET `/users/{id}` (#62)
|
- ✅ GET `/users/{id}` (#62)
|
||||||
- 📋 PUT `/users/{id}` (#63)
|
- ✅ PUT `/users/{id}` (#63)
|
||||||
- 📋 DELETE `/users/{id}` (#64)
|
- ✅ DELETE `/users/{id}` (#64)
|
||||||
- 📋 GET `/roles` (#65)
|
- ✅ GET `/roles` (#65)
|
||||||
- 📋 POST `/roles` (#66)
|
- ✅ POST `/roles` (#66)
|
||||||
- 📋 GET `/roles/{idRole}` (#67)
|
- ✅ GET `/roles/{idRole}` (#67)
|
||||||
- 📋 PUT `/roles/{idRole}` (#68)
|
- ✅ PUT `/roles/{idRole}` (#68)
|
||||||
- 📋 DELETE `/roles/{idRole}` (#69)
|
- ✅ DELETE `/roles/{idRole}` (#69)
|
||||||
- 📋 GET `/permissions` (#70)
|
- ✅ GET `/permissions` (#70)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -298,10 +296,24 @@ deno task check
|
|||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
- Write unit tests for business logic
|
3-level architecture — all 149 tests pass:
|
||||||
- Integration tests for API endpoints
|
|
||||||
- E2E tests with HappyDOM for UI interactions
|
- **Unit** (`tests/unit/`) — pure logic with mock DB + mock API, no real DB
|
||||||
- Mock database with provided helpers
|
- **Integration** (`tests/integration/`) — Drizzle ORM direct on real DB
|
||||||
|
- **E2E** (`tests/e2e/`) — Fresh handler + real DB (handler-level, not browser)
|
||||||
|
|
||||||
|
Helpers in `tests/helpers/`:
|
||||||
|
- `handler.ts` — builds fake Fresh contexts (`makeEmployeeContext`, `makeJsonRequest`…)
|
||||||
|
- `db_integration.ts` — seed functions + `truncateAll()` for test isolation
|
||||||
|
- `db_mock.ts` / `api_mock.ts` — in-memory mocks for unit tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
deno task test # run all tests
|
||||||
|
deno task test:coverage # coverage report (terminal)
|
||||||
|
deno task test:coverage:html # coverage report (HTML → coverage/html/index.html)
|
||||||
|
nix run nixpkgs#act -- -j unit --no-cache-server # unit tests via GitHub Actions
|
||||||
|
nix run nixpkgs#act -- -j integration --no-cache-server # integration + e2e via GitHub Actions
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -327,12 +339,13 @@ deno task check
|
|||||||
|
|
||||||
## 💡 Important Notes
|
## 💡 Important Notes
|
||||||
|
|
||||||
1. **Current Limitation**: The database schema in `/databases/schema.ts` does
|
1. **Only missing API**: `POST /notes/import-xlsx` (#44) — all other endpoints are implemented.
|
||||||
NOT match the final ER diagram. This is a priority migration task.
|
2. **Next priority**: UI pages (none built yet) — follow the Figma prototype.
|
||||||
2. **Design System**: Follow the Figma prototype for all UI work.
|
|
||||||
3. **Module Pattern**: Each module should follow the same pattern: routes, API
|
3. **Module Pattern**: Each module should follow the same pattern: routes, API
|
||||||
endpoints, components, and tests.
|
endpoints, components, and tests.
|
||||||
4. **Permissions**: All admin operations should respect the ROLE_PERMISSION
|
4. **Permissions**: All admin operations should respect the ROLE_PERMISSION
|
||||||
system.
|
system.
|
||||||
5. **Fresh Conventions**: Routes use Fresh's file-based routing convention
|
5. **Fresh Conventions**: Routes use Fresh's file-based routing convention
|
||||||
(e.g., `routes/path/index.tsx`).
|
(e.g., `routes/path/index.tsx`).
|
||||||
|
6. **Drizzle `.where()` pitfall**: Always wrap multiple conditions with `and()`.
|
||||||
|
`.where(eq(a), eq(b))` silently ignores the second argument.
|
||||||
|
|||||||
Reference in New Issue
Block a user