forked from bloom-housing/bloom
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove ability to edit close and lottery dates on a published li…
…sting (#623)
- Loading branch information
1 parent
8d6c02e
commit b252458
Showing
9 changed files
with
119 additions
and
12 deletions.
There are no files selected for viewing
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,39 @@ | ||
import { ListingEventsTypeEnum } from '@prisma/client'; | ||
import { ListingUpdate } from '../dtos/listings/listing-update.dto'; | ||
import { ListingEventCreate } from '../dtos/listings/listing-event-create.dto'; | ||
import { ListingEvent } from '../dtos/listings/listing-event.dto'; | ||
|
||
export const checkIfDatesChanged = ( | ||
lotteryEvent: ListingEventCreate, | ||
storedLotteryEvent: ListingEvent, | ||
dto: ListingUpdate, | ||
storedApplicationDueDate: string, | ||
storedReviewOrderType: string, | ||
) => { | ||
const isPublicLotteryEvent = | ||
lotteryEvent?.type === ListingEventsTypeEnum.publicLottery; | ||
|
||
const isSameStartDate = | ||
lotteryEvent?.startDate?.toISOString() === | ||
storedLotteryEvent?.startDate?.toISOString(); | ||
const isSameStartTime = | ||
lotteryEvent?.startTime?.toISOString() === | ||
storedLotteryEvent?.startTime?.toISOString(); | ||
const isSameEndTime = | ||
lotteryEvent?.endTime?.toISOString() === | ||
storedLotteryEvent?.endTime?.toISOString(); | ||
|
||
const isDifferentReviewOrderType = | ||
storedReviewOrderType !== dto?.reviewOrderType; | ||
const isDifferentApplicationDueDate = | ||
dto.applicationDueDate?.toISOString() !== storedApplicationDueDate; | ||
const isDifferentLotteryEventTimes = | ||
isPublicLotteryEvent && | ||
!(isSameStartDate && isSameStartTime && isSameEndTime); | ||
|
||
return ( | ||
isDifferentReviewOrderType || | ||
isDifferentLotteryEventTimes || | ||
isDifferentApplicationDueDate | ||
); | ||
}; |
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
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
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