Update backend implementation to fit spec

This commit is contained in:
Jon Staab
2026-03-25 11:43:09 -07:00
parent 2e0740910c
commit cb2e37c74a
19 changed files with 1798 additions and 2341 deletions
+7 -4
View File
@@ -4,20 +4,23 @@ Repo is a wrapper around a sqlite pool which implements methods related to datab
Members:
- `database_url: String` - the location of the sqlite database, from `DATABASE_URL`
- `pool: sqlx::SqlitePool` - a sqlite connection pool
Notes:
- All public methods should be run in a transaction so they're atomic
- All public write methods should be run in a transaction so they're atomic
- All writes should be accompanied by an activity log entry of `(activity_type, identifier)`
## `pub fn new() -> Self`
- Reads environment and populates members
- Ensures that any directories referred to in `self.database_url` exist
- Reads `DATABASE_URL` from environment
- Ensures that any directories referred to in `DATABASE_URL` exist
- Initializes its sqlx `pool`
## `pub fn migrate(&self) -> Result<()>`
- Runs migrations found in the `migrations` directory.
## `pub fn list_tenants(&self) -> Result<Vec<Tenant>>`
- Returns all tenants