Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#141 task template stages visibility successfully toggles. #144

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ArmaanMehra
Copy link

  • Adds visibility to IBatteryStage Schema. Created an endpoint to update the field based on the given status (on = true off = false). Now, visibility of task template stages can be toggled using the /admin/battery//stage//visibility/ path.

  • If the battery/stage is not found, a 404 error is thrown.

  • Tested using Postman/MongoDB instances. Tested turning the visibility on and off for a specific stage.

visibility_on
visibility_off

@ArmaanMehra ArmaanMehra linked an issue Feb 16, 2025 that may be closed by this pull request
@ArmaanMehra ArmaanMehra requested a review from arath7 February 16, 2025 08:09
@ArmaanMehra ArmaanMehra self-assigned this Feb 16, 2025
Copy link
Contributor

@arath7 arath7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing + code LGTM! Only thing is I would suggest we do more graceful error handling in a comment I put down below because there is nothing the user can really do if the toggle is NOT on/off, also I'm thinking since it's going to be a toggle it has to be on/off only.

stageId: string,
visibility: string
): APIResponse<IBattery> => {
if (visibility !== "on" && visibility !== "off") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my only thought with this is that the visibility must be on or off, so perhaps if there is some more graceful error handling or we just default to off that might be better than throwing an error

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we simply remove the check? That way, our logic would dictate that visibilityBool is true if visibility is "on", and if it's anything else, it simply defaults to false. This would include the case where the caller of the API states the visibility to be "off".

@arath7 arath7 mentioned this pull request Feb 17, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API request and backend for hiding/showing task template stages
2 participants