|
import { L as LogService } from './LogService-P6XVmjfT.js'; |
|
import 'fs'; |
|
import 'path'; |
|
import 'util'; |
|
import 'date-fns'; |
|
import 'mongoose'; |
|
import 'exceljs'; |
|
import './shared-server-49TKSBDM.js'; |
|
|
|
const logService = new LogService(); |
|
const POST = async ({ request }) => { |
|
try { |
|
const { id, score, comment } = await request.json(); |
|
await logService.logUserScore(id, score, comment); |
|
return new Response(JSON.stringify({ message: "User score updated successfully" }), { |
|
status: 200, |
|
headers: { "Content-Type": "application/json" } |
|
}); |
|
} catch (error) { |
|
console.error("Error while recording log:", error); |
|
return new Response(JSON.stringify({ message: "Failed to record log entry" }), { |
|
status: 500, |
|
headers: { "Content-Type": "application/json" } |
|
}); |
|
} |
|
}; |
|
|
|
export { POST }; |
|
|
|
|