Coverage for server / utilities / class_limits.py: 100%
2 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-10-04 09:33 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-10-04 09:33 +0000
1"""
2Class-creation limits — single source of truth for the per-teacher class cap.
4Centralized so the cap check (`teacher_classes.create_new_class`), the
5cap-exposed-on-list response (`teacher_classes.all_classes_fetch`), and any
6future frontend/admin reporting code all read the same constant.
8The cap is enforced at the backend; the frontend reads it from the
9`/v1/teacher/class/all/fetch` response (see `class_limit` field) to render
10"X/10 used" indicators and disable Create at cap.
11"""
13from __future__ import annotations
15# Maximum number of LIVE (non-soft-deleted) classes a single teacher may
16# own. Hitting the cap returns 400 from POST /v1/teacher/class/create with
17# a structured detail body so the SPA can render a remediation hint.
18TEACHER_CLASS_LIMIT: int = 10