The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
refactor(vacay): the pure constants live in the helpers, so the service keeps its size budget
Mauricee84060cdf76e
diff --git a/server/scripts/size-baseline.json b/server/scripts/size-baseline.jsonindex bd496dab7..555ab0d27 100644--- a/server/scripts/size-baseline.json+++ b/server/scripts/size-baseline.json@@ -17,5 +17,5 @@"src/nest/plugins/runtime/plugin-sdk.ts": 1093,"src/nest/reservations/reservations.service.ts": 1237,"src/nest/trips/trips.service.ts": 1006,- "src/nest/vacay/vacay.service.ts": 1416+ "src/nest/vacay/vacay.service.ts": 1412}diff --git a/server/src/nest/vacay/vacay.helpers.ts b/server/src/nest/vacay/vacay.helpers.tsindex 7396ba80d..f86c90098 100644--- a/server/src/nest/vacay/vacay.helpers.ts+++ b/server/src/nest/vacay/vacay.helpers.ts@@ -69,3 +69,23 @@ export function shiftIsoDate(isoDate: string, days: number): string {d.setUTCDate(d.getUTCDate() + days);return d.toISOString().slice(0, 10);}++export const CACHE_TTL = 24 * 60 * 60 * 1000;+export const FETCH_TIMEOUT_MS = 10_000;+// A country's holidays for one year are a few kilobytes; two megabytes means the+// provider is misbehaving and we would rather report the usual error than buffer it.+export const MAX_HOLIDAY_BYTES = 2 * 1024 * 1024;+// Both providers key on a 4-digit year and an ISO 3166-1 alpha-2 code. Anything+// else has no business reaching the URL path.+export const YEAR_RE = /^\d{4}$/;+export const COUNTRY_RE = /^[A-Za-z]{2}$/;++// ---------------------------------------------------------------------------+// Color palette for auto-assign+// ---------------------------------------------------------------------------++export const COLORS = [+ '#6366f1', '#ec4899', '#14b8a6', '#8b5cf6', '#ef4444',+ '#3b82f6', '#22c55e', '#06b6d4', '#f43f5e', '#a855f7',+ '#10b981', '#0ea5e9', '#64748b', '#be185d', '#0d9488',+];diff --git a/server/src/nest/vacay/vacay.service.ts b/server/src/nest/vacay/vacay.service.tsindex f65beb380..bafdd0873 100644--- a/server/src/nest/vacay/vacay.service.ts+++ b/server/src/nest/vacay/vacay.service.ts@@ -30,7 +30,7 @@ import { SchoolHolidayRegions } from '../../db/entities/SchoolHolidayRegions.entimport type { SchoolHolidayRegionsRepository } from '../../db/repositories/SchoolHolidayRegions.repository';import {daysAlwaysInMonth, isBlockedWeekend, normalizeFraction, normalizeKind, normalizeYearType, pad2, parseAsUtcMillis,- shiftIsoDate, windowEndYear,+ shiftIsoDate, windowEndYear, CACHE_TTL, COLORS, COUNTRY_RE, FETCH_TIMEOUT_MS, MAX_HOLIDAY_BYTES, YEAR_RE,} from './vacay.helpers';// ---------------------------------------------------------------------------@@ -125,26 +125,6 @@ export interface VacayShare {created_at?: string;}-const CACHE_TTL = 24 * 60 * 60 * 1000;-const FETCH_TIMEOUT_MS = 10_000;-// A country's holidays for one year are a few kilobytes; two megabytes means the-// provider is misbehaving and we would rather report the usual error than buffer it.-const MAX_HOLIDAY_BYTES = 2 * 1024 * 1024;-// Both providers key on a 4-digit year and an ISO 3166-1 alpha-2 code. Anything-// else has no business reaching the URL path.-const YEAR_RE = /^\d{4}$/;-const COUNTRY_RE = /^[A-Za-z]{2}$/;--// ----------------------------------------------------------------------------// Color palette for auto-assign-// -----------------------------------------------------------------------------const COLORS = [- '#6366f1', '#ec4899', '#14b8a6', '#8b5cf6', '#ef4444',- '#3b82f6', '#22c55e', '#06b6d4', '#f43f5e', '#a855f7',- '#10b981', '#0ea5e9', '#64748b', '#be185d', '#0d9488',-];-/*** Vacay domain service — owns the vacay SQL, now through the ten vacay* repositories (+ `SchoolHolidayRegionsRepository`'s cross-domain read,@@ -1166,13 +1146,7 @@ export class VacayService {return { action: 'added', fraction: frac, kind: knd };}- /**- * A day written for a year the plan has not opened yet adds that year, with- * each member's allowance, the way opening it by hand does. Without it a day- * set months ahead (by the assistant, MCP, a plugin or an old client) was- * stored but never shown, since the calendar only offers the plan's years.- * The year is the writer's leave period that holds the date (#737).- */+ /** A day written for a year the plan has not opened adds that year, or the calendar never shows it (#737 picks the period). */private async ensureYearOf(planId: number, userId: number, date: string): Promise<void> {const [y, m, d] = date.split('-').map(Number);const year = await this.currentPeriodYear(userId, new Date(y, m - 1, d));