H.4 — Standardize API filenames (closes #247)
What's wrong
Mixed conventions in server/api/:
- Some routes use
index.ts and switch on event.node.req.method (e.g. announcement/index.ts, formGroup/index.ts, student/index.ts).
- Others use Nuxt's method-suffix routing (
account-settings.get.ts, account-settings.put.ts).
- One uses a query parameter
?action=... to multiplex a dozen actions through one file (form/index.ts).
How to fix
Pick the Nuxt-native style: *.get.ts, *.post.ts, *.put.ts, *.delete.ts. Split each multi-method file:
announcement/index.ts → announcement/index.get.ts, announcement/index.post.ts
announcement/[id].ts → announcement/[id].delete.ts
formGroup/index.ts → formGroup/index.get.ts, formGroup/index.put.ts
formSubmission/index.ts → formSubmission/index.get.ts, formSubmission/index.post.ts
student/index.ts → student/index.get.ts, student/index.post.ts
student/[id].ts → student/[id].get.ts, student/[id].put.ts, student/[id].delete.ts
For form/index.ts (the action-multiplexer), the cleanest cure is to give each action its own file: form/groups.get.ts, form/groups.post.ts, form/forms.get.ts, etc. Larger refactor — possibly defer to a separate PR.
Important: do this after Group A (auth) so we're not chasing auth changes during the file move.
Files
Severity
M.
Acceptance
H.4 — Standardize API filenames (closes #247)
What's wrong
Mixed conventions in
server/api/:index.tsand switch onevent.node.req.method(e.g.announcement/index.ts,formGroup/index.ts,student/index.ts).account-settings.get.ts,account-settings.put.ts).?action=...to multiplex a dozen actions through one file (form/index.ts).How to fix
Pick the Nuxt-native style:
*.get.ts,*.post.ts,*.put.ts,*.delete.ts. Split each multi-method file:announcement/index.ts→announcement/index.get.ts,announcement/index.post.tsannouncement/[id].ts→announcement/[id].delete.tsformGroup/index.ts→formGroup/index.get.ts,formGroup/index.put.tsformSubmission/index.ts→formSubmission/index.get.ts,formSubmission/index.post.tsstudent/index.ts→student/index.get.ts,student/index.post.tsstudent/[id].ts→student/[id].get.ts,student/[id].put.ts,student/[id].delete.tsFor
form/index.ts(the action-multiplexer), the cleanest cure is to give each action its own file:form/groups.get.ts,form/groups.post.ts,form/forms.get.ts, etc. Larger refactor — possibly defer to a separate PR.Important: do this after Group A (auth) so we're not chasing auth changes during the file move.
Files
server/api/Severity
M.
Acceptance
server/api/switches onevent.node.req.method.