From ac388a52c36125ce0bda56c8460ff8ffc40567a6 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 18 Oct 2024 00:30:45 +0530 Subject: [PATCH] chore: code cleanup --- .../src/workflow-management/integrations/gsheet.ts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/server/src/workflow-management/integrations/gsheet.ts b/server/src/workflow-management/integrations/gsheet.ts index 31e79d48..82fc6370 100644 --- a/server/src/workflow-management/integrations/gsheet.ts +++ b/server/src/workflow-management/integrations/gsheet.ts @@ -36,8 +36,6 @@ export function saveIntegrations(fileName: string, integrations: any) { } export async function updateGoogleSheet(robotId: string, runId: string) { - console.log(`Starting updateGoogleSheet for robotId: ${robotId}, runId: ${runId}`); - try { const run = await Run.findOne({ where: { runId } }); @@ -49,10 +47,8 @@ export async function updateGoogleSheet(robotId: string, runId: string) { if (plainRun.status === 'success' && plainRun.serializableOutput) { const data = plainRun.serializableOutput['item-0'] as { [key: string]: any }[]; - console.log('Serializable output data:', data); const robot = await Robot.findOne({ where: { 'recording_meta.id': robotId } }); - console.log('Robot found:', robot); if (!robot) { throw new Error(`Robot not found for robotId: ${robotId}`); @@ -67,8 +63,6 @@ export async function updateGoogleSheet(robotId: string, runId: string) { const headers = Object.keys(data[0]); const rows = data.map((row: { [key: string]: any }) => Object.values(row)); const outputData = [headers, ...rows]; - - console.log('Data to be written to sheet:', outputData); await writeDataToSheet(robotId, spreadsheetId, outputData); console.log(`Data written to Google Sheet successfully for Robot: ${robotId} and Run: ${runId}`); @@ -83,7 +77,6 @@ export async function updateGoogleSheet(robotId: string, runId: string) { } }; - export async function writeDataToSheet(robotId: string, spreadsheetId: string, data: any[]) { try { const robot = await Robot.findOne({ where: { 'recording_meta.id': robotId } }); @@ -109,9 +102,7 @@ export async function writeDataToSheet(robotId: string, spreadsheetId: string, d refresh_token: plainRobot.google_refresh_token, }); - // Log tokens and any refresh activity oauth2Client.on('tokens', async (tokens) => { - console.log('OAuth2 tokens updated:', tokens); if (tokens.refresh_token) { await robot.update({ google_refresh_token: tokens.refresh_token }); } @@ -124,7 +115,6 @@ export async function writeDataToSheet(robotId: string, spreadsheetId: string, d const resource = { values: data }; console.log('Attempting to write to spreadsheet:', spreadsheetId); - console.log('Data being written:', data); const response = await sheets.spreadsheets.values.append({ spreadsheetId, @@ -133,8 +123,6 @@ export async function writeDataToSheet(robotId: string, spreadsheetId: string, d requestBody: resource, }); - console.log('Google Sheets API response:', JSON.stringify(response, null, 2)); - if (response.status === 200) { console.log('Data successfully appended to Google Sheet.'); } else { @@ -148,7 +136,6 @@ export async function writeDataToSheet(robotId: string, spreadsheetId: string, d } } - export const processGoogleSheetUpdates = async () => { while (true) { let hasPendingTasks = false;