feat(enseignements): implement enseignements CRUD endpoints #106

Merged
djalim merged 3 commits from feature/api-enseignements into develop 2026-04-22 17:13:36 +00:00
Collaborator

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

Close #29 #30 #31

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 Close #29 #30 #31
anys added this to the Module Managment project 2026-04-22 13:11:18 +00:00
djalim was assigned by anys 2026-04-22 13:11:21 +00:00
Author
Collaborator

Sorry for not separating each feature as its own branch. It was easier this way and the code is not very long.

Sorry for not separating each feature as its own branch. It was easier this way and the code is not very long.
Collaborator

The code is correct, but the folder structure is wrong for the route
/admin/api/enseignements/{idProf}/{idModule}/{idPromo}.
In Fresh, / in a URL corresponds to nested folders in the code.

Current structure:

  admin/api/enseignements/                                                                       
  └── [idProf]_[idModule]_[idPromo].ts  →  /admin/api/enseignements/{idProf}\_{idModule}\_{idPromo}  

Structure needed for 3 separate segments (like ue-modules):

  admin/api/enseignements/                                                                         
  └── [idProf]/                                                                                    
      └── [idModule]/                                                                              
          └── [idPromo].ts              →  /admin/api/enseignements/{idProf}/{idModule}/{idPromo}

Also, the tests are still using mocks instead of actually testing the real handlers.

The code is correct, but the folder structure is wrong for the route /admin/api/enseignements/{idProf}/{idModule}/{idPromo}. In Fresh, / in a URL corresponds to nested folders in the code. Current structure: ``` admin/api/enseignements/ └── [idProf]_[idModule]_[idPromo].ts → /admin/api/enseignements/{idProf}\_{idModule}\_{idPromo} ``` Structure needed for 3 separate segments (like ue-modules): ``` admin/api/enseignements/ └── [idProf]/ └── [idModule]/ └── [idPromo].ts → /admin/api/enseignements/{idProf}/{idModule}/{idPromo} ``` Also, the tests are still using mocks instead of actually testing the real handlers.
Collaborator

Sorry for not separating each feature as its own branch. It was easier this way and the code is not very long.

its ok i do the same

> Sorry for not separating each feature as its own branch. It was easier this way and the code is not very long. its ok i do the same
Author
Collaborator

Alright, I’ve checked Fresh’s file routing documentation.
I'm fixing the folder structure to match the route.

Alright, I’ve checked [Fresh’s file routing documentation](https://fresh.deno.dev/docs/concepts/file-routing). I'm fixing the folder structure to match the route.
Author
Collaborator

I fixed the folder structure for the route and removed the mock tests.
I’m not writing the handler tests for now.

I fixed the folder structure for the route and removed the mock tests. I’m not writing the handler tests for now.
djalim was unassigned by anys 2026-04-22 15:45:57 +00:00
anys self-assigned this 2026-04-22 15:45:57 +00:00
anys requested review from djalim 2026-04-22 15:46:00 +00:00
djalim added 3 commits 2026-04-22 17:13:16 +00:00
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)
- Replace flat file `[idProf]_[idModule]_[idPromo].ts`
  with nested structure `[idProf]/[idModule]/[idPromo].ts`
- Ensures URL matches `/enseignements/{idProf}/{idModule}/{idPromo}`
Unit tests removed as they only used mocks without real value.
djalim force-pushed feature/api-enseignements from 934a160889 to a19a1e6c13 2026-04-22 17:13:16 +00:00 Compare
Collaborator

lgtm

lgtm
djalim merged commit a19a1e6c13 into develop 2026-04-22 17:13:36 +00:00
djalim moved this to ⚙️ in progress in Module Managment on 2026-04-22 23:04:34 +00:00
djalim moved this to ✅ done in Module Managment on 2026-04-22 23:04:40 +00:00
djalim removed this from the Module Managment project 2026-04-22 23:05:01 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/PolyMPR#106