chore: remove stale code
This commit is contained in:
@@ -26,27 +26,16 @@ function saveIntegrations(integrations: any) {
|
|||||||
router.post('/upload-credentials', async (req, res) => {
|
router.post('/upload-credentials', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const { fileName, credentials, spreadsheetId, range } = req.body;
|
const { fileName, credentials, spreadsheetId, range } = req.body;
|
||||||
|
|
||||||
console.log(`fileName: ${fileName}, credentials: ${credentials}, spreadsheetId: ${spreadsheetId}, range: ${range}`);
|
|
||||||
|
|
||||||
if (!fileName || !credentials || !spreadsheetId || !range) {
|
if (!fileName || !credentials || !spreadsheetId || !range) {
|
||||||
return res.status(400).json({ message: 'Credentials, Spreadsheet ID, and Range are required.' });
|
return res.status(400).json({ message: 'Credentials, Spreadsheet ID, and Range are required.' });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the credentials in a secure place (for test, we store them locally)
|
// Store the credentials in a secure place (for test, we store them locally)
|
||||||
// Load existing integrations from the JSON file
|
// Load existing integrations from the JSON file
|
||||||
const integrations = loadIntegrations();
|
const integrations = loadIntegrations();
|
||||||
|
|
||||||
// Add or update the integration for the specific task (fileName)
|
|
||||||
integrations[fileName] = { fileName, spreadsheetId, range, credentials };
|
integrations[fileName] = { fileName, spreadsheetId, range, credentials };
|
||||||
|
|
||||||
// Save the updated integrations back to the file
|
|
||||||
saveIntegrations(integrations);
|
saveIntegrations(integrations);
|
||||||
logger.log('info', 'Service account credentials saved successfully.');
|
logger.log('info', 'Service account credentials saved successfully.');
|
||||||
|
|
||||||
return res.send(true);
|
return res.send(true);
|
||||||
|
|
||||||
//fs.writeFileSync(storedCredentialsPath, JSON.stringify(credentials));
|
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
logger.log('error', `Error saving credentials: ${error.message}`);
|
logger.log('error', `Error saving credentials: ${error.message}`);
|
||||||
return res.status(500).json({ message: 'Failed to save credentials.', error: error.message });
|
return res.status(500).json({ message: 'Failed to save credentials.', error: error.message });
|
||||||
|
|||||||
Reference in New Issue
Block a user