Files
web-petting/CLAUDE.md
T
Ultradesu ff32e6bbaf
Build and Publish / Build and Publish Docker Image (push) Successful in 1m12s
init
2026-04-29 17:49:07 +03:00

2.4 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

Pet sitting web service for managing clients and bookings. The owner uses the site to:

  • Receive and manage client requests (leads) from the website
  • Schedule calls and visits with clients
  • Upload photos/videos of pets for remote viewing by clients (public media page via unique token)
  • Get Telegram notifications about new requests

Tech Stack

  • Language: Rust (edition 2024)
  • Web framework: Cot — Rust web framework (Django-like), local path ../cot/cot
  • Database: SQLite (via Cot ORM), file db.sqlite3
  • Notifications: Telegram Bot API

Build & Run

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)

Architecture

Monolithic Cot web app with a single SQLite 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)

Database Design Principles

  • Soft-delete everywhere: records are never physically deleted, only status changes (e.g. active -> archived, new -> rejected). This ensures data can always be recovered.
  • Status fields are stored as String with enum-like values defined in models.rs.
  • Foreign keys use cot::db::ForeignKey<T> with Restrict on delete/update.

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.)