Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Update Prisma Schema for Financial Analysis and Internal Invoicing #65

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 57 additions & 21 deletions packages/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,23 @@ model VerificationToken {
}

model Workspace {
id String @id @default(cuid())
name String
orgnr Int?
address String?
postalCode String?
city String?
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
buildings Building[]
contracts Contract[]
invoices CustomerInvoice[]
Document Document[]
properties Property[]
apiKeys WSApiKey[]
accessTokens WorkspaceAccessToken[]
users User[]
id String @id @default(cuid())
name String
orgnr Int?
address String?
postalCode String?
city String?
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
buildings Building[]
contracts Contract[]
invoices CustomerInvoice[]
Document Document[]
properties Property[]
apiKeys WSApiKey[]
accessTokens WorkspaceAccessToken[]
users User[]
internalInvoices InternalInvoice[]
}

model Property {
Expand Down Expand Up @@ -257,10 +258,10 @@ model BalancedAccounts {
}

model FinancialAnalysisBuilding {
id Int @id @default(autoincrement())
id String @id @default(cuid())
buildingId String
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
name String
rentableArea Int
ratioAreaOffice Float?
Expand Down Expand Up @@ -305,11 +306,12 @@ model FinancialAnalysisBuilding {
manYieldMerch Float?
manYieldMisc Float?
manYieldWeighted Float?
building Building @relation(fields: [buildingId], references: [id])
building Building @relation(fields: [buildingId], references: [id])
incomeUnits FinancialAnalysisBuildingIncome[]
}

model FinancialAnalysisProperty {
id Int @id @default(autoincrement())
id String @id @default(cuid())
propertyId String
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
Expand Down Expand Up @@ -424,6 +426,40 @@ model Document {
@@index([workspaceId])
}

model InternalInvoice {
id String @id @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
workspaceId String
amount Float?
currency String?
dueDate DateTime?
paidAt DateTime?
status String?
description String?
invoiceNumber String?
downloadUrl String?
workspace Workspace @relation(fields: [workspaceId], references: [id])

@@map("internal_invoices")
}

model FinancialAnalysisBuildingIncome {
id String @id @default(cuid())
financialAnalysisBuildingId String
numberOfUnits Int
typeDescription String
areaPerUnit Float?
valuePerUnit Float?
totalArea Float?
totalValue Float?
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
financialAnalysisBuilding FinancialAnalysisBuilding @relation(fields: [financialAnalysisBuildingId], references: [id])

@@map("financial_analysis_building_income")
}

enum ContractType {
LEASE
SUBLEASE
Expand Down