refactor(notes): improve error handling and formatting
Check Deno code / Check Deno code (pull_request) Successful in 5s
Tests / Unit tests (pull_request) Successful in 11s
Tests / Integration tests (pull_request) Failing after 1m18s

docs: update CLAUDE.md formatting
This commit is contained in:
2026-04-27 19:43:36 +02:00
parent 9368e68622
commit 401160aa30
2 changed files with 112 additions and 110 deletions
+4 -2
View File
@@ -34,7 +34,8 @@ export const handler: Handlers = {
}),
// #43 POST /notes
POST: withRules(["note_write", "own_teaching_note"])(async (request, _context) => {
POST: withRules(["note_write", "own_teaching_note"])(
async (request, _context) => {
const body = await request.json();
const { note, numEtud, idModule } = body;
@@ -57,5 +58,6 @@ export const handler: Handlers = {
status: 201,
headers: { "Content-Type": "application/json" },
});
}),
},
),
};
@@ -6,7 +6,8 @@ import { and, eq } from "npm:drizzle-orm@0.45.2";
export const handler: Handlers = {
// #45 GET /notes/:numEtud/:idModule
GET: withRules(["note_read", "own_note", "own_teaching_note"])(async (_request, context) => {
GET: withRules(["note_read", "own_note", "own_teaching_note"])(
async (_request, context) => {
try {
const numEtud = parseInt(context.params.numEtud);
const { idModule } = context.params;
@@ -47,11 +48,11 @@ export const handler: Handlers = {
return new Response("Failed to fetch data", { status: 500 });
}
},
}),
),
// #46 PUT /notes/:numEtud/:idModule
PUT: withRules(["note_write", "own_teaching_note"])(async (request, context) => {
PUT: withRules(["note_write", "own_teaching_note"])(
async (request, context) => {
try {
const numEtud = parseInt(context.params.numEtud);
const { idModule } = context.params;
@@ -99,8 +100,7 @@ export const handler: Handlers = {
return new Response("Failed to update note", { status: 500 });
}
},
}),
),
// #47 DELETE /notes/:numEtud/:idModule
DELETE: withRules(["note_write"])(async (_request, context) => {