Fix jwt-token
This commit is contained in:
@@ -308,7 +308,7 @@ class DataRetentionService {
|
||||
|
||||
// Set CORS headers
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
|
||||
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
||||
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
|
||||
@@ -343,6 +343,39 @@ class DataRetentionService {
|
||||
res.writeHead(404);
|
||||
res.end(JSON.stringify({ error: 'Not found' }));
|
||||
}
|
||||
|
||||
} else if (req.method === 'POST') {
|
||||
if (parsedUrl.pathname === '/cleanup') {
|
||||
// Manual cleanup trigger
|
||||
if (this.isRunning) {
|
||||
res.writeHead(409);
|
||||
res.end(JSON.stringify({
|
||||
error: 'Cleanup already in progress',
|
||||
message: 'A cleanup operation is currently running. Please wait for it to complete.'
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('🧹 Manual cleanup triggered via HTTP API');
|
||||
|
||||
// Trigger cleanup asynchronously
|
||||
this.performCleanup().then(() => {
|
||||
console.log('✅ Manual cleanup completed successfully');
|
||||
}).catch((error) => {
|
||||
console.error('❌ Manual cleanup failed:', error);
|
||||
});
|
||||
|
||||
res.writeHead(202);
|
||||
res.end(JSON.stringify({
|
||||
success: true,
|
||||
message: 'Data retention cleanup initiated',
|
||||
timestamp: new Date().toISOString()
|
||||
}));
|
||||
|
||||
} else {
|
||||
res.writeHead(404);
|
||||
res.end(JSON.stringify({ error: 'Not found' }));
|
||||
}
|
||||
} else {
|
||||
res.writeHead(405);
|
||||
res.end(JSON.stringify({ error: 'Method not allowed' }));
|
||||
|
||||
Reference in New Issue
Block a user