-
Notifications
You must be signed in to change notification settings - Fork 1
Add publish property to fundraisers #66
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: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for curaise ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Hi Steven, thanks for implementing the publish property for fundraisers! I've noticed small issues, but overall the implementation is great!
| export const publishFundraiserHandler = async ( | ||
| req: Request<FundraiserRouteParams, any, {}, {}>, | ||
| res: Response | ||
| ) => { | ||
| const fundraiser = await getFundraiser(req.params.id); | ||
| if (!fundraiser) { | ||
| res.status(404).json({ message: "Fundraiser not found" }); | ||
| return; | ||
| } | ||
|
|
||
| // Check if user is admin of fundraiser's organization | ||
| if ( | ||
| !fundraiser.organization.admins.some( | ||
| (admin) => admin.id === res.locals.user!.id | ||
| ) | ||
| ) { | ||
| res.status(403).json({ message: "Unauthorized to update fundraiser" }); | ||
| return; | ||
| } | ||
| }; | ||
|
|
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.
This doesn't include the logic for publishing the fundraiser
| res.status(404).json({ message: "Fundraiser not found" }); | ||
| return; | ||
| } | ||
|
|
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.
We might also need isPublished check for this route
This PR adds the backend for "publish" feature for fundraisers. Fundraisers will be in a draft mode before being published. The frontend will be completed in a separate PR.
Changes: