Skip to content

Commit 31b97be

Browse files
authored
Feat: UTH-251 Model Changes to Fetch RentalObject from XPand-db (#106)
* Adjustments to internal portal * Model updates
1 parent 7fd3d14 commit 31b97be

File tree

11 files changed

+89
-467
lines changed

11 files changed

+89
-467
lines changed

packages/backend/package-lock.json

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

packages/backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"koa-jwt": "^4.0.4",
5252
"koa-pino-logger": "^4.0.0",
5353
"koa-session": "^6.4.0",
54-
"onecore-types": "^3.11.0",
54+
"onecore-types": "^3.11.1",
5555
"onecore-utilities": "^1.1.0",
5656
"zod": "^3.24.2"
5757
}

packages/backend/tsconfig.tsbuildinfo

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

packages/frontend/src/pages/ParkingSpace/components/AllApplicantsTabContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const AllApplicantsTabContext = (props: { listing: Listing }) => {
4141
}}
4242
>
4343
<Typography paddingBottom="2rem" marginRight="1rem" variant="h1">
44-
<span>Intresseanmälningar {props.listing.address}</span>
44+
<span>Intresseanmälningar {props.listing.rentalObject.address}</span>
4545
</Typography>
4646
<Chip
4747
label={formatStatus(props.listing.status)}

packages/frontend/src/pages/ParkingSpace/components/Applicants.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const Applicants = (props: { listingId: number }) => {
1818

1919
const columns = getColumns(
2020
props.listingId,
21-
parkingSpaceListing?.address ?? ''
21+
parkingSpaceListing?.rentalObject.address ?? ''
2222
)
2323

2424
return (

packages/frontend/src/pages/ParkingSpace/components/OffersTabContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const OffersTabContext = (props: {
3434
}}
3535
>
3636
<Typography paddingBottom="0.5rem" marginRight="1rem" variant="h1">
37-
<span>Intresseanmälningar {props.listing.address}</span>
37+
<span>Intresseanmälningar {props.listing.rentalObject.address}</span>
3838
</Typography>
3939
<Chip
4040
label={formatStatus(props.offers)}

packages/frontend/src/pages/ParkingSpace/components/ParkingSpaceInfo.tsx

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const ParkingSpaceInfo = (props: { listingId: number }) => {
3939
<Typography>Bilplats</Typography>
4040
<Box>
4141
<Typography fontWeight="bold">
42-
{parkingSpaceListing.address}
42+
{parkingSpaceListing.rentalObject.address}
4343
</Typography>
4444
<Typography fontWeight="bold" textAlign="right">
4545
{parkingSpaceListing.rentalObjectCode}
@@ -50,31 +50,53 @@ export const ParkingSpaceInfo = (props: { listingId: number }) => {
5050
<Box display="flex" justifyContent="space-between" flex="1">
5151
<Typography>Skyltnummer</Typography>
5252
<Box>
53-
<Typography fontWeight="bold">{'N/A'}</Typography>
53+
<Typography fontWeight="bold">
54+
{
55+
parkingSpaceListing.rentalObjectCode.split('-')[
56+
parkingSpaceListing.rentalObjectCode.split('-').length - 1
57+
]
58+
}
59+
</Typography>
60+
</Box>
61+
</Box>
62+
<Box display="flex" justifyContent="space-between" flex="1">
63+
<Typography>Yta</Typography>
64+
<Box>
65+
<Typography fontWeight="bold">
66+
{parkingSpaceListing.rentalObject.braArea} kvm
67+
</Typography>
5468
</Box>
5569
</Box>
5670
<Box height="50px" />
71+
<Box display="flex" justifyContent="space-between" flex="1">
72+
<Typography>Distrikt</Typography>
73+
<Box>
74+
<Typography fontWeight="bold">
75+
{parkingSpaceListing.rentalObject.districtCaption}
76+
</Typography>
77+
</Box>
78+
</Box>
5779
<Box display="flex" justifyContent="space-between" flex="1">
5880
<Typography>Område</Typography>
5981
<Box>
6082
<Typography fontWeight="bold">
61-
{parkingSpaceListing.districtCaption}
83+
{parkingSpaceListing.rentalObject.restidentalAreaCaption}
6284
</Typography>
6385
</Box>
6486
</Box>
6587
<Box display="flex" justifyContent="space-between" flex="1">
6688
<Typography>Bilplatstyp</Typography>
6789
<Box>
6890
<Typography fontWeight="bold">
69-
{parkingSpaceListing.objectTypeCaption}
91+
{parkingSpaceListing.rentalObject.objectTypeCaption}
7092
</Typography>
7193
</Box>
7294
</Box>
7395
<Box display="flex" justifyContent="space-between" flex="1">
7496
<Typography>Hyra</Typography>
7597
<Box>
7698
<Typography fontWeight="bold">{`${numberFormatter.format(
77-
parkingSpaceListing.monthlyRent
99+
parkingSpaceListing.rentalObject.monthlyRent
78100
)}/mån`}</Typography>
79101
</Box>
80102
</Box>
@@ -100,7 +122,10 @@ export const ParkingSpaceInfo = (props: { listingId: number }) => {
100122
<Typography>Ledig från och med</Typography>
101123
<Box>
102124
<Typography fontWeight="bold">
103-
{printVacantFrom(dateFormatter, parkingSpaceListing.vacantFrom)}
125+
{printVacantFrom(
126+
dateFormatter,
127+
parkingSpaceListing.rentalObject.vacantFrom
128+
)}
104129
</Typography>
105130
</Box>
106131
</Box>

packages/frontend/src/pages/ParkingSpaces/components/DeleteListing.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ import { LoadingButton } from '@mui/lab'
1515

1616
import { useDeleteParkingSpaceListing } from '../hooks/useDeleteParkingSpaceListing'
1717

18-
export const DeleteListing = (
19-
props: Pick<Listing, 'rentalObjectCode' | 'address' | 'id'> & {
20-
disabled: boolean
21-
}
22-
) => {
18+
export const DeleteListing = (props: {
19+
disabled: boolean
20+
address: string
21+
rentalObjectCode: string
22+
id: number
23+
}) => {
2324
const deleteListing = useDeleteParkingSpaceListing()
2425
const [open, setOpen] = useState(false)
2526

packages/frontend/src/pages/ParkingSpaces/components/create-applicant-for-listing/CreateApplicantForListing.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const CreateApplicantForListing = (props: Props) => {
5151

5252
const tenantQuery = useTenantWithValidation(
5353
selectedContact?.contactCode,
54-
props.listing.districtCode,
54+
props.listing.rentalObject.restidentalAreaCode,
5555
props.listing.rentalObjectCode
5656
)
5757

@@ -122,7 +122,7 @@ export const CreateApplicantForListing = (props: Props) => {
122122
<Box paddingTop="0.5rem">
123123
<Box display="flex">
124124
<DialogTitle variant="h1" fontSize={24} textAlign="left">
125-
Ny intresseanmälan, {props.listing.address}
125+
Ny intresseanmälan, {props.listing.rentalObject.address}
126126
</DialogTitle>
127127
<Box
128128
display="flex"
@@ -297,10 +297,10 @@ function tenantHasValidContractForTheDiscrict(
297297
) {
298298
const hasUpComingContractInThisDistrict =
299299
tenant.upcomingHousingContract?.residentialArea?.code ===
300-
listing.districtCode
300+
listing.rentalObject.restidentalAreaCode
301301
const hasCurrentContractInThisDistrict =
302302
tenant.currentHousingContract?.residentialArea?.code ===
303-
listing.districtCode
303+
listing.rentalObject.restidentalAreaCode
304304

305305
return hasCurrentContractInThisDistrict || hasUpComingContractInThisDistrict
306306
}

packages/frontend/src/pages/ParkingSpaces/components/create-applicant-for-listing/ListingInfo.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const ListingInfo = (props: { listing: Listing }) => {
2020
>
2121
<Typography>Område</Typography>
2222
<Box>
23-
<Typography>{props.listing.districtCaption}</Typography>
23+
<Typography>{props.listing.rentalObject.districtCaption}</Typography>
2424
</Box>
2525
</Box>
2626
<Box
@@ -42,7 +42,9 @@ export const ListingInfo = (props: { listing: Listing }) => {
4242
>
4343
<Typography>Bilplatstyp</Typography>
4444
<Box>
45-
<Typography>{props.listing.objectTypeCaption}</Typography>
45+
<Typography>
46+
{props.listing.rentalObject.objectTypeCaption}
47+
</Typography>
4648
</Box>
4749
</Box>
4850
<Box
@@ -54,7 +56,7 @@ export const ListingInfo = (props: { listing: Listing }) => {
5456
<Typography>Hyra</Typography>
5557
<Box>
5658
<Typography>{`${numberFormatter.format(
57-
props.listing.monthlyRent
59+
props.listing.rentalObject.monthlyRent
5860
)}/mån`}</Typography>
5961
</Box>
6062
</Box>
@@ -91,7 +93,10 @@ export const ListingInfo = (props: { listing: Listing }) => {
9193
<Typography>Ledig från och med</Typography>
9294
<Box>
9395
<Typography>
94-
{printVacantFrom(dateFormatter, props.listing.vacantFrom)}
96+
{printVacantFrom(
97+
dateFormatter,
98+
props.listing.rentalObject.vacantFrom
99+
)}
95100
</Typography>
96101
</Box>
97102
</Box>

0 commit comments

Comments
 (0)