Feature: Gasthund-Zugang für Sitter
- sitting_subscriptions Tabelle (dog_id, owner_id, sitter_id, valid_until) - POST/DELETE/GET /api/sitting-access — Zugang gewähren/widerrufen/auflisten - GET /api/dogs gibt Gasthunde zurück (is_guest=True, sitting_until, owner_name) - Diary POST erlaubt Sitter-Schreibzugang; PATCH/DELETE nur für Besitzer - Dog-Switcher: GAST-Badge bei fremden Hunden - Dog-Profil: Sitter-Zugang-Sektion (nur für Besitzer), Freund auswählen + Datum - Diary Detail-View: Bearbeiten-Button für Gasthunde ausgeblendet
This commit is contained in:
parent
eef787cc72
commit
289158b2cd
10 changed files with 327 additions and 18 deletions
|
|
@ -803,6 +803,22 @@ def _migrate(conn_factory):
|
|||
""")
|
||||
logger.info("Migration: health_media Tabelle bereit.")
|
||||
|
||||
# Gasthund-Zugang: Sitter darf temporär für Hund schreiben
|
||||
conn.executescript("""
|
||||
CREATE TABLE IF NOT EXISTS sitting_subscriptions (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
dog_id INTEGER NOT NULL REFERENCES dogs(id) ON DELETE CASCADE,
|
||||
owner_id INTEGER NOT NULL REFERENCES users(id),
|
||||
sitter_id INTEGER NOT NULL REFERENCES users(id),
|
||||
valid_until TEXT NOT NULL,
|
||||
created_at TEXT DEFAULT (datetime('now')),
|
||||
UNIQUE(dog_id, sitter_id)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_sitting_sub_sitter ON sitting_subscriptions(sitter_id, valid_until);
|
||||
CREATE INDEX IF NOT EXISTS idx_sitting_sub_owner ON sitting_subscriptions(owner_id);
|
||||
""")
|
||||
logger.info("Migration: sitting_subscriptions Tabelle bereit.")
|
||||
|
||||
# Walk-Einladungen (RSVP)
|
||||
conn.executescript("""
|
||||
CREATE TABLE IF NOT EXISTS walk_invitations (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue