feat(admin): track organization donations over time

未关闭
#1,971 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清

调研方向

Start by locating the organization admin API, the organizations detail page, and the migration and audit-middleware entry points referenced in the requirements. Review how org_memberships and event_sponsorships handle permissions and history, then verify that donation CRUD, per-currency totals, yearly running totals, staff gating, and mutation audit events are covered.

由索引模型根据 Issue 内容生成。

描述

Summary

Track financial contributions from organizations across time, separate from the recurring-membership tier system. Donations are one-time or campaign-attributed contributions that don't fit org_memberships (annual recurring) or event_sponsorships (event-tied).

Requirements

  • New org_donations table: id, organization_id (FK → organizations.id ON DELETE restrict), amount_cents (bigint), currency (text, ISO 4217, default 'USD'), donation_date (date NOT NULL), campaign (text, nullable — free-form for now), fiscal_year (int, nullable), notes (text), created_at/updated_at/recorded_by_user_id (audit columns)
  • Migration adds the table + index on (organization_id, donation_date DESC) for fast per-org history queries
  • API: GET/POST/PATCH/DELETE /admin/organizations/:id/donations; list returns rows sorted by donation_date desc with per-currency totals as aggregates
  • Org detail page: new "Donations" tab listing the org's contribution history with running totals by year
  • Permissions: donation writes gated on staff tier (canEditOrganizations); consider a canRecordDonations policy if we want to lock this down further later
  • Audit middleware captures all donation mutations (organizations.donation.create, .update, .delete)

Context

Why not extend org_memberships? Memberships are recurring annual tiers with one active row per org; donations are arbitrarily many transactions across time, often campaign-attributed. Why not extend event_sponsorships? Donations aren't event-bound. The clean split is three independent tables sharing only the organization_id FK.

Implementation Notes

amount_cents as bigint keeps us currency-precision-safe without a numeric type. Storing currency per-row instead of org-level lets a single org's history span currency changes (e.g., GBP → USD after a UK org's US subsidiary takes over donations).

Fiscal year is nullable because US-RSE doesn't have one defined yet — leaving the column means we can backfill it later via a single UPDATE keyed off donation_date once the policy is set.

主要语言
HTML
星标
33
派生
107
平均合并
14 小时 6 分钟
30 天内合并 PR
19

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

USRSE/usrse.github.io 的其他 Issue

查看 USRSE/usrse.github.io 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。