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