Review pass

This commit is contained in:
Jon Staab
2026-03-25 17:01:52 -07:00
parent 6f407fd681
commit 28e564e795
10 changed files with 70 additions and 154 deletions
+17 -13
View File
@@ -1,5 +1,8 @@
This file describes the domain model. This description should be translated into standard structs and sqlite schemas in a way that makes sense.
- Fields marked as private should use `#[serde(skip_serializing)]` in their definition.
- Fields marked as readonly should use `#[serde(skip_deserializing)]` in their definition.
# Activity
Activity is an audit log of all actions performed by a user or a worker process. This allows us to trace history to create invoices, synchronize actions to external services, and debug system behavior.
@@ -7,18 +10,19 @@ Activity is an audit log of all actions performed by a user or a worker process.
- `id` - a random activity ID
- `created_at` - unix timestamp when the activity was created
- `activity_type` is one of:
- `tenant_created`
- `tenant_billing_anchor_updated`
- `relay_created`
- `relay_updated`
- `relay_activated`
- `relay_deactivated`
- `relay_sync_failed`
- `invoice_created`
- `invoice_paid`
- `invoice_attempted`
- `invoice_sent`
- `invoice_closed`
- `create_tenant`
- `update_tenant_billing_anchor`
- `update_tenant_nwc_url`
- `create_relay`
- `update_relay`
- `activate_relay`
- `deactivate_relay`
- `fail_relay_sync`
- `create_invoice`
- `mark_invoice_paid`
- `mark_invoice_attempted`
- `mark_invoice_sent`
- `mark_invoice_closed`
- `identifier` is a string identifying the resource being modified. This id in interpreted depending on what the `activity_type` is.
# Tenant
@@ -26,7 +30,7 @@ Activity is an audit log of all actions performed by a user or a worker process.
Tenants are customers of the service, identified by a nostr `pubkey`. Public metadata like name etc are pulled from the nostr network. They also have associated billing information.
- `pubkey` is the nostr public key identifying the tenant
- `nwc_url` a nostr wallet connect URL used for **paying** invoices generated by the system
- `nwc_url` (private) a nostr wallet connect URL used for **paying** invoices generated by the system
- `created_at` unix timestamp identifying tenant creation time
- `billing_anchor` unix timestamp identifying billing cycle anchor. This gets reset when the tenant has no paid relays and adds (or reactivates) one.