Skip to content

Commit 49a0376

Browse files
committed
Merge branch 'main' into feature/mim-533-grundinformation-adress
2 parents c85719c + ede1239 commit 49a0376

File tree

16 files changed

+231
-10
lines changed

16 files changed

+231
-10
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "property-monorepo",
3-
"version": "0.1.21",
3+
"version": "0.1.24",
44
"private": true,
55
"workspaces": [
66
"packages/*"

packages/property-base/prisma/schema/PropertyObject_cmobj.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ model PropertyObject {
2323
administrativeUnit AdministrativeUnit? //@relation("PropertyObjectToAdministrativeUnit")
2424
propertyArea PropertyArea[] //@relation("PropertyObjectToPropertyArea")
2525
property Property? //@relation("PropertyObjectToProperty") //todo: fix this relation
26+
rentalInformation RentalInformation? @relation("PropertyObjectToRentalInformation")
2627
2728
rentalObject RentalObject? //@relation("PropertyObjectToRentalObject")
2829
//company Company? @relation("PropertyObjectToCompany")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
model RentalInformationType {
2+
@@map("hyint")
3+
4+
id String @id(map: "pkhyint") @map("keyhyint") @db.Char(15)
5+
code String @map("code") @db.Char(10)
6+
name String? @map("caption") @db.Char(30)
7+
// Exclude unused fields
8+
9+
// waitingListTypeId String? @map("keybkkty") @db.Char(15)
10+
// minimumAge Int? @map("minage") @db.TinyInt
11+
// maximumAge Int? @map("maxage") @db.TinyInt
12+
// housingType Int @default(0, map: "DF__hyint__lmcat__66796CD3") @map("lmcat") @db.TinyInt
13+
// publishStatus Int @default(0, map: "DF__hyint__publicera__676D910C") @map("publiceras") @db.TinyInt
14+
// apartmentInspectionStatus Int @default(1, map: "DF__hyint__lbcreate__6861B545") @map("lbcreate") @db.TinyInt
15+
// turnoverVisibility Int @default(0, map: "DF__hyint__tuovisibl__6955D97E") @map("tuovisible") @db.TinyInt
16+
// familySituationStatus Int @default(0, map: "DF__hyint__familysit__6A49FDB7") @map("familysit") @db.TinyInt
17+
// timestamp String @map("timestamp") @db.Char(10)
18+
19+
rentalInformations RentalInformation[] // Previously hyinf; converted to use the new model name
20+
// waitingListType WaitingListType? @relation(fields: [waitingListTypeId], references: [waitingListTypeId], onDelete: NoAction, onUpdate: NoAction, map: "fkhyintkeybkkty")
21+
22+
// @@index([waitingListTypeId], map: "fkhyintbkkty")
23+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
model RentalInformation {
2+
@@map("hyinf")
3+
id String @id(map: "pkhyinf") @map("keyhyinf") @db.Char(15)
4+
propertyObjectId String @unique(map: "akhyinf1") @map("keycmobj") @db.Char(15)
5+
rentalInformationTypeId String @map("keyhyint") @db.Char(15)
6+
// Exclude unused fields
7+
8+
// shownByUserId String? @map("keybkvis") @db.Char(15) // TODO: Confirm relation name if changed
9+
// indexSeriesId String? @map("keycmind") @db.Char(15)
10+
// indexValueId String? @map("keycminv") @db.Char(15)
11+
// quantityTypeId String? @map("keycmvat") @db.Char(15)
12+
// quantityTypeId2 String? @map("keycmvat2") @db.Char(15)
13+
// quantityTypeId3 String? @map("keycmvat3") @db.Char(15)
14+
// quantityTypeId4 String? @map("keycmvat4") @db.Char(15)
15+
// taxAreaId String? @map("keyhyvaa") @db.Char(15)
16+
// heatingId String? @map("keybahea") @db.Char(15)
17+
// renovationExemptionId String? @map("keybarex") @db.Char(15)
18+
// creditTemplateId String? @map("keycmcte") @db.Char(15)
19+
// rentId String? @map("hyresid") @db.VarChar(30)
20+
// generation Int? @map("generation") @db.SmallInt
21+
// startGeneration Int? @map("startgen") @db.TinyInt
22+
// apartmentNumber String? @map("lmnr") @db.Char(5)
23+
// housingNumber String? @map("prynumber") @db.VarChar(30)
24+
// shareNumber String? @map("shareno") @db.VarChar(60)
25+
// tenureForm Int? @map("upplform") @db.TinyInt
26+
// currentTenureForm Int? @map("upplformnu") @db.TinyInt
27+
// isShortTermRental Int @map("shortstay") @db.TinyInt
28+
// sharePercentage Decimal? @map("andelstal") @db.Decimal(22, 7)
29+
// rentDistributionFactor Decimal? @map("aixrent") @db.Decimal(8, 7)
30+
// shareValue Float? @map("sharevalue") @db.Money
31+
// voteCount Int? @map("votecount") @db.TinyInt
32+
// depositAdvance Float? @map("insatspre") @db.Money
33+
// depositForfeit Float? @map("insatsfors") @db.Money // deposit Float? @map("insats") @db.Money // depositDate DateTime? @map("inputdate") @db.DateTime
34+
// tenureFee Float? @map("upplavg") @db.Money
35+
// tenureFeeDate DateTime? @map("letfeedate") @db.DateTime
36+
// irrevocableCapitalContribution Float? @map("oaterkap") @db.Money
37+
// originalAnnualFee Float? @map("planarsavg") @db.Money
38+
// firstOccupancyDate DateTime? @map("inflyttdat") @db.DateTime
39+
// queueManagement Int? @map("direktuth") @db.TinyInt
40+
// baseRentAmount Float? @map("akthyratot") @db.Money
41+
// contractBaseRent Float? @map("konthyra") @db.Money
42+
// isDraft Int @default(0, map: "DF__hyinf__draft__535320DE") @map("draft") @db.TinyInt
43+
// doNotInvoiceDeposit Int @map("ejbrinsats") @db.TinyInt
44+
// doNotAllocateToInternalFund Int @map("ejbrfnd") @db.TinyInt
45+
// statisticsFrom DateTime @map("statfrom") @db.DateTime
46+
// statisticsTo DateTime @map("stattom") @db.DateTime
47+
// rentLossFrom DateTime? @map("lossfrom") @db.DateTime
48+
// rentLossTo DateTime? @map("lossto") @db.DateTime
49+
// salesStop Int @map("saljstopp") @db.TinyInt
50+
// housingEvaluationType Int @default(0, map: "DF__hyinf__pointtype__54474517") @map("pointtype") @db.TinyInt
51+
// housingAllowance Int @default(0, map: "DF__hyinf__allowance__553B6950") @map("allowance") @db.TinyInt
52+
// housingEnergyClass Int @default(0, map: "DF__hyinf__fohenergy__562F8D89") @map("fohenergyc") @db.TinyInt
53+
// targetRentPercentage Decimal? @map("targetperc") @db.Decimal(4, 1)
54+
// targetRentAmount Float? @map("targetrent") @db.Money
55+
// evaluationPoints Int? @map("points") @db.SmallInt
56+
// minOccupants Int? @map("persmin") @db.TinyInt
57+
// maxOccupants Int? @map("persmax") @db.TinyInt
58+
// minAge Int? @map("persagemin") @db.TinyInt
59+
// maxAge Int? @map("persagemax") @db.TinyInt
60+
// minTenureMonths Int? @map("tentimemin") @db.TinyInt
61+
// minIncomeRentFactor Decimal? @map("increntmin") @db.Decimal(4, 2)
62+
// additionalInfo String? @map("otherinfo") @db.VarChar(200)
63+
// renovationExemptionComment String? @map("rexcomment") @db.VarChar(200)
64+
// firstClassId Int @default(0, map: "DF__hyinf__fcobject__5723B1C2") @map("fcobject") @db.TinyInt
65+
// upgradeStandard Int @default(0, map: "DF__hyinf__fcstatus__5817D5FB") @map("fcstatus") @db.TinyInt
66+
// upgradeNeed Int @default(0, map: "DF__hyinf__fcupgneed__590BFA34") @map("fcupgneed") @db.TinyInt
67+
// lastUpgradeDate DateTime? @map("fcdate") @db.DateTime
68+
// upgradeComment String? @map("fccomment") @db.VarChar(250)
69+
// isBGUCovered Int @default(0, map: "DF__hyinf__bguused__5A001E6D") @map("bguused") @db.TinyInt
70+
// hasLakeView Int @default(0, map: "DF__hyinf__lakeview__5AF442A6") @map("lakeview") @db.TinyInt
71+
// vatRate Decimal @default(0, map: "DF__hyinf__vatstat__5BE866DF") @map("vatstat") @db.Decimal(4, 2)
72+
// purposeLabel Int @default(1, map: "DF__hyinf__label__5CDC8B18") @map("label") @db.TinyInt
73+
// isRenovated Int @default(0, map: "DF__hyinf__renovatio__5DD0AF51") @map("renovation") @db.TinyInt
74+
// daebStatus Int @default(1, map: "DF__hyinf__daeb__5EC4D38A") @map("daeb") @db.TinyInt
75+
// standardYearRent Float? @map("stdyrrent") @db.Money
76+
// discountFee Float @default(0, map: "DF__hyinf__discfee__5FB8F7C3") @map("discfee") @db.Money
77+
// rentCalculationMethod Int @default(0, map: "DF__hyinf__rentcalcm__60AD1BFC") @map("rentcalcm") @db.TinyInt
78+
// deleteMark Int @default(0, map: "DF__hyinf__deletemar__61A14035") @map("deletemark") @db.TinyInt
79+
// timestamp String @map("timestamp") @db.Char(10)
80+
81+
// heating Heating? @relation(fields: [heatingId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fkhyinfbahea")
82+
// creditTemplate CreditTemplate? @relation(fields: [creditTemplateId], references: [id], onUpdate: NoAction, map: "fkhyinfcmcte")
83+
84+
// TODO: change relations when knowing the new model names
85+
// indexSeries cmind? @relation(fields: [indexSeriesId], references: [keycmind], onDelete: NoAction, onUpdate: NoAction, map: "fkhyinfkeycmind")
86+
// indexValue IndexValue? @relation(fields: [indexValueId], references: [indexValueId], onDelete: NoAction, onUpdate: NoAction, map: "fkhyinfkeycminv")
87+
// propertyObject cmobj @relation(fields: [propertyObjectId], references: [keycmobj], onDelete: Cascade, onUpdate: NoAction, map: "fkhyinfkeycmobj")
88+
// quantityType cmvat_hyinf_keycmvatTocmvat cmvat? @relation("hyinf_keycmvatTocmvat", fields: [quantityTypeId], references: [keycmvat], onDelete: NoAction, onUpdate: NoAction, map: "fkhyinfkeycmvat")
89+
// quantityType2 cmvat_hyinf_keycmvat2Tocmvat cmvat? @relation("hyinf_keycmvat2Tocmvat", fields: [quantityTypeId2], references: [keycmvat], onDelete: NoAction, onUpdate: NoAction, map: "fkhyinfkeycmvat2")
90+
// quantityType3 cmvat_hyinf_keycmvat3Tocmvat cmvat? @relation("hyinf_keycmvat3Tocmvat", fields: [quantityTypeId3], references: [keycmvat], onDelete: NoAction, onUpdate: NoAction, map: "fkhyinfkeycmvat3")
91+
// quantityType4 cmvat_hyinf_keycmvat4Tocmvat cmvat? @relation("hyinf_keycmvat4Tocmvat", fields: [quantityTypeId4], references: [keycmvat], onDelete: NoAction, onUpdate: NoAction, map: "fkhyinfkeycmvat4")
92+
rentalInformationType RentalInformationType @relation(fields: [rentalInformationTypeId], references: [id], onUpdate: NoAction, map: "fkhyinfkeyhyint")
93+
propertyObject PropertyObject @relation("PropertyObjectToRentalInformation", fields: [propertyObjectId], references: [id], map: "fkhyinfkeycmobj")
94+
// @@index([heatingId], map: "fkhyinfbahea")
95+
// @@index([shownByUserId], map: "fkhyinfbkvis")
96+
// @@index([creditTemplateId], map: "fkhyinfcmcte")
97+
// @@index([indexSeriesId], map: "fkhyinfcmind")
98+
// @@index([indexValueId], map: "fkhyinfcminv")
99+
// @@index([quantityTypeId], map: "fkhyinfcmvat")
100+
// @@index([quantityTypeId2], map: "fkhyinfcmvat2")
101+
// @@index([quantityTypeId3], map: "fkhyinfcmvat3")
102+
// @@index([quantityTypeId4], map: "fkhyinfcmvat4")
103+
// @@index([rentalInformationTypeId], map: "fkhyinfhyint")
104+
// @@index([rentId], map: "inhyinf_2J70GWSR9")
105+
}

packages/property-base/prisma/schema/Residence_balgh.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ model Residence {
3838
3939
residenceType ResidenceType @relation(fields: [residenceTypeId], references: [id], onUpdate: NoAction, map: "fkbalghkeybalgt ")
4040
propertyObject PropertyObject @relation(fields: [propertyObjectId], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "fkbalghkeycmobj")
41+
comments TypeText[] @relation("ResidenceToTypeText")
4142
// TODO: Verify relation for checklistId as the InspectionProtocol model was provided but fields need to be verified
4243
// inspectionProtocol InspectionProtocol? @relation(fields: [checklistId], references: [inspectionProtocolId], onUpdate: NoAction, map: "fkbalghkeylbpro ")
4344
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
model Template {
2+
id String @id @map("keycmtep") @db.Char(15)
3+
type String @map("keycmtyp") @db.VarChar(10)
4+
caption String @map("caption") @db.VarChar(100)
5+
6+
typeText TypeText[] @relation("TypeTextToTemplate")
7+
8+
@@map("cmtep")
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
model TypeText {
2+
id String @id @map("keycmtex") @db.Char(15)
3+
keycmtep String @map("keycmtep") @db.Char(15)
4+
keycode String @map("keycode") @db.Char(15)
5+
text String @map("text") @db.VarChar(255)
6+
7+
template Template @relation("TypeTextToTemplate", fields: [keycmtep], references: [id])
8+
residence Residence @relation("ResidenceToTypeText", fields: [keycode], references: [id])
9+
10+
@@map("cmtex")
11+
}

packages/property-base/src/adapters/residence-adapter.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export type ResidenceWithRelations = Prisma.ResidenceGetPayload<{
2424
residenceType: true
2525
propertyObject: {
2626
include: {
27+
rentalInformation: { include: { rentalInformationType: true } }
2728
propertyStructures: {
2829
select: {
2930
rentalId: true
@@ -35,6 +36,17 @@ export type ResidenceWithRelations = Prisma.ResidenceGetPayload<{
3536
}
3637
}
3738
}
39+
comments: {
40+
where: {
41+
template: {
42+
type: 'balgh'
43+
caption: 'Anläggningsid'
44+
}
45+
}
46+
select: {
47+
text: true
48+
}
49+
}
3850
}
3951
}>
4052

@@ -59,6 +71,7 @@ export const getResidenceById = async (
5971
residenceType: true,
6072
propertyObject: {
6173
include: {
74+
rentalInformation: { include: { rentalInformationType: true } },
6275
propertyStructures: {
6376
select: {
6477
rentalId: true,
@@ -70,6 +83,17 @@ export const getResidenceById = async (
7083
},
7184
},
7285
},
86+
comments: {
87+
where: {
88+
template: {
89+
type: 'balgh',
90+
caption: 'Anläggningsid',
91+
},
92+
},
93+
select: {
94+
text: true,
95+
},
96+
},
7397
},
7498
})
7599
.then(trimStrings)

packages/property-base/src/routes/residences-route.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,16 @@ export const routes = (router: KoaRouter) => {
311311
energyIndex: residence.propertyObject?.energyIndex?.toNumber(),
312312
},
313313
rentalId,
314+
rentalInformation: !residence.propertyObject?.rentalInformation
315+
? null
316+
: {
317+
type: {
318+
code: residence.propertyObject.rentalInformation
319+
.rentalInformationType.code,
320+
name: residence.propertyObject.rentalInformation
321+
.rentalInformationType.name,
322+
},
323+
},
314324
},
315325
property: {
316326
code: residence.propertyObject.propertyStructures[0].propertyCode,
@@ -320,6 +330,7 @@ export const routes = (router: KoaRouter) => {
320330
code: residence.propertyObject.propertyStructures[0].buildingCode,
321331
name: residence.propertyObject.propertyStructures[0].buildingName,
322332
},
333+
malarEnergiFacilityId: residence.comments?.[0].text || null,
323334
} satisfies ResidenceDetails
324335

325336
ctx.status = 200

0 commit comments

Comments
 (0)