Lp/SwapRequests#68
Draft
lop4cwru wants to merge 18 commits into
Draft
Conversation
adding back all the changes from the earlier branches so it's consistent with main
- Filled out RequestSwap.tsx
- Contains the generated schedule and a place to submit your email. If your email has an availability in this schedule, you may proceed to the next.
- Contains a selectable schedule w/ text in the cells where you can select which shifts you'd like to swap. Then, you can submit that to create the SwapRequest in the backend (FUNCTIONALITY STILL WIP)
- Modified the CalendarInnerCell css class to allow for text inside as well (with help from Rhyder)
- Added a method to the backend that lets you find if an email has an Availability on this particular Schedule.
I really tried, man.
Anyway, progress is stuck at the "validate selection" portion: I need a way of guaranteeing that exactly two people are swapping, one is known (the user that gave their email and created the request) and the second is going to be selected from a button on the left, if I can get that to render right.
Still needs to happen:
- shift assignments need to be correctly read and interpreted by the backend into a SwapRequest object (shouldn't be that bad, but ScheduleController.RequestSwap() needs to have the input changed from List<ShiftAssignment> to a string array of times, then parse each of those times to find which party (A or B) owns that shift, *then* it can add that into the backend.
- Send out the email confirmation to the creating user when they send the request to the backend (probably a new backend function)
- Send out the email request to the other swapping user (will probably use function created from above)
- Create a landing page for the two requested swappers that just shows the trade offer
- process that (just make the backend call "api/swap/{swapRequestGuid}/processSwap) and that should work
- send an email to the manager informing of the swap
- add a preference for the manager to block/allow swaps and the corresponding functionality for that (i.e. disable the request swap button or block it w/ a ternary)
meeee - I made a DTO for the swap request that takes in the necessary info to be sent to the backend. It comes with a corressponding type on the frontend (`CreateSwapRequestProps`) that stores start times, requesterID, and recipient ID. - I also attempted to make selection colors w/ Rhyder's help, but it doesn't work so well since the calendar object assigns color based on string rather than AvailDbId's. So schedules w/ multiple people will not cooperate.
why did I think this would work? Anyway it's redudndant bc we have dto now.
- I need to still validate a couple things:
- atm, the system does not check to make sure that all selected times belong to either the requester or the recipient of the swap request. But it does make sure that any selected shifts that belong to the requester or the recipient will be added to the backend request. So, it's like... kinda working.
It should def be handled on the frontend too, but right now a request that has a time selected that belongs to neither the requester or recipient will throw an error.
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.
🛠️ Changes in this PR:
Minor Stuff
🧠 Rationale:
[Were there any trade-offs you had to weigh? Alternative approaches considered? Things you want people to look at?]
The SwapRequests needs to be much stricter on the validation at the moment. Shifts that do not apply to either the requester nor the requester's buddy will not give an error, and will just be ignored by the system, but this would be confusing unless fixed. So I will fix it.Validation is here! Trying to make a swapRequest w/ time that belong to neither party will now error (as expected).✅ Steps to test:
📸 Screenshots/Videos: