Fix/maintenance recurring edit validation#3547
Open
ZeinebMegaadi wants to merge 2 commits intobluewave-labs:developfrom
Open
Fix/maintenance recurring edit validation#3547ZeinebMegaadi wants to merge 2 commits intobluewave-labs:developfrom
ZeinebMegaadi wants to merge 2 commits intobluewave-labs:developfrom
Conversation
Contributor
Author
|
This fix happens after any edit and not specifically for repeating windows though I'm not sure if it's okay to be kept this way or if I should restrict it to only repeating windows. Do let me know! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Please remove this line only before submitting your PR. Ensure that all relevant items are checked before submission.)
Describe your changes
When editing a repeating maintenance window whose first occurrence has already passed, the form validation rejected the existing start date with "Start date and time must be in the future", making it impossible to save any edits.
The fix extracts the base object schema into maintenanceWindowBaseSchema and derives two schemas from it: maintenanceWindowSchema (with the future date refine, used on create) and maintenanceWindowEditSchema (without it, used on edit). Since one-time windows are auto-deleted by MongoDB's TTL index once they expire, skipping the future date check in edit mode is safe for all cases.
Write your issue number after "Fixes "
Fixes #3546
Please ensure all items are checked off before requesting a review. "Checked off" means you need to add an "x" character between brackets so they turn into checkmarks.
<div>Add</div>, use):npm run formatin server and client directories, which automatically formats your code.