fix(#236,#239): Prisma indexes, soft deletes & multi-NGO RBAC#242
Merged
Cedarich merged 1 commit intoPulsefy:mainfrom Mar 30, 2026
Merged
Conversation
…-NGO RBAC Issue Pulsefy#236 - Prisma Query Optimization & Performance Indexing: - Add @@index on Claim(status), Claim(campaignId), Claim(createdAt), Claim(deletedAt) - Add @@index on Campaign(ngoId), Campaign(deletedAt) - Add deletedAt soft-delete column to Campaign and Claim models - ClaimsService.findAll/findOne now filter out soft-deleted records - CampaignsService.findOne throws NotFoundException for soft-deleted campaigns - CampaignsService.softDelete() method added - New migration: 20260330000000_rbac_indexes_soft_delete Issue Pulsefy#239 - Advanced RBAC for Multi-NGO Admin Actions: - Add ngoId to ApiKey and Campaign Prisma models - ApiKeyGuard attaches ngoId from DB record to request.user - New OrgOwnershipGuard: NGO operators can only access their org's resources - CampaignsController: POST/PATCH routes use OrgOwnershipGuard - CampaignsService.create() accepts ngoId; findAll() scopes by ngoId for NGO role - GET /campaigns scoped to caller's ngoId when role is ngo - Express Request type extended with ngoId field Tests: 169 passed, 0 failed
|
@Fahmedo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Cedarich
approved these changes
Mar 30, 2026
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.
Summary
Fixes #236 and #239 in a single PR.
close #236
close #239
Issue #236 — Prisma Query Optimization & Performance Indexing
@@indexonClaim(status),Claim(campaignId),Claim(createdAt),Claim(deletedAt)@@indexonCampaign(ngoId),Campaign(deletedAt)deletedAtsoft-delete column toCampaignandClaimmodelsClaimsService.findAll/findOnenow filter out soft-deleted recordsCampaignsService.findOnethrowsNotFoundExceptionfor soft-deleted campaignsCampaignsService.softDelete()method added20260330000000_rbac_indexes_soft_deleteIssue #239 — Advanced RBAC for Multi-NGO Admin Actions
ngoIdtoApiKeyandCampaignPrisma modelsApiKeyGuardnow attachesngoIdfrom the DB record torequest.userOrgOwnershipGuard: NGO operators can only access their own org's resources; admins bypassCampaignsControllerPOST/PATCH routes useOrgOwnershipGuardCampaignsService.create()acceptsngoId;findAll()scopes byngoIdfor NGO roleGET /campaignsis automatically scoped to the caller'sngoIdwhen role isngoExpress.Requesttype extended withngoIdfieldCI