Release Candidate : 1.0.0 #150

Merged
djalim merged 103 commits from release/1.0.0 into main 2026-05-01 17:32:02 +00:00
Showing only changes of commit 96b7edf77f - Show all commits
+22
View File
@@ -36,4 +36,26 @@ export const handler: Handlers = {
return new Response("Failed to fetch data", { status: 500 });
}
},
// #43 POST /notes
async POST(request) {
try {
const body = await request.json();
const { note, numEtud, idModule } = body;
if (note === undefined || !numEtud || !idModule) {
return new Response("Champs 'note', 'numEtud' et 'idModule' requis", { status: 400 });
}
const result = await db.insert(notes).values({ note, numEtud, idModule }).returning();
return new Response(JSON.stringify(result[0]), {
status: 201,
headers: { "Content-Type": "application/json" },
});
} catch (error) {
console.error("Error creating note:", error);
return new Response("Failed to create note", { status: 500 });
}
},
};