Skip to content

Conversation

@stevenyuser
Copy link
Collaborator

@stevenyuser stevenyuser commented Oct 27, 2025

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:

  • Changed schema for fundraisers to include published property
  • Added check to ensure that published fundraisers cannot update items' prices
  • Added check to not show unpublished fundraisers in "Browse" tab and buyer organization page
  • Added two new routes:
    • /:id/publish - publish fundraiser
    • /:fundraiserId/items/:itemId/delete - delete a fundraiser item (only allowed if fundraiser is not published)

@netlify
Copy link

netlify bot commented Oct 27, 2025

Deploy Preview for curaise ready!

Name Link
🔨 Latest commit cafca11
🔍 Latest deploy log https://app.netlify.com/projects/curaise/deploys/690c5cdc0dc9e10008bf09f4
😎 Deploy Preview https://deploy-preview-66--curaise.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@Shengle-Dai Shengle-Dai left a 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!

Comment on lines 256 to 276
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;
}
};

Copy link
Contributor

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;
}

Copy link
Contributor

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

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.

3 participants