Add Meeting system subject and notification system
- Auto-create a locked "Meeting" subject for every user on registration and seed it for all existing users on startup - Meeting subject cannot be deleted or renamed (is_system flag) - 5-minute corner toast warning on Dashboard and TV with live countdown, dismiss button, and 1-minute re-notify if dismissed - At start time: full-screen TV overlay with 30-second auto-dismiss, automatic pause of running block, switch to Meeting block, and auto-start of Meeting timer - Web Audio API chimes: rising on warnings, falling at meeting start - Update README with Meeting subject and notification system docs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,12 +2,15 @@ from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from sqlalchemy import text
|
||||
from sqlalchemy import select, text
|
||||
from sqlalchemy.exc import OperationalError
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.config import get_settings
|
||||
from app.database import engine
|
||||
from app.models import Base
|
||||
from app.models.subject import Subject
|
||||
from app.models.user import User
|
||||
from app.routers import auth, users, children, subjects, schedules, sessions, logs, dashboard
|
||||
from app.routers import morning_routine, break_activity, admin
|
||||
from app.websocket.manager import manager
|
||||
@@ -35,6 +38,27 @@ async def lifespan(app: FastAPI):
|
||||
await _add_column_if_missing(conn, "schedule_blocks", "break_time_minutes", "INT NULL")
|
||||
await _add_column_if_missing(conn, "children", "strikes", "INT NOT NULL DEFAULT 0")
|
||||
await _add_column_if_missing(conn, "users", "timezone", "VARCHAR(64) NOT NULL DEFAULT 'UTC'")
|
||||
await _add_column_if_missing(conn, "subjects", "is_system", "TINYINT(1) NOT NULL DEFAULT 0")
|
||||
|
||||
# Seed Meeting system subject for any existing users who don't have one
|
||||
from app.database import AsyncSessionLocal
|
||||
async with AsyncSessionLocal() as db:
|
||||
users_result = await db.execute(select(User).where(User.is_active == True))
|
||||
all_users = users_result.scalars().all()
|
||||
for user in all_users:
|
||||
existing = await db.execute(
|
||||
select(Subject).where(Subject.user_id == user.id, Subject.is_system == True)
|
||||
)
|
||||
if not existing.scalar_one_or_none():
|
||||
db.add(Subject(
|
||||
user_id=user.id,
|
||||
name="Meeting",
|
||||
icon="📅",
|
||||
color="#6366f1",
|
||||
is_system=True,
|
||||
))
|
||||
await db.commit()
|
||||
|
||||
yield
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user