Rechnungsdatum und Belegupload ueberarbeiten
This commit is contained in:
@@ -33,6 +33,7 @@ export function sanitizeDriveFileName(title: string, fallback = "beleg") {
|
||||
|
||||
export async function uploadExpenseProofToDrive(input: {
|
||||
title: string;
|
||||
invoiceDate: string;
|
||||
fileName: string;
|
||||
mimeType: string;
|
||||
buffer: Buffer;
|
||||
@@ -41,8 +42,7 @@ export async function uploadExpenseProofToDrive(input: {
|
||||
const folderId = process.env.GOOGLE_DRIVE_FOLDER_ID || DEFAULT_DRIVE_FOLDER_ID;
|
||||
const extension = input.fileName.includes(".") ? `.${input.fileName.split(".").pop()}` : "";
|
||||
const baseName = sanitizeDriveFileName(input.title);
|
||||
const uniqueSuffix = new Date().toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z");
|
||||
const name = `${baseName}-${uniqueSuffix}${extension}`;
|
||||
const name = `${input.invoiceDate}-${baseName}${extension}`;
|
||||
|
||||
const response = await drive.files.create({
|
||||
requestBody: {
|
||||
|
||||
Reference in New Issue
Block a user