-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/1369 sort applicants based on rental rules (#50)
* feat: 1369 add factories for necessary interfaces * feat: 1369 tests for assignPriorityToApplicantBasedOnRentalRules * feat: 1369 write tests for sorting * feat: 1369 clean * feat: 1369 remove redundant comments * feat: 1369 some fixes for CR * feat: 1368 refactor * feat: 1369 fix broken test * feat: 1369 add const for lease.types * feat: 1369 use includes instead of startsWith
- Loading branch information
Showing
8 changed files
with
582 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//constant values for lease.type | ||
//string values taken from xpand | ||
|
||
const leaseTypes = { | ||
housingContract: 'Bostadskontrakt', | ||
campusContract: 'Campuskontrakt', | ||
garageContract: 'Garagekontrakt', | ||
cooperativeTenancyContract: 'Kooperativ hyresrätt', | ||
commercialTenantContract: 'Lokalkontrakt', | ||
renegotiationContract: 'Omförhandlingskontrakt', | ||
otherContract: 'Övrigt', | ||
parkingspaceContract: 'P-platskontrakt', | ||
} | ||
|
||
export { leaseTypes } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { Factory } from 'fishery' | ||
import { Lease, LeaseStatus, Listing, ListingStatus } from 'onecore-types' | ||
import { leaseTypes } from '../../../constants/leaseTypes' | ||
|
||
const LeaseFactory = Factory.define<Lease>(({ sequence }) => ({ | ||
leaseId: `${sequence}`, | ||
leaseNumber: `0${sequence}`, | ||
leaseStartDate: new Date(2022, 1), | ||
leaseEndDate: undefined, | ||
status: LeaseStatus.Active, | ||
tenantContactIds: undefined, | ||
tenants: undefined, | ||
rentalPropertyId: '605-703-00-0014', | ||
rentalProperty: undefined, | ||
type: leaseTypes.parkingspaceContract, | ||
rentInfo: undefined, | ||
address: { | ||
street: 'Testgatan', | ||
number: '123', | ||
postalCode: '723 40', | ||
city: 'Västerås', | ||
}, | ||
noticeGivenBy: undefined, | ||
noticeDate: undefined, | ||
noticeTimeTenant: undefined, | ||
preferredMoveOutDate: undefined, | ||
terminationDate: undefined, | ||
contractDate: new Date(2021, 11), | ||
lastDebitDate: undefined, | ||
approvalDate: new Date(2021, 12), | ||
residentialArea: { | ||
code: 'MAL', | ||
caption: 'Malmaberg', | ||
}, | ||
})) | ||
|
||
//todo: use properly defined interface | ||
const ApplicantFactory = Factory.define<any, { currentHousingContract: Lease }>( | ||
({ sequence, params }) => ({ | ||
id: `${sequence}`, | ||
name: 'Test Testsson', | ||
contactCode: `P${158769 + sequence}`, | ||
applicationDate: new Date().toISOString(), | ||
applicationType: 'Additional', | ||
status: 1, | ||
listingId: `${sequence}`, | ||
queuePoints: 10, | ||
address: { | ||
street: 'Aromas väg 8B', | ||
number: '', | ||
postalCode: '73439', | ||
city: 'Hallstahammar', | ||
}, | ||
currentHousingContract: params.currentHousingContract, | ||
upcomingHousingContract: params.upcomingHousingContract, | ||
parkingSpaceContracts: [], | ||
priority: 0, | ||
}) | ||
) | ||
|
||
const ListingFactory = Factory.define<Listing>(({ sequence }) => ({ | ||
id: sequence + 1, | ||
rentalObjectCode: `R${sequence + 1000}`, | ||
address: 'Sample Address', | ||
monthlyRent: 1000, | ||
districtCaption: 'Malmaberg', | ||
districtCode: 'MAL', | ||
blockCaption: 'LINDAREN 2', | ||
blockCode: '1401', | ||
objectTypeCaption: 'Carport', | ||
objectTypeCode: 'CPORT', | ||
rentalObjectTypeCaption: 'Standard hyresobjektstyp', | ||
rentalObjectTypeCode: 'STD', | ||
publishedFrom: new Date(), | ||
publishedTo: new Date(), | ||
vacantFrom: new Date(), | ||
status: ListingStatus.Active, | ||
waitingListType: 'Bilplats (intern)', | ||
applicants: [], | ||
})) | ||
|
||
export { LeaseFactory, ApplicantFactory, ListingFactory } |
Oops, something went wrong.