multi-file update

This commit is contained in:
jason
2026-03-13 11:13:45 -05:00
parent 5e3ca19c83
commit b2df27cfc5
6 changed files with 52 additions and 13 deletions
+24
View File
@@ -34,6 +34,30 @@ export async function uploadToDrive(accessToken: string, fileName: string, conte
}
}
export async function updateDriveFile(accessToken: string, fileId: string, content: string) {
const auth = new google.auth.OAuth2();
auth.setCredentials({ access_token: accessToken });
const drive = google.drive({ version: 'v3', auth });
const media = {
mimeType: 'text/markdown',
body: Readable.from([content]),
};
try {
const response = await drive.files.update({
fileId,
media,
fields: 'id, webViewLink',
});
return response.data;
} catch (error) {
console.error('Error updating Google Drive file:', error);
throw error;
}
}
export function generateReportMarkdown(report: any) {
let md = `# WFH Daily Report - ${new Date(report.date).toLocaleDateString()}\n`;
md += `**Employee:** ${report.user.name}\n`;