- Added ResponsiveDialog component for handling responsive dialogs in the UI. - Created ExpensesProvider to manage state and API interactions for expenses. - Developed ExpensesTabContent to display expenses with filtering options and dialogs for new and pay expense actions. - Implemented ExpensesTable for rendering expense data in a tabular format with actions. - Added dialogs for creating new expenses and paying existing ones with form validation. - Introduced PeriodicExpenseForm for managing periodic expenses with month selection. - Created PeriodicExpensesTabContent to manage and display periodic expenses with create/edit functionality. - Added GenerateCurrentMonthDialog for confirming monthly expense generation. - Implemented PeriodicExpensesTable for displaying periodic expenses with edit and delete actions.
81 lines
2.1 KiB
Plaintext
81 lines
2.1 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Get a free hosted Postgres database in seconds: `npx create-db`
|
|
|
|
generator client {
|
|
provider = "prisma-client"
|
|
output = "../src/generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
enum QuoteType {
|
|
BLUE
|
|
BNA
|
|
BELO
|
|
}
|
|
|
|
model Quote {
|
|
id Int @id @default(autoincrement())
|
|
timeStamp DateTime @default(now())
|
|
buy Decimal @db.Money
|
|
sell Decimal @db.Money
|
|
type QuoteType
|
|
difference Decimal @default(0) @db.Decimal(9, 2)
|
|
percentage Decimal @default(0) @db.Decimal(9, 2)
|
|
previousDayDifference Decimal @default(0) @db.Decimal(9, 2)
|
|
previousDayPercentage Decimal @default(0) @db.Decimal(9, 2)
|
|
|
|
@@map("quotes")
|
|
}
|
|
|
|
|
|
model QuoteHistory {
|
|
id Int @id @default(autoincrement())
|
|
timeStamp DateTime @default(now())
|
|
buy Decimal @db.Money
|
|
sell Decimal @db.Money
|
|
type QuoteType
|
|
|
|
@@map("quotes_history")
|
|
}
|
|
|
|
// Expenses
|
|
|
|
enum PaymentStatus {
|
|
PENDING
|
|
PAYED
|
|
}
|
|
|
|
model PeriodicExpense {
|
|
id Int @id @default(autoincrement())
|
|
description String @db.VarChar(50)
|
|
defaultDueDay Int
|
|
defaultAmount Decimal @db.Money
|
|
periods Int[]
|
|
isDeleted Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
|
|
expenses Expense[]
|
|
|
|
@@map("periodic_expenses")
|
|
}
|
|
|
|
model Expense {
|
|
id Int @id @default(autoincrement())
|
|
description String @db.VarChar(50)
|
|
periodicExpense PeriodicExpense? @relation(fields: [periodicExpenseId], references: [id])
|
|
periodicExpenseId Int?
|
|
year Int
|
|
month Int
|
|
amount Decimal @db.Money
|
|
amountPayed Decimal? @db.Money
|
|
status PaymentStatus @default(PENDING)
|
|
dueDate DateTime
|
|
paymentDate DateTime?
|
|
|
|
@@map("expenses")
|
|
} |