Closes #2 ## Summary - make `markInvoicePaid` idempotent for already-paid invoices and reject invalid terminal transitions - add admin actor metadata and audit-log writes for `mark-paid`, including replayed no-op calls - add focused DB tests for first activation, replay safety, and invalid transition handling - document the current payment system, including invoice creation, manual activation, quota reset, and current limitations ## Testing - built `infra/docker/web.Dockerfile` - ran `pnpm --filter @nproxy/db test` inside the built container - verified `@nproxy/db build` and `@nproxy/web build` during the image build Co-authored-by: sirily <sirily@git.shararam.party> Reviewed-on: #18
packages/db
Database package for nproxy.
Implemented in this iteration
- Prisma package scaffold
- Current Prisma schema for persisted state
- Shared schema path export for runtime tooling
Current scope
- Users and subscription state
- Manual crypto invoices
- Generation requests and provider-key attempts
- Usage ledger
- Provider keys, optional proxies, and auditable state events
- Telegram pairing and admin allowlist
- Admin audit log