Shared Drive Uploads unterstuetzen
This commit is contained in:
@@ -224,7 +224,8 @@ export async function uploadExpenseProofToDrive(input: {
|
||||
mimeType: input.mimeType,
|
||||
body: Readable.from(input.buffer)
|
||||
},
|
||||
fields: "id, webViewLink"
|
||||
fields: "id, name, webViewLink, webContentLink",
|
||||
supportsAllDrives: true
|
||||
}).catch((error: unknown) => {
|
||||
throw mapDriveError(error, "DRIVE_UPLOAD_FAILED", "Google Drive konnte den Rechnungsbeleg nicht hochladen.", [
|
||||
`Zielordner: ${config.folderId}`,
|
||||
@@ -243,7 +244,8 @@ export async function uploadExpenseProofToDrive(input: {
|
||||
requestBody: {
|
||||
type: "anyone",
|
||||
role: "reader"
|
||||
}
|
||||
},
|
||||
supportsAllDrives: true
|
||||
}).catch((error: unknown) => {
|
||||
throw mapDriveError(error, "DRIVE_PERMISSION_FAILED", "Google Drive konnte den Freigabe-Link nicht erstellen.", [
|
||||
`Die Datei wurde vermutlich bereits erstellt. Drive-Datei-ID: ${response.data.id}`
|
||||
@@ -273,7 +275,8 @@ export async function runDriveDiagnostics() {
|
||||
mimeType: "text/plain",
|
||||
body: Readable.from(Buffer.from("RFP Finanzen Drive API Test\n", "utf8"))
|
||||
},
|
||||
fields: "id, webViewLink"
|
||||
fields: "id, name, webViewLink, webContentLink",
|
||||
supportsAllDrives: true
|
||||
});
|
||||
|
||||
createdFileId = response.data.id ?? null;
|
||||
@@ -282,7 +285,7 @@ export async function runDriveDiagnostics() {
|
||||
throw new DriveIntegrationError("Google Drive hat für die Testdatei keine Datei-ID zurückgegeben.", "DRIVE_FILE_ID_MISSING");
|
||||
}
|
||||
|
||||
await drive.files.delete({ fileId: createdFileId });
|
||||
await drive.files.delete({ fileId: createdFileId, supportsAllDrives: true });
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
@@ -296,7 +299,7 @@ export async function runDriveDiagnostics() {
|
||||
};
|
||||
} catch (error) {
|
||||
if (createdFileId) {
|
||||
await drive.files.delete({ fileId: createdFileId }).catch((cleanupError: unknown) => {
|
||||
await drive.files.delete({ fileId: createdFileId, supportsAllDrives: true }).catch((cleanupError: unknown) => {
|
||||
throw new DriveIntegrationError(
|
||||
"Drive-Test ist fehlgeschlagen und die temporäre Testdatei konnte nicht gelöscht werden.",
|
||||
"DRIVE_DIAGNOSTIC_CLEANUP_FAILED",
|
||||
|
||||
Reference in New Issue
Block a user