|
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 GET = async ({ url }) => { |
|
try { |
|
const dateFrom = url.searchParams.get("dateFrom"); |
|
const dateTo = url.searchParams.get("dateTo"); |
|
const dateFromObj = dateFrom ? new Date(dateFrom) : void 0; |
|
const dateToObj = dateTo ? new Date(dateTo) : void 0; |
|
await logService.export("json", dateFromObj, dateToObj); |
|
return new Response(JSON.stringify({ message: "Logs exported to JSON successfully" }), { |
|
status: 200, |
|
headers: { "Content-Type": "application/json" } |
|
}); |
|
} catch (error) { |
|
console.error("Error while exporting logs to JSON:", error); |
|
return new Response(JSON.stringify({ message: "Failed to export logs to JSON" }), { |
|
status: 500, |
|
headers: { "Content-Type": "application/json" } |
|
}); |
|
} |
|
}; |
|
|
|
export { GET }; |
|
|
|
|