Locations — Code Map
API
| File | Purpose |
|---|---|
apps/api/src/locations/locations.module.ts | Wires controller + service; imports MembershipsModule. |
apps/api/src/locations/locations.controller.ts | Routes, toLocationResponse mapper. |
apps/api/src/locations/locations.service.ts | CRUD + tier-limit check via @fitkit/shared.checkTierLimit. |
apps/api/src/locations/dto/create-location.dto.ts | name, address?, city?, country?, latitude?, longitude?, capacity?. |
apps/api/src/locations/dto/update-location.dto.ts | PartialType of create. |
Routes (prefix organizations/:orgId/locations)
| Method | Path | Handler | Notes |
|---|---|---|---|
| POST | / | create | owner/admin + tier check |
| GET | / | list | any member |
| GET | /:id | getById | any member |
| PATCH | /:id | update | owner/admin |
| DELETE | /:id | remove (deactivate) | owner/admin |
Web
apps/web/src/components/onboarding/address-autocomplete.tsx— Google Places integration that fills address + city + country + lat/lng.apps/web/src/app/[lang]/(protected)/dashboard/settings/page.tsxand the schedule “locations” tab (i18n keys:schedule.locationsTab,schedule.locationSheet).
DB tables
| Table | Used as |
|---|---|
locations | Owned. |
organizations | Direct parent (FK on locations.organization_id). |
class_sessions | References location_id (nullable). |
Shared schemas
LocationResponseinlibs/shared/src/lib/schemas/organization.schema.ts(TODO: verify exact file; toResponse shape:{ id, name, address, city, country, latitude, longitude, capacity, isActive, createdAt }).checkTierLimit(platformTier, 'maxLocations', currentCount)exported from@fitkit/shared.
Tests
No dedicated locations.service.unit.spec.ts found. Tier limit logic is covered via integration tests on the platform-tiers module. TODO: add unit tests for CRUD + tier rejection.