feat: sistem de linkuri publice pentru proprietăți
Expune fluxul de rezervare anonimă printr-un link public partajabil
(/book/<slug>), cu calendar public, cod QR și proprietate demo publică.
Backend:
- slug + list_on_landing pe Property; utilitar slugify (diacritice RO,
cuvinte rezervate, ban all-digit) + migrare idempotentă raw-DDL rulată
din entrypoint; SQLite WAL + busy_timeout
- GET /public/properties/{slug_or_id}(+/spaces): rezolvare slug/ID, 404 uniform
- GET /public/spaces/{id}/busy: doar {start_time,end_time} (fără PII),
pending+approved, tz-aware/interval>60z → 422, orfan/privat → 404
- availability: scrub user_name/title (fix scurgere PII)
- POST /public/bookings: overlap pending+approved, cap 5/email/spațiu/zi,
rate-limit per-IP, suprimare notificări+email pe demo, email confirmare guest
- PATCH slug (409 duplicat / 422 format / 403 non-manager); guest_email EmailStr
- email guest la aprobare/respingere cu cod #RB-<id>
- teste noi: test_public.py + test_migrate_slug.py (33 teste)
Frontend:
- rută /book/:slug; PublicBooking rescris cu calendar grid manual
(PublicCalendar + GuestBookingForm), 30min, 08-20, mobil day-view, RO
- card „Link public" în PropertyDetail: copy, edit slug, QR pe URL-ul cu ID
- secțiune proprietăți publice + CTA pe Landing; buton copy în Properties
Gate aprobat (U1-U3, G1 grid manual, G2 list_on_landing); G3-G5 în TODOS.md.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ from datetime import datetime, timedelta
|
||||
|
||||
from app.core.config import settings
|
||||
from app.core.security import get_password_hash
|
||||
from app.core.slug import DEMO_SLUG
|
||||
from app.db.session import Base, SessionLocal, engine
|
||||
from app.models.attachment import Attachment
|
||||
from app.models.booking import Booking
|
||||
@@ -126,8 +127,10 @@ def _seed_demo_data(db, demo: User) -> None:
|
||||
name=DEMO_PROPERTY_NAME,
|
||||
description="Mediu de test — datele se resetează automat la fiecare 3 ore.",
|
||||
address="Str. Exemplu nr. 1",
|
||||
is_public=False, # visible only to the demo account
|
||||
is_public=True,
|
||||
is_active=True,
|
||||
list_on_landing=True,
|
||||
slug=DEMO_SLUG,
|
||||
)
|
||||
db.add(prop)
|
||||
db.flush()
|
||||
|
||||
Reference in New Issue
Block a user