-
Notifications
You must be signed in to change notification settings - Fork 35
Change ui on led sign page to have a tab, if the user is an officer or admin #1988
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
base: Request-Button4LEDSIGN
Are you sure you want to change the base?
Conversation
86a5910 to
0572c22
Compare
9a95a43 to
f941ea6
Compare
| approved: { | ||
| type: Boolean, | ||
| default: false, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets use an enum here, like PENDING, APPROVED, DENIED
| if (existingRequest) { | ||
| if (existingRequest.status === PermissionRequestStatus.PENDING) { | ||
| return res.sendStatus(CONFLICT); | ||
| } | ||
| existingRequest.status = PermissionRequestStatus.PENDING; | ||
| existingRequest.createdAt = new Date(); | ||
| await existingRequest.save(); | ||
| return res.sendStatus(OK); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think if it exists we just return conflict no matter what, what do you think
if its denied, we can set the status to pending
| if (!type || !Object.keys(PermissionRequestTypes).includes(type)) { | ||
| return res.status(BAD_REQUEST).send({ error: 'Invalid type' }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing like we did before can we do
`type ${type} is invalid, valid types are ${Object.keys(PermissionRequestTypes)}`| if (res.ok) { | ||
| // API returns 200 with no body, so we just mark success | ||
| status.responseData = true; | ||
| } else if (res.status === 409) { | ||
| // CONFLICT - duplicate request | ||
| status.error = true; | ||
| status.responseData = 'Request already exists'; | ||
| } else { | ||
| status.error = true; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (res.ok) { | |
| // API returns 200 with no body, so we just mark success | |
| status.responseData = true; | |
| } else if (res.status === 409) { | |
| // CONFLICT - duplicate request | |
| status.error = true; | |
| status.responseData = 'Request already exists'; | |
| } else { | |
| status.error = true; | |
| } | |
| status.error = !!res.ok; | |
| if (res.status === 409) { | |
| // CONFLICT - duplicate request | |
| status.responseData = 'Request already exists'; | |
| } |
| }); | ||
|
|
||
| if (res.ok) { | ||
| status.responseData = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets not even set responseData
for these create/delete requests we can just rely on if error is true/false for checking if it worked

-officer and admin tab for approving led sign requests
-table for approving requests from members
-i will make it so members can see the ui once approved in step 5
-for the permission requests it shows the name, email, and the date it was requested