Skip to content

Multi-tenancy, lodge content CMS, stays & driver/tracker #17

@nbarrett

Description

@nbarrett

Context

This issue covers introducing multi-tenancy (Business entity), moving all hardcoded lodge content into the database with a WYSIWYG CMS, managing guest stays with driver/tracker assignments, and wiring driver/tracker into the game drive flow.


Phase 1: Business Model + Multi-tenancy

  • Business model added to Prisma schema (id, name, slug)
  • User model updated with businessId relation
  • Lodge model updated with businessId relation
  • PointOfInterest model updated with lodgeId relation
  • Auth session includes businessId (with JWT fallback for existing tokens)
  • Seed creates "Klaserie Private Camps" business
  • Dundee Camp removed entirely from seed and database
  • All existing users and lodges backfilled with businessId
  • Registration derives businessId from selected lodge
  • Lodge and POI routers scoped to business

Phase 2: Lodge Content CMS

  • Lodge schema expanded: slug, tagline, description, highlights, capacity, detailedLocation, heroImages, brandName, brandLogoUrl, brandLogoLight, brandAccentColour, brandWebsiteUrl, mapOverlayUrl, mapOverlayBounds
  • Old brand/logoUrl fields removed
  • Hardcoded lodge-data.ts deleted — all content now in database
  • lodge.bySlug query (public, for lodge detail page)
  • lodge.showcase query (public, for lodge listing page)
  • lodge.update mutation (admin, for editing lodge content)
  • Lodge listing page (/lodges) rewritten to fetch from DB
  • Lodge detail page (/lodges/[slug]) rewritten to fetch from DB with Markdown rendering
  • Admin lodge content editor (/admin/lodges) with WYSIWYG Markdown editor (@uiw/react-md-editor)
  • Map overlay now dynamic (removed hardcoded Dundee overlay)
  • Seed populates all lodge content fields for Nzumba and Last Word Kitara

Phase 3: Stay Model

  • Stay model added to Prisma schema with lodge relation, date range, label, driver name, tracker name
  • Stay router: list, active, create, update, delete
  • Admin stays page (/admin/stays) with full CRUD
  • Active stay indicator (green badge) on stays list
  • Multiple overlapping stays per lodge supported

Phase 4: Driver/Tracker on Drives

  • DriveSession schema updated with optional driverName and trackerName fields
  • Drive start flow prompts for driver and tracker (crew selection modal)
  • Pre-filled from active stay if available, with option to override or skip
  • Driver and tracker names saved on each drive session
  • Driver and tracker shown on drive detail page
  • Driver and tracker shown on drive history list
  • updateCrewDetails mutation for editing crew after drive starts

Phase 5: Nav & UX Improvements

  • Admin nav items grouped under "Admin" dropdown (desktop) / section header (mobile)
  • Verify admin dropdown renders correctly after cache clear
  • Offline support for driver/tracker (stored locally, synced when online)

Dependencies

Phase 1 (Business + Session)
  ├──> Phase 2 (Lodge Content CMS)  ─┐
  └──> Phase 3 (Stay Model)         ─┼──> Phase 4 (Driver/Tracker)
                                     ─┘
Phase 5 (Nav/UX) — independent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions