File size: 879 Bytes
7895d85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 };
//# sourceMappingURL=_server.ts-Tr37Ptay.js.map