Moved to PSQL.
Build and Publish / Build and Publish Docker Image (push) Successful in 1m42s

This commit is contained in:
ab
2026-07-11 14:11:31 +03:00
parent 91ca486e64
commit 1bd3e17672
13 changed files with 483 additions and 748 deletions
+26 -20
View File
@@ -13,30 +13,36 @@ Pet sitting web service for managing clients and bookings. The owner uses the si
## Tech Stack
- **Language:** Rust (edition 2024)
- **Web framework:** [Cot](https://github.com/cot-rs/cot) Rust web framework (Django-like), local path `../cot/cot`
- **Database:** SQLite (via Cot ORM), file `db.sqlite3`
- **Web framework:** [Cot](https://github.com/cot-rs/cot) - Rust web framework (Django-like), local path `../cot/cot`
- **Database:** PostgreSQL (via Cot ORM)
- **Notifications:** Telegram Bot API
## Build & Run
```sh
cargo build # build
cargo run # run dev server at http://127.0.0.1:8000
cargo test # run all tests
cargo test <name> # run a single test by name
cargo clippy # lint
cargo fmt --check # check formatting
cot migration make # generate migrations from model changes (requires cot-cli)
cargo build # build
cargo run # run dev server at http://127.0.0.1:8000
cargo test # run all tests
cargo test <name> # run a single test by name
cargo clippy # lint
cargo fmt --check # check formatting
cot migration make # generate migrations from model changes (requires cot-cli)
```
Set `WEB_PETTING_DATABASE_URL` (or `DATABASE_URL`) before running the app or migrations. Example:
```sh
WEB_PETTING_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/web_petting cargo run
```
## Architecture
Monolithic Cot web app with a single SQLite database.
Monolithic Cot web app with a single PostgreSQL database.
- `src/main.rs` project/app setup, router, config
- `src/models.rs` all database models (Lead, Client, Visit, Media, User, Setting)
- `src/migrations.rs` migration registry (auto-generated by `cot migration make`)
- `src/migrations/` migration files (auto-generated)
- `src/main.rs` - project/app setup, router, config
- `src/models.rs` - all database models (Lead, Client, Visit, Media, User, Setting)
- `src/migrations.rs` - migration registry
- `src/migrations/` - migration files
## Database Design Principles
@@ -46,9 +52,9 @@ Monolithic Cot web app with a single SQLite database.
## Data Model
- **Lead** (`new`/`in_progress`/`converted`/`rejected`) public form submission; links to Client when converted
- **Client** (`active`/`archived`) confirmed client with `media_token` for public media page
- **Visit** (`scheduled`/`completed`/`cancelled`) pet sitting session, belongs to Client
- **Media** (`active`/`archived`) photo/video, belongs to Client, optionally to Visit
- **User** (`active`/`archived`) admin accounts (supports multiple admins)
- **Setting** global key-value config (telegram_bot_token, telegram_chat_id, etc.)
- **Lead** (`new`/`in_progress`/`converted`/`rejected`) - public form submission; links to Client when converted
- **Client** (`active`/`archived`) - confirmed client with `media_token` for public media page
- **Visit** (`scheduled`/`completed`/`cancelled`/`deleted`) - pet sitting session, belongs to Client and User
- **Media** (`active`/`archived`) - photo/video, belongs to Client, optionally to Visit
- **User** (`active`/`archived`) - admin accounts (supports multiple admins)
- **Setting** - global key-value config (telegram_bot_token, telegram_chat_id, etc.)