feat: google_sheets_name column

This commit is contained in:
karishmas6
2024-10-17 19:22:14 +05:30
parent c91cb28716
commit 0a946cdcbe
2 changed files with 7 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ interface RobotAttributes {
recording_meta: RobotMeta; recording_meta: RobotMeta;
recording: RobotWorkflow; recording: RobotWorkflow;
google_sheets_email?: string | null; google_sheets_email?: string | null;
google_sheets_name?: string | null;
google_sheet_id?: string | null; google_sheet_id?: string | null;
google_access_token?: string | null; google_access_token?: string | null;
google_refresh_token?: string | null; google_refresh_token?: string | null;
@@ -32,6 +33,7 @@ class Robot extends Model<RobotAttributes, RobotCreationAttributes> implements R
public recording_meta!: RobotMeta; public recording_meta!: RobotMeta;
public recording!: RobotWorkflow; public recording!: RobotWorkflow;
public google_sheets_email!: string | null; public google_sheets_email!: string | null;
public google_sheets_name?: string | null;
public google_sheet_id?: string | null; public google_sheet_id?: string | null;
public google_access_token!: string | null; public google_access_token!: string | null;
public google_refresh_token!: string | null; public google_refresh_token!: string | null;
@@ -56,6 +58,10 @@ Robot.init(
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
}, },
google_sheets_name: {
type: DataTypes.STRING,
allowNull: true,
},
google_sheet_id: { google_sheet_id: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,

View File

@@ -93,7 +93,7 @@ export const IntegrationSettingsModal = ({ isOpen, handleStart, handleClose }: I
if (!recordingId) return; if (!recordingId) return;
const recording = await getStoredRecording(recordingId); const recording = await getStoredRecording(recordingId);
if (recording) { if (recording) {
setGoogleSheetsEmail(recording.google_sheets_email); // Assuming this is how the email is stored setGoogleSheetsEmail(recording.google_sheets_email);
} }
}; };
@@ -113,7 +113,6 @@ export const IntegrationSettingsModal = ({ isOpen, handleStart, handleClose }: I
}}> }}>
<Typography sx={{ margin: '20px 0px' }}>Google Sheets Integration</Typography> <Typography sx={{ margin: '20px 0px' }}>Google Sheets Integration</Typography>
{/* If Google Sheets email is empty, show Google OAuth button */}
{!googleSheetsEmail ? ( {!googleSheetsEmail ? (
<Button <Button
variant="contained" variant="contained"
@@ -125,7 +124,6 @@ export const IntegrationSettingsModal = ({ isOpen, handleStart, handleClose }: I
</Button> </Button>
) : ( ) : (
<> <>
{/* Show user info and allow spreadsheet selection once authenticated */}
{userInfo && ( {userInfo && (
<> <>
<Typography sx={{ marginBottom: '10px' }}> <Typography sx={{ marginBottom: '10px' }}>
@@ -160,7 +158,6 @@ export const IntegrationSettingsModal = ({ isOpen, handleStart, handleClose }: I
Fetch Google Spreadsheets Fetch Google Spreadsheets
</button> </button>
{/* Display selected spreadsheet name */}
{settings.spreadsheetId && ( {settings.spreadsheetId && (
<Typography sx={{ marginBottom: '10px' }}> <Typography sx={{ marginBottom: '10px' }}>
Selected Spreadsheet ID: {settings.spreadsheetId} Selected Spreadsheet ID: {settings.spreadsheetId}