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:
@@ -0,0 +1,35 @@
|
||||
CREATE TYPE "BudgetReleaseNotifyTarget" AS ENUM ('ALL_GROUP_USERS', 'GROUP_MEMBERS_ONLY');
|
||||
|
||||
ALTER TABLE "app_settings"
|
||||
ADD COLUMN "required_approval_types" "ApprovalType"[] NOT NULL DEFAULT ARRAY['CHAIR_A', 'CHAIR_B', 'FINANCE']::"ApprovalType"[],
|
||||
ADD COLUMN "budget_release_notify_target" "BudgetReleaseNotifyTarget" NOT NULL DEFAULT 'ALL_GROUP_USERS';
|
||||
|
||||
CREATE TABLE "expense_documents" (
|
||||
"id" TEXT NOT NULL,
|
||||
"expense_id" TEXT NOT NULL,
|
||||
"invoice_date" TIMESTAMP(3) NOT NULL,
|
||||
"proof_url" TEXT NOT NULL,
|
||||
"drive_file_id" TEXT,
|
||||
"original_file_name" TEXT NOT NULL,
|
||||
"stored_file_name" TEXT NOT NULL,
|
||||
"mime_type" TEXT NOT NULL,
|
||||
"size" INTEGER NOT NULL,
|
||||
"uploaded_by_id" TEXT NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT "expense_documents_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE INDEX "expense_documents_expense_id_idx" ON "expense_documents"("expense_id");
|
||||
CREATE INDEX "expense_documents_uploaded_by_id_idx" ON "expense_documents"("uploaded_by_id");
|
||||
|
||||
ALTER TABLE "expense_documents"
|
||||
ADD CONSTRAINT "expense_documents_expense_id_fkey"
|
||||
FOREIGN KEY ("expense_id") REFERENCES "expenses"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE "expense_documents"
|
||||
ADD CONSTRAINT "expense_documents_uploaded_by_id_fkey"
|
||||
FOREIGN KEY ("uploaded_by_id") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE "expenses"
|
||||
DROP COLUMN "invoice_date",
|
||||
DROP COLUMN "proof_url";
|
||||
@@ -31,6 +31,11 @@ enum ExpenseRecurrence {
|
||||
MONTHLY
|
||||
}
|
||||
|
||||
enum BudgetReleaseNotifyTarget {
|
||||
ALL_GROUP_USERS
|
||||
GROUP_MEMBERS_ONLY
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
@@ -44,6 +49,7 @@ model User {
|
||||
workingGroup WorkingGroup? @relation(fields: [workingGroupId], references: [id], onDelete: SetNull)
|
||||
createdExpenses Expense[] @relation("ExpenseCreator")
|
||||
approvals Approval[]
|
||||
uploadedDocuments ExpenseDocument[]
|
||||
auditLogs AuditLog[]
|
||||
pushSubscriptions PushSubscription[]
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
@@ -81,10 +87,12 @@ model AccountingPeriod {
|
||||
}
|
||||
|
||||
model AppSettings {
|
||||
id String @id @default("global")
|
||||
approvalThreshold Decimal @default(50) @db.Decimal(10, 2) @map("approval_threshold")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
id String @id @default("global")
|
||||
approvalThreshold Decimal @default(50) @db.Decimal(10, 2) @map("approval_threshold")
|
||||
requiredApprovalTypes ApprovalType[] @default([CHAIR_A, CHAIR_B, FINANCE]) @map("required_approval_types")
|
||||
budgetReleaseNotifyTarget BudgetReleaseNotifyTarget @default(ALL_GROUP_USERS) @map("budget_release_notify_target")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@map("app_settings")
|
||||
}
|
||||
@@ -133,8 +141,6 @@ model Expense {
|
||||
recurrenceStartAt DateTime? @map("recurrence_start_at")
|
||||
paidAt DateTime? @map("paid_at")
|
||||
documentedAt DateTime? @map("documented_at")
|
||||
invoiceDate DateTime? @map("invoice_date")
|
||||
proofUrl String? @map("proof_url")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
creator User @relation("ExpenseCreator", fields: [creatorId], references: [id], onDelete: Restrict)
|
||||
@@ -142,10 +148,31 @@ model Expense {
|
||||
budget Budget @relation(fields: [budgetId], references: [id], onDelete: Restrict)
|
||||
period AccountingPeriod @relation(fields: [periodId], references: [id], onDelete: Restrict)
|
||||
approvals Approval[]
|
||||
documents ExpenseDocument[]
|
||||
|
||||
@@map("expenses")
|
||||
}
|
||||
|
||||
model ExpenseDocument {
|
||||
id String @id @default(cuid())
|
||||
expenseId String @map("expense_id")
|
||||
invoiceDate DateTime @map("invoice_date")
|
||||
proofUrl String @map("proof_url")
|
||||
driveFileId String? @map("drive_file_id")
|
||||
originalFileName String @map("original_file_name")
|
||||
storedFileName String @map("stored_file_name")
|
||||
mimeType String @map("mime_type")
|
||||
size Int
|
||||
uploadedById String @map("uploaded_by_id")
|
||||
expense Expense @relation(fields: [expenseId], references: [id], onDelete: Cascade)
|
||||
uploadedBy User @relation(fields: [uploadedById], references: [id], onDelete: Restrict)
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@index([expenseId])
|
||||
@@index([uploadedById])
|
||||
@@map("expense_documents")
|
||||
}
|
||||
|
||||
model Approval {
|
||||
id String @id @default(cuid())
|
||||
expenseId String @map("expense_id")
|
||||
|
||||
Reference in New Issue
Block a user