feat: initial commit — HermesMessages SaaS platform
Backend (FastAPI + Python 3.12): - Multi-tenant auth with JWT: login, register, refresh, Meta OAuth - Business & BusinessConfig management - WhatsApp webhook with HMAC signature verification - Bot engine powered by Claude AI - Calendar availability with Redis caching - Reservations CRUD with status management - Dashboard analytics (stats, agenda, peak hours) - Billing & plan management - Admin panel with platform-wide stats - Async bcrypt via asyncio.to_thread - IntegrityError handling for concurrent registration race conditions Frontend (React 18 + Vite + Tailwind CSS): - Multi-step guided registration form with helper text on every field - Login page with show/hide password toggle - Protected routes with AuthContext - Dashboard with stats cards, bar chart, and daily agenda - Reservations list with search, filters, and inline status actions - Calendar with weekly view, slot availability, and date blocking - Config page: business info, schedules, bot personality - Billing page with plan comparison and usage bar Design system: - Bricolage Grotesque + DM Sans typography - Emerald primary palette with semantic color tokens - scale(0.97) button press feedback, ease-out animations - Skeleton loaders, stagger animations, prefers-reduced-motion support - Accessible: aria-labels, visible focus rings, 4.5:1 contrast Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
65
backend/app/modules/business/models.py
Normal file
65
backend/app/modules/business/models.py
Normal file
@ -0,0 +1,65 @@
|
||||
from datetime import date, time
|
||||
|
||||
from sqlalchemy import (
|
||||
Column,
|
||||
Date,
|
||||
Enum,
|
||||
ForeignKey,
|
||||
Integer,
|
||||
String,
|
||||
Time,
|
||||
func,
|
||||
)
|
||||
from sqlalchemy.dialects.postgresql import ARRAY
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class Business(Base):
|
||||
__tablename__ = "businesses"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String, nullable=False)
|
||||
type = Column(String, nullable=False)
|
||||
timezone = Column(String, nullable=False, default="UTC")
|
||||
status = Column(
|
||||
Enum("trial", "active", "suspended", name="business_status"),
|
||||
nullable=False,
|
||||
default="trial",
|
||||
)
|
||||
plan = Column(
|
||||
Enum("free", "basic", "pro", name="business_plan"),
|
||||
nullable=False,
|
||||
default="free",
|
||||
)
|
||||
meta_business_id = Column(String, nullable=True)
|
||||
whatsapp_phone_number_id = Column(String, nullable=True, unique=True)
|
||||
whatsapp_access_token = Column(String, nullable=True)
|
||||
created_at = Column(Date, server_default=func.current_date())
|
||||
|
||||
users = relationship("User", back_populates="business", cascade="all, delete-orphan")
|
||||
config = relationship("BusinessConfig", back_populates="business", uselist=False)
|
||||
reservations = relationship("Reservation", back_populates="business")
|
||||
|
||||
|
||||
class BusinessConfig(Base):
|
||||
__tablename__ = "business_configs"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
business_id = Column(
|
||||
Integer, ForeignKey("businesses.id", ondelete="CASCADE"), nullable=False, unique=True
|
||||
)
|
||||
open_days = Column(ARRAY(Integer), nullable=False, default=list)
|
||||
open_time = Column(Time, nullable=False, default=time(9, 0))
|
||||
close_time = Column(Time, nullable=False, default=time(18, 0))
|
||||
slot_duration = Column(Integer, nullable=False, default=60)
|
||||
max_per_slot = Column(Integer, nullable=False, default=1)
|
||||
blocked_dates = Column(ARRAY(Date), nullable=False, default=list)
|
||||
assistant_name = Column(String, nullable=False, default="Hermes")
|
||||
tone = Column(
|
||||
Enum("formal", "casual", name="assistant_tone"), nullable=False, default="formal"
|
||||
)
|
||||
welcome_message = Column(String, nullable=True)
|
||||
|
||||
business = relationship("Business", back_populates="config")
|
||||
Reference in New Issue
Block a user