Skip to content

[BE-54] Hub settings management: backend (rebuild deleted module) #1292

Description

@yusuftomilola

Overview

The hub-settings module (backend/src/hub-settings/) was removed from the working tree. Hub settings centralise operational configuration (business hours, booking rules, tax rates, branding) that currently has no management endpoint.

Context

  • The original module files exist in git history but are deleted — rebuild with expanded fields
  • ConfigService at backend/src/config/ for environment variable access
  • Referenced by: InvoicesModule (VAT rate), BookingsModule (lead time, cancellation policy), white-labeling (FE-38)

Tasks

  • Create HubSettings entity (singleton — always exactly one row, seeded on startup if absent):
    • id, hubName, address, city, country, timezone (IANA tz string, e.g. Africa/Lagos), currency (default NGN)
    • vatRatePercent (decimal, default 7.5)
    • businessHours (JSONB): { mon: { open: '09:00', close: '18:00', closed: false }, ..., sun: { closed: true } }
    • contactEmail, contactPhone
    • logoUrl (nullable), primaryColor (hex string, nullable), faviconUrl (nullable)
    • bookingLeadTimeHours (int, default 1), maxBookingDaysAhead (int, default 90)
    • cancellationPolicyHours (int, default 24)
    • updatedAt
  • GET /hub-settings — returns all settings (public, no auth required — needed for white-labeling on page load)
  • PATCH /hub-settings — partial update (super_admin only); validates timezone string against IANA list
  • On app start, seed a default HubSettings record if the table is empty
  • Register HubSettingsModule in AppModule

Files to Modify / Create

  • New: backend/src/hub-settings/ (module, entity, controller, service)
  • backend/src/app.module.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions