Skip to Content
Living documentation — last reviewed 2026-05-28
FeaturesClass TypesClass Types — Code Map

Class Types — Code Map

API

FilePurpose
apps/api/src/class-types/class-types.module.tsWires controller + service; imports MembershipsModule.
apps/api/src/class-types/class-types.controller.tsRoutes; toResponse mapper to ClassTypeResponse (@taikan/shared).
apps/api/src/class-types/class-types.service.tsCRUD; depends on MembershipsService.requireMembership for auth, raw programs query for org-belonging check, and an org check on defaultLocationId.
apps/api/src/class-types/dto/create-class-type.dto.tsprogramId, name, description?, defaultDurationMin?, defaultCapacity?, defaultLocationId? (uuid or null), color?, hasWorkout?.
apps/api/src/class-types/dto/update-class-type.dto.tsPartialType minus programId.

Routes (prefix organizations/:orgId/class-types)

MethodPathHandlerNotes
POST/createowner/admin
GET/listany member; optional ?programId= filter
GET/:idgetByIdany member
PATCH/:idupdateowner/admin
DELETE/:idremove (deactivate)owner/admin

Web

  • apps/web/src/components/overview/schedule/class-type-dialog.tsx — create/edit dialog, including the default space picker. Opened from apps/web/src/components/overview/programming/program-class-types-tab.tsx.
  • apps/web/src/app/[lang]/(protected)/dashboard/schedule/page.tsx and its sub-tabs render the class types ribbon.
  • i18n keys: schedule.classTypes*, schedule.classTypeSheet* in libs/shared/src/lib/i18n/dictionaries/{en,he,ru}.json.

DB tables

TableUsed as
class_typesOwned.
programsParent FK (class_types.program_id). Org boundary lives here.
class_sessionsChild; references class_type_id.
locationsclass_types.default_location_id → locations.id (ON DELETE SET NULL).
daily_programmingKeys by class_type_id + date.

Shared schemas

  • libs/shared/src/lib/schemas/scheduling.schema.ts — ClassTypeResponse shape:
    { id, programId, name, description, defaultDurationMin, defaultCapacity, defaultLocationId, color, hasWorkout, isActive, createdAt, program: { id, name, deliveryMode } }

Tests

  • class-types.audit.unit.spec.ts — the remove (deactivate) audit trail.
  • class-types.find-all.unit.spec.ts — findAll’s SQL scoping: org isolation via the programs join, and the optional programId filter. Most other CRUD is exercised indirectly through scheduling specs.