Data model
The main Sequelize models behind bounties, payment requests and wallets, and how they relate.
Models live in src/models/, one file per model. Migrations are in src/db/migrations/ and seed data in src/db/seeders/.
The main models, grouped by product.
People and structure
| Model |
What it is |
User |
An account. Holds roles (through Type), sign-in providers and the payout account IDs for Whop and Stripe. |
Type |
A role: Contributor, Funding, Maintainer, Provider. |
Organization |
The owner of a repository. Has many projects. |
Project |
A repository. Has many tasks, and programming languages through ProjectProgrammingLanguage. |
Label, ProgrammingLanguage |
Issue labels and languages, used for filtering. |
Member, Role |
Membership and permissions on a task. |
Bounties
| Model |
What it is |
Task |
An imported issue. In the app it’s called an issue. Holds the URL, provider, state, value, deadline and visibility. |
Order |
A payment toward a task’s bounty: card, invoice, wallet or pay later. Linked to a Plan. |
Plan, PlanSchema |
The fee plan applied to an order: open source (8%), open source from $5,000 (0%), private (18%), plus refund plans. |
Assign |
A contributor assigned to a task. |
Offer |
Legacy: bounty offers from contributors. Offers are no longer part of the app. |
TaskSolution |
A pull request submitted as a solution, with the result of each check. |
Transfer |
A bounty transferred to the contributor’s payout account. |
Payout |
Money leaving a user’s payout balance for their bank. |
History |
A task’s history of state changes. |
Coupon |
A discount code for card payments. |
Payment requests
| Model |
What it is |
PaymentRequest |
A payment link. Holds the title, amount or custom amount flag, settings, the provider resources, and platform_fee_percent, snapshotted at creation. |
PaymentRequestCustomer |
The customer who paid. |
PaymentRequestPayment |
One payment on a link, with gross, fees, net amount and status. |
PaymentRequestTransfer |
The transfer to the seller for older links, and the claim shown to them. |
PaymentRequestBalance, PaymentRequestBalanceTransaction |
The seller’s ledger of refund and dispute costs on older links. |
Wallets
| Model |
What it is |
Wallet |
A prepaid balance. The balance is computed from its wallet orders. |
WalletOrder |
A top-up, paid by invoice. |
PlatformPublicStats stores the public totals shown on the site. It’s refreshed daily by the sync-stats job. See Scheduled jobs.
Conventions
- Business logic doesn’t query models directly in controllers. Reads go in
src/queries/, writes in src/mutations/.
- Sensitive user fields are excluded by default scopes; use the
selfView scope only for the account owner.
Next steps