AG Scroll Settings Budget Push und Rechnungsdokumente umsetzen
All checks were successful
CI / Build and Deploy (push) Successful in 2m20s
All checks were successful
CI / Build and Deploy (push) Successful in 2m20s
This commit is contained in:
@@ -29,6 +29,8 @@ const CSV_HEADERS = [
|
||||
"approvalPreference",
|
||||
"approvalPermissions",
|
||||
"approvalThreshold",
|
||||
"requiredApprovalTypes",
|
||||
"budgetReleaseNotifyTarget",
|
||||
"title",
|
||||
"description",
|
||||
"amount",
|
||||
@@ -41,6 +43,10 @@ const CSV_HEADERS = [
|
||||
"recurrenceStartAt",
|
||||
"invoiceDate",
|
||||
"proofUrl",
|
||||
"storedFileName",
|
||||
"originalFileName",
|
||||
"mimeType",
|
||||
"fileSize",
|
||||
"createdAt",
|
||||
"paidAt",
|
||||
"documentedAt",
|
||||
@@ -58,7 +64,7 @@ const CSV_HEADERS = [
|
||||
"auditMetadata"
|
||||
] as const;
|
||||
|
||||
type CsvRow = Record<(typeof CSV_HEADERS)[number], string | number | null | undefined>;
|
||||
type CsvRow = Partial<Record<(typeof CSV_HEADERS)[number], string | number | null | undefined>>;
|
||||
|
||||
export async function GET() {
|
||||
const viewer = await getCurrentViewer();
|
||||
@@ -149,6 +155,20 @@ export async function GET() {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
documents: {
|
||||
orderBy: {
|
||||
createdAt: "asc"
|
||||
},
|
||||
include: {
|
||||
uploadedBy: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
username: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,6 +189,8 @@ export async function GET() {
|
||||
recordType: "settings",
|
||||
id: appSettings.id,
|
||||
approvalThreshold: toApprovalThresholdNumber(appSettings.approvalThreshold).toFixed(2),
|
||||
requiredApprovalTypes: appSettings.requiredApprovalTypes.join("|"),
|
||||
budgetReleaseNotifyTarget: appSettings.budgetReleaseNotifyTarget,
|
||||
createdAt: appSettings.createdAt.toISOString()
|
||||
} as CsvRow);
|
||||
|
||||
@@ -420,8 +442,12 @@ export async function GET() {
|
||||
approvalType: "",
|
||||
recurrence: expense.recurrence,
|
||||
recurrenceStartAt: expense.recurrenceStartAt?.toISOString() ?? "",
|
||||
invoiceDate: expense.invoiceDate?.toISOString() ?? "",
|
||||
proofUrl: expense.proofUrl ?? "",
|
||||
invoiceDate: "",
|
||||
proofUrl: "",
|
||||
storedFileName: "",
|
||||
originalFileName: "",
|
||||
mimeType: "",
|
||||
fileSize: "",
|
||||
createdAt: expense.createdAt.toISOString(),
|
||||
paidAt: expense.paidAt?.toISOString() ?? "",
|
||||
documentedAt: expense.documentedAt?.toISOString() ?? "",
|
||||
@@ -439,6 +465,64 @@ export async function GET() {
|
||||
auditMetadata: ""
|
||||
});
|
||||
|
||||
for (const document of expense.documents) {
|
||||
rows.push({
|
||||
recordType: "expenseDocument",
|
||||
id: document.id,
|
||||
parentId: expense.id,
|
||||
parentType: "expense",
|
||||
workingGroupId: group.id,
|
||||
workingGroupName: group.name,
|
||||
periodId: budget.period.id,
|
||||
periodName: budget.period.name,
|
||||
periodStartsAt: budget.period.startsAt.toISOString(),
|
||||
periodEndsAt: budget.period.endsAt.toISOString(),
|
||||
periodIsCurrent: budget.period.isCurrent ? "true" : "false",
|
||||
budgetId: budget.id,
|
||||
budgetName: budget.name,
|
||||
userId: document.uploadedBy.id,
|
||||
userName: document.uploadedBy.name,
|
||||
username: document.uploadedBy.username,
|
||||
passwordHash: "",
|
||||
email: "",
|
||||
role: "",
|
||||
approvalPreference: "",
|
||||
approvalPermissions: "",
|
||||
approvalThreshold: "",
|
||||
title: expense.title,
|
||||
description: "",
|
||||
amount: Number(expense.amount).toFixed(2),
|
||||
totalBudget: "",
|
||||
releasedAmount: "",
|
||||
colorCode: "",
|
||||
approvalStatus: expense.approvalStatus,
|
||||
approvalType: "",
|
||||
recurrence: expense.recurrence,
|
||||
recurrenceStartAt: expense.recurrenceStartAt?.toISOString() ?? "",
|
||||
invoiceDate: document.invoiceDate.toISOString(),
|
||||
proofUrl: document.proofUrl,
|
||||
storedFileName: document.storedFileName,
|
||||
originalFileName: document.originalFileName,
|
||||
mimeType: document.mimeType,
|
||||
fileSize: document.size,
|
||||
createdAt: document.createdAt.toISOString(),
|
||||
paidAt: "",
|
||||
documentedAt: "",
|
||||
memberUsernames: "",
|
||||
creatorName: expense.creator.name,
|
||||
creatorUsername: expense.creator.username,
|
||||
approverName: "",
|
||||
approverUsername: "",
|
||||
auditActorId: "",
|
||||
auditAction: "",
|
||||
auditEntityType: "",
|
||||
auditEntityId: "",
|
||||
auditEntityLabel: "",
|
||||
auditSummary: "",
|
||||
auditMetadata: ""
|
||||
});
|
||||
}
|
||||
|
||||
for (const approval of expense.approvals) {
|
||||
rows.push({
|
||||
recordType: "approval",
|
||||
@@ -473,8 +557,12 @@ export async function GET() {
|
||||
approvalType: approval.approvalType,
|
||||
recurrence: expense.recurrence,
|
||||
recurrenceStartAt: expense.recurrenceStartAt?.toISOString() ?? "",
|
||||
invoiceDate: expense.invoiceDate?.toISOString() ?? "",
|
||||
invoiceDate: "",
|
||||
proofUrl: "",
|
||||
storedFileName: "",
|
||||
originalFileName: "",
|
||||
mimeType: "",
|
||||
fileSize: "",
|
||||
createdAt: approval.timestamp.toISOString(),
|
||||
paidAt: "",
|
||||
documentedAt: "",
|
||||
|
||||
Reference in New Issue
Block a user