Skip to content

feat: split shared subscriptions and settle up - #51

Merged
AmrMsCLL merged 2 commits into
mainfrom
feat/cost-splitting
Oct 5, 2026
Merged

AmrMsCLL merged 2 commits into
mainfrom
feat/cost-splitting

Conversation

@AmrMsCLL

@AmrMsCLL AmrMsCLL commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Stacked on #50. This is 11h of as2026-10-05-strata-phase-11-next-batch-2.md.

What changes

  • In a shared space, editors can Split a subscription: who pays, and which members share it, with weights from 1 to 100. Percentages are shown as you edit.
  • The space's Recurring tab gains a Split costs card for each month. It lists the renewals that actually fall in that month, using the same recurrence code as reminders and stopping at a cancellation. It nets what each pair of members owes per currency.
  • Mark as paid records a payment for the month. Only the person who was paid can record it, so a debtor can't clear their own debt. Either of the two people can undo it, and other members only see it.
  • The split model is keyed by item (cost_splits holds the payer, cost_shares the weights), so events can reuse it later.
  • Member (userId, displayName) moved to spaces.tsx. The database property fields from feat: turn pages into simple databases #46 now import it from there too.

Migration

20261005160000_cost_splitting creates cost_splits (item_id pk, payer_id), cost_shares (item_id, user_id, weight) and settlements (id, space_id, from_user_id, to_user_id, amount_minor, currency, month, created_at). All of them cascade from items, users and spaces.

API

  • PUT/DELETE /subscriptions/:id/split
  • GET /spaces/:id/balances?month=YYYY-MM
  • POST /spaces/:id/settlements, DELETE /settlements/:id
  • Subscriptions gain split ({ payerId, shares } or null).

Verification

  • Server integration: test/integration/cost-splits.spec.ts and test/integration/subscriptions.spec.ts (5 passed).
  • Frontend: test/subscriptions.spec.tsx (6 passed) and test/notes.spec.tsx (10 passed, for the moved Member type).
  • Lint and build pass.

@github-actions github-actions Bot added the size/xl Over 600 changed lines, excluding lockfiles label Oct 5, 2026
@AmrMsCLL
AmrMsCLL force-pushed the feat/statement-import branch from 89733f8 to c73bc5a Compare October 5, 2026 19:06
Base automatically changed from feat/statement-import to main October 5, 2026 19:06
@AmrMsCLL
AmrMsCLL force-pushed the feat/cost-splitting branch from 4771a84 to b6859af Compare October 5, 2026 19:06
@AmrMsCLL
AmrMsCLL merged commit c0063d4 into main Oct 5, 2026
6 checks passed
@AmrMsCLL
AmrMsCLL deleted the feat/cost-splitting branch October 5, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl Over 600 changed lines, excluding lockfiles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant