All four endpoints in the trust router use manual hasRolePermission checks inside the handler instead of the dedicated permission-procedure pattern used elsewhere.
File: src/server/api/routers/trust.ts
| Endpoint |
Line |
getTrustLogs |
18 |
getTrustStats |
82 |
runMonthlyActiveBonus |
125 |
adjustTrustScore |
137 |
Also, getTrustLogs contains inline query logic that should be abstracted into a repository or service (line 24).
Action required:
- Switch each procedure from
protectedProcedure + inline role check to the appropriate permission procedure (e.g., superAdminProcedure).
- Extract the
getTrustLogs query logic into a TrustRepository or TrustService.
- Verify the UI access checks still match after the refactor.
Requested by @Producdevity — related to PR #375
All four endpoints in the trust router use manual
hasRolePermissionchecks inside the handler instead of the dedicated permission-procedure pattern used elsewhere.File:
src/server/api/routers/trust.tsgetTrustLogsgetTrustStatsrunMonthlyActiveBonusadjustTrustScoreAlso,
getTrustLogscontains inline query logic that should be abstracted into a repository or service (line 24).Action required:
protectedProcedure+ inline role check to the appropriate permission procedure (e.g.,superAdminProcedure).getTrustLogsquery logic into aTrustRepositoryorTrustService.Requested by @Producdevity — related to PR #375