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
feat(journey): prepare the recorded days of a journey's trips in the background, switched on per journey, with each day's state
Maurice94c369b913ce
diff --git a/client/src/api/journeyRecordings.test.ts b/client/src/api/journeyRecordings.test.tsindex 85d0056e3..8bd92172e 100644--- a/client/src/api/journeyRecordings.test.ts+++ b/client/src/api/journeyRecordings.test.ts@@ -69,4 +69,17 @@ describe('journeyRecordingsApi', () => {{ method: 'POST', path: `${BASE}/2026-05-14/stays/import`, body },]);});++ it('FE-API-JOURNEY-RECORDINGS-003: reads how the journey prepares its days (JRN-03)', async () => {+ const answer = {+ enabled: false,+ connection: 'not_connected',+ lastAttemptAt: null,+ lastSuccessAt: null,+ lastError: null,+ };+ server.use(http.get(`${BASE}/prep`, record(answer)));+ expect(await journeyRecordingsApi.prep(7)).toEqual(answer);+ expect(calls).toEqual([{ method: 'GET', path: `${BASE}/prep`, body: null }]);+ });});diff --git a/client/src/api/journeyRecordings.ts b/client/src/api/journeyRecordings.tsindex 3692b76fb..5518d38bb 100644--- a/client/src/api/journeyRecordings.ts+++ b/client/src/api/journeyRecordings.ts@@ -3,6 +3,7 @@ import type {JourneyDayImportResult,JourneyDayStays,JourneyRecordedDaysResponse,+ JourneyRecordingPrep,JourneyRecordingPreview,JourneyRecordingPreviewRequest,JourneyRecordingSaveRequest,@@ -19,10 +20,13 @@ const upstream = { timeout: DAWARICH_UPSTREAM_TIMEOUT_MS };/*** JRN-01: the recorded days a journey keeps, previewing one, keeping it and dropping it.* JRN-02: the stays of a day reviewed and taken over as drafts.+ * JRN-03: how the journey prepares its days for the caller.*/export const journeyRecordingsApi = {list: (journeyId: number, signal?: AbortSignal): Promise<JourneyRecordedDaysResponse> =>apiClient.get(base(journeyId), { signal }).then((r) => r.data),+ prep: (journeyId: number, signal?: AbortSignal): Promise<JourneyRecordingPrep> =>+ apiClient.get(`${base(journeyId)}/prep`, { signal }).then((r) => r.data),preview: (journeyId: number,body: JourneyRecordingPreviewRequest,diff --git a/client/src/components/Journey/JourneyDayImportButton.test.tsx b/client/src/components/Journey/JourneyDayImportButton.test.tsxindex ad80311bd..f1120062c 100644--- a/client/src/components/Journey/JourneyDayImportButton.test.tsx+++ b/client/src/components/Journey/JourneyDayImportButton.test.tsx@@ -1,6 +1,7 @@-// FE-JRN-DAY-IMPORT-BTN-001 to FE-JRN-DAY-IMPORT-BTN-003+// FE-JRN-DAY-IMPORT-BTN-001 to FE-JRN-DAY-IMPORT-BTN-005//// JRN-02: the day header's way into taking a day over with its stays.+// JRN-03: the mark of a prepared day that is not final yet.import userEvent from '@testing-library/user-event';import { describe, expect, it, vi } from 'vitest';import { render, screen } from '../../../tests/helpers/render';@@ -42,4 +43,26 @@ describe('JourneyDayImportButton', () => {renderButton({ canTakeOver: false, needsConnection: false });expect(screen.queryByTestId('journey-day-import')).not.toBeInTheDocument();});++ it('FE-JRN-DAY-IMPORT-BTN-004: a prepared day still running carries a dot and says so after the count', () => {+ renderButton({ pending: 6, prep: { state: 'running', failed: false, lastSuccessAt: null } });+ expect(screen.getByTestId('journey-day-prep-unsettled')).toBeInTheDocument();+ expect(screen.getByTestId('journey-day-import')).toHaveAccessibleName(+ /^6 stays to review\s+The day is still running, more stays may follow\.$/+ );+ });++ it('FE-JRN-DAY-IMPORT-BTN-005: a day fetched whole carries no dot, one whose refresh failed does', () => {+ const { unmount } = renderButton({+ prep: { state: 'complete', failed: false, lastSuccessAt: '2026-05-15T08:00:00Z' },+ });+ expect(screen.queryByTestId('journey-day-prep-unsettled')).not.toBeInTheDocument();+ unmount();++ renderButton({ prep: { state: 'complete', failed: true, lastSuccessAt: '2026-05-15T08:00:00Z' } });+ expect(screen.getByTestId('journey-day-prep-unsettled')).toBeInTheDocument();+ expect(screen.getByTestId('journey-day-import')).toHaveAccessibleName(+ /The last refresh failed, this is the older state\./+ );+ });});diff --git a/client/src/components/Journey/JourneyDayImportButton.tsx b/client/src/components/Journey/JourneyDayImportButton.tsxindex ea1fd3d63..a799228a4 100644--- a/client/src/components/Journey/JourneyDayImportButton.tsx+++ b/client/src/components/Journey/JourneyDayImportButton.tsx@@ -3,31 +3,41 @@ import type React from 'react';import { useTranslation } from '../../i18n';import { fs } from '../shared/DialogShell';import { Tooltip } from '../shared/Tooltip';+import { dayPrepText, dayPrepUnsettled, type JourneyDayPrep } from './journeyRecordingPrepModel';/*** Taking a day over with its stays (JRN-02), in the day header beside the* route: for an editor whose Dawarich answers, with the number of stays still- * waiting on the day; offline it stays, dimmed, and says why.+ * waiting on the day; offline it stays, dimmed, and says why. While the+ * journey prepares its days (JRN-03), a dot marks a day that is not final yet+ * (still running, fetched before it ended, not fetched, or stale after a+ * failed refresh) and the tooltip says which.*/export default function JourneyDayImportButton({pending,canTakeOver,needsConnection,+ prep,onOpen,}: {/** Stays of the day nobody decided on yet. */pending: number;canTakeOver: boolean;needsConnection: boolean;+ /** Where preparing the day stands; absent while the journey does not prepare it. */+ prep?: JourneyDayPrep | null;onOpen: () => void;}): React.ReactElement | null {- const { t } = useTranslation();+ const { t, locale } = useTranslation();if (!canTakeOver && !needsConnection) return null;- const label = !canTakeOver+ const base = !canTakeOver? t('dawarich.error.offline'): pending > 0? t('journey.dayImport.pending', { count: pending }): t('journey.dayImport.openHint');+ const unsettled = canTakeOver && dayPrepUnsettled(prep);+ // The tooltip breaks before the second line; a screen reader reads both as one.+ const label = unsettled && prep ? `${base}\n${dayPrepText(prep, t, locale)}` : base;return (<Tooltip label={label} placement="top"><button@@ -45,6 +55,13 @@ export default function JourneyDayImportButton({{pending}</span>)}+ {unsettled && (+ <span+ data-testid="journey-day-prep-unsettled"+ className="h-1.5 w-1.5 rounded-full bg-warning"+ aria-hidden="true"+ />+ )}</button></Tooltip>);diff --git a/client/src/components/Journey/JourneyDayImportReview.tsx b/client/src/components/Journey/JourneyDayImportReview.tsxindex a6bd25913..265602ee2 100644--- a/client/src/components/Journey/JourneyDayImportReview.tsx+++ b/client/src/components/Journey/JourneyDayImportReview.tsx@@ -40,6 +40,7 @@ function DayNotices({ state }: { state: JourneyDayImportState }) {</Notice>)}{review?.truncated && <Notice tone="warning">{t('journey.dayImport.truncated')}</Notice>}+ {state.running && <Notice tone="info">{t('journey.dayImport.running')}</Notice>}</>);}diff --git a/client/src/components/Journey/JourneyDetailPageSettingsDialog.test.tsx b/client/src/components/Journey/JourneyDetailPageSettingsDialog.test.tsxindex 3adb569c9..e80269baa 100644--- a/client/src/components/Journey/JourneyDetailPageSettingsDialog.test.tsx+++ b/client/src/components/Journey/JourneyDetailPageSettingsDialog.test.tsx@@ -1,4 +1,4 @@-// FE-JRN-SETTINGS-001 to FE-JRN-SETTINGS-027+// FE-JRN-SETTINGS-001 to FE-JRN-SETTINGS-029import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'import { http, HttpResponse } from 'msw'@@ -7,6 +7,7 @@ import { render, screen, waitFor, within, fireEvent, act } from '../../../tests/import { server } from '../../../tests/helpers/msw/server'import { useJourneyStore, type JourneyDetail } from '../../store/journeyStore'import { JourneySettingsDialog } from './JourneyDetailPageSettingsDialog'+import type { JourneyRecordingPrepState } from './useJourneyRecordingPrep'type ToastKind = 'success' | 'error' | 'warning' | 'info'@@ -43,7 +44,7 @@ function buildJourney(overrides: Partial<JourneyDetail> = {}): JourneyDetail {}}-function mountDialog(journey: JourneyDetail = buildJourney()) {+function mountDialog(journey: JourneyDetail = buildJourney(), recordingPrep?: JourneyRecordingPrepState) {const onClose = vi.fn()const onSaved = vi.fn()const onOpenInvite = vi.fn()@@ -55,6 +56,7 @@ function mountDialog(journey: JourneyDetail = buildJourney()) {onSaved={onSaved}onOpenInvite={onOpenInvite}onRefresh={onRefresh}+ recordingPrep={recordingPrep}/>,)return { ...utils, onClose, onSaved, onOpenInvite, onRefresh }@@ -475,4 +477,40 @@ describe('JourneySettingsDialog', () => {await userEvent.click(screen.getByRole('button', { name: /Bring back dismissed suggestions/ }))expect(onRestoreSuggestions).toHaveBeenCalledTimes(1)})++ function prepState(over: Partial<JourneyRecordingPrepState> = {}): JourneyRecordingPrepState {+ return {+ prep: { enabled: true, connection: 'ready', lastAttemptAt: null, lastSuccessAt: null, lastError: 'unreachable' },+ saving: false,+ fetching: false,+ statusLine: { text: 'The first fetch failed: TREK could not reach that address.', tone: 'warning' },+ canFetch: true,+ setEnabled: vi.fn(async () => {}),+ fetchNow: vi.fn(async () => {}),+ dayPrep: () => null,+ ...over,+ }+ }++ it('FE-JRN-SETTINGS-028: the owner switches the preparation of recorded days and fetches by hand after a failure (JRN-03)', async () => {+ const prep = prepState()+ mountDialog(buildJourney({ auto_prepare_recordings: 1 }), prep)++ expect(screen.getByTestId('journey-prep-status')).toHaveTextContent('The first fetch failed: TREK could not reach that address.')+ await userEvent.click(screen.getByRole('button', { name: /Fetch now/ }))+ expect(prep.fetchNow).toHaveBeenCalledTimes(1)++ await userEvent.click(screen.getByRole('button', { name: 'Prepare recorded days automatically' }))+ expect(prep.setEnabled).toHaveBeenCalledWith(false)+ })++ it('FE-JRN-SETTINGS-029: without the Dawarich addon there is no switch, and no fetch where nothing can be reached', () => {+ const { unmount } = mountDialog()+ expect(screen.queryByText('Prepare recorded days automatically')).not.toBeInTheDocument()+ unmount()++ mountDialog(buildJourney(), prepState({ canFetch: false, statusLine: { text: 'Link a trip with dates: only its days are prepared.', tone: 'warning' } }))+ expect(screen.getByText('Prepare recorded days automatically')).toBeInTheDocument()+ expect(screen.queryByRole('button', { name: /Fetch now/ })).not.toBeInTheDocument()+ })})diff --git a/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsx b/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsxindex 9036172b7..4a77dc578 100644--- a/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsx+++ b/client/src/components/Journey/JourneyDetailPageSettingsDialog.tsx@@ -7,6 +7,8 @@ import { DeleteButton, DialogButton, DialogFooter, DialogHeader, DialogSection,import { AddRowButton, EditorField, INPUT, Segmented } from '../shared/dialogParts'import JourneyShareSection from './JourneyShareSection'import { useJourneySettings } from './useJourneySettings'+import type { JourneyRecordingPrepState } from './useJourneyRecordingPrep'+import { JourneyRecordingPrepRow, JourneyRecordingPrepStatus } from './JourneyRecordingPrepSetting'import type { JourneyContributor, JourneyDetail, JourneyTripAccess } from '../../store/journeyStore'import { pickGradient } from '../../pages/journeyDetail/JourneyDetailPage.helpers'import { AddTripDialog } from './JourneyDetailPageAddTripDialog'@@ -31,7 +33,7 @@ function RowAction({ label, onClick, children }: { label: string; onClick: () =>)}-export function JourneySettingsDialog({ journey, onClose, onSaved, onOpenInvite, onRefresh, onRestoreSuggestions }: {+export function JourneySettingsDialog({ journey, onClose, onSaved, onOpenInvite, onRefresh, onRestoreSuggestions, recordingPrep }: {journey: JourneyDetailonClose: () => voidonSaved: () => void@@ -39,6 +41,8 @@ export function JourneySettingsDialog({ journey, onClose, onSaved, onOpenInvite,onRefresh: () => void/** Bring back every suggestion waved away card by card. Absent for a viewer. */onRestoreSuggestions?: () => Promise<void> | void+ /** Preparing the recorded days (JRN-03); absent without the Dawarich addon. */+ recordingPrep?: JourneyRecordingPrepState}) {const { t } = useTranslation()const labelId = useId()@@ -170,7 +174,9 @@ export function JourneySettingsDialog({ journey, onClose, onSaved, onOpenInvite,label={t('journey.settings.showTripTracks')}/></div>+ {recordingPrep && <JourneyRecordingPrepRow on={!!journey.auto_prepare_recordings} prep={recordingPrep} rowClass={ROW} />}</div>+ {recordingPrep && <JourneyRecordingPrepStatus prep={recordingPrep} />}</DialogSection>{/* Places from photos (#1003): the GPS a picture carries puts its entry on the map */}diff --git a/client/src/components/Journey/JourneyRecordingPrepSetting.tsx b/client/src/components/Journey/JourneyRecordingPrepSetting.tsxnew file mode 100644index 000000000..3a0137ddb--- /dev/null+++ b/client/src/components/Journey/JourneyRecordingPrepSetting.tsx@@ -0,0 +1,77 @@+import { RefreshCw } from 'lucide-react';+import type React from 'react';+import { useTranslation } from '../../i18n';+import ToggleSwitch from '../Settings/ToggleSwitch';+import { fs } from '../shared/DialogShell';+import type { JourneyRecordingPrepState } from './useJourneyRecordingPrep';++/**+ * The owner's switch for preparing the recorded days (JRN-03) in the desktop+ * journey settings, a row among the map switches. `rowClass` is the row look+ * of the list it sits in.+ */+export function JourneyRecordingPrepRow({+ on,+ prep,+ rowClass,+}: {+ on: boolean;+ prep: JourneyRecordingPrepState;+ rowClass: string;+}): React.ReactElement {+ const { t } = useTranslation();+ return (+ <div className={prep.saving ? `${rowClass} opacity-60` : rowClass}>+ <span className="min-w-0 flex-1">+ <span className="block text-content" style={fs(13, 'body')}>+ {t('journey.settings.autoPrepare')}+ </span>+ <span className="block text-content-faint" style={fs(11.5)}>+ {t('journey.settings.autoPrepareHint')}+ </span>+ </span>+ <ToggleSwitch+ on={on}+ onToggle={() => {+ if (!prep.saving) void prep.setEnabled(!on);+ }}+ label={t('journey.settings.autoPrepare')}+ />+ </div>+ );+}++/**+ * Under the switches: how the caller's own preparation stands, in warning+ * colour when something keeps it from working, with a fetch by hand where one+ * would reach anything. Nothing while the switch is off.+ */+export function JourneyRecordingPrepStatus({ prep }: { prep: JourneyRecordingPrepState }): React.ReactElement | null {+ const { t } = useTranslation();+ const line = prep.statusLine;+ if (!line) return null;+ return (+ <div className="mt-2 flex items-start gap-2" data-testid="journey-prep-status">+ <p+ className={`m-0 flex-1 leading-normal ${line.tone === 'warning' ? 'text-warning' : 'text-content-faint'}`}+ style={fs(11.5)}+ >+ {line.text}+ </p>+ {prep.canFetch && (+ <button+ type="button"+ onClick={() => {+ void prep.fetchNow();+ }}+ disabled={prep.fetching}+ className="inline-flex flex-none items-center gap-1 rounded-full bg-surface-card px-2.5 py-1 font-semibold text-content-secondary ring-1 ring-edge-faint hover:bg-surface-hover disabled:cursor-default disabled:opacity-50"+ style={fs(11.5)}+ >+ <RefreshCw size={12} className={prep.fetching ? 'animate-spin' : undefined} aria-hidden="true" />+ {prep.fetching ? t('journey.prep.fetching') : t('journey.prep.fetchNow')}+ </button>+ )}+ </div>+ );+}diff --git a/client/src/components/Journey/journeyRecordingPrepModel.test.ts b/client/src/components/Journey/journeyRecordingPrepModel.test.tsnew file mode 100644index 000000000..4e7bd4ed3--- /dev/null+++ b/client/src/components/Journey/journeyRecordingPrepModel.test.ts@@ -0,0 +1,110 @@+// FE-JRN-PREP-MODEL-001 to FE-JRN-PREP-MODEL-006+//+// JRN-03: where preparing a journey day stands, and the line under the switch.+import type { JourneyRecordingPrep } from '@trek/shared';+import { describe, expect, it } from 'vitest';+import { dayPrepOf, dayPrepText, dayPrepUnsettled, prepStatusLine } from './journeyRecordingPrepModel';++/** Keys come back as they are, with their params; a Dawarich reason reads as its code, as reasonText needs a hit. */+const t = (key: string, params?: Record<string, string | number>) => {+ if (key.startsWith('dawarich.error.')) return key.slice('dawarich.error.'.length).toUpperCase();+ return params ? `${key} ${JSON.stringify(params)}` : key;+};++const NOW = new Date(2026, 4, 16, 12, 0);+const PERIOD = new Set(['2026-05-14', '2026-05-15', '2026-05-16', '2026-05-17']);++function prep(over: Partial<JourneyRecordingPrep> = {}): JourneyRecordingPrep {+ return {+ enabled: true,+ connection: 'ready',+ lastAttemptAt: new Date(2026, 4, 16, 10, 0).toISOString(),+ lastSuccessAt: new Date(2026, 4, 16, 10, 0).toISOString(),+ lastError: null,+ ...over,+ };+}++describe('dayPrepOf', () => {+ it('FE-JRN-PREP-MODEL-001: today runs, a day that ended before the last fetch is complete, one fetched too early is provisional', () => {+ expect(dayPrepOf('2026-05-16', prep(), PERIOD, NOW)?.state).toBe('running');+ expect(dayPrepOf('2026-05-14', prep(), PERIOD, NOW)?.state).toBe('complete');+ const early = prep({ lastSuccessAt: new Date(2026, 4, 15, 18, 0).toISOString() });+ expect(dayPrepOf('2026-05-15', early, PERIOD, NOW)).toEqual({+ state: 'provisional',+ failed: false,+ lastSuccessAt: early.lastSuccessAt,+ });+ });++ it('FE-JRN-PREP-MODEL-002: nothing fetched yet is pending, and a failed run marks the day as stale', () => {+ expect(dayPrepOf('2026-05-14', prep({ lastSuccessAt: null }), PERIOD, NOW)?.state).toBe('pending');+ expect(dayPrepOf('2026-05-14', prep({ lastError: 'unreachable' }), PERIOD, NOW)).toMatchObject({+ state: 'complete',+ failed: true,+ });+ });++ it('FE-JRN-PREP-MODEL-003: no mark while off, without a connection, outside the trips or for a day still ahead', () => {+ expect(dayPrepOf('2026-05-14', prep({ enabled: false }), PERIOD, NOW)).toBeNull();+ expect(dayPrepOf('2026-05-14', prep({ connection: 'not_connected' }), PERIOD, NOW)).toBeNull();+ expect(dayPrepOf('2026-05-20', prep(), PERIOD, NOW)).toBeNull();+ expect(dayPrepOf('2026-05-17', prep(), PERIOD, NOW)).toBeNull();+ expect(dayPrepOf('2026-05-14', null, PERIOD, NOW)).toBeNull();+ });+});++describe('dayPrepText and dayPrepUnsettled', () => {+ it('FE-JRN-PREP-MODEL-004: says why a day is not final, and only such a day is unsettled', () => {+ const now = NOW.getTime();+ expect(dayPrepText({ state: 'running', failed: true, lastSuccessAt: null }, t, 'en', now)).toBe(+ 'journey.prep.dayRunning journey.prep.dayFailed'+ );+ expect(dayPrepText({ state: 'pending', failed: false, lastSuccessAt: null }, t, 'en', now)).toBe(+ 'journey.prep.dayPending'+ );+ const provisional = {+ state: 'provisional' as const,+ failed: false,+ lastSuccessAt: new Date(now - 7_200_000).toISOString(),+ };+ expect(dayPrepText(provisional, t, 'en', now)).toBe('journey.prep.dayProvisional {"time":"2 hours ago"}');++ expect(dayPrepUnsettled(provisional)).toBe(true);+ expect(dayPrepUnsettled({ state: 'complete', failed: false, lastSuccessAt: null })).toBe(false);+ expect(dayPrepUnsettled({ state: 'complete', failed: true, lastSuccessAt: null })).toBe(true);+ expect(dayPrepUnsettled(null)).toBe(false);+ });+});++describe('prepStatusLine', () => {+ const now = NOW.getTime();++ it('FE-JRN-PREP-MODEL-005: says when the last fetch came through, or that none did yet', () => {+ expect(prepStatusLine(prep(), true, t, 'en', now)).toEqual({+ text: 'journey.prep.lastSuccess {"time":"2 hours ago"}',+ tone: 'muted',+ });+ expect(prepStatusLine(prep({ lastSuccessAt: null, lastAttemptAt: null }), true, t, 'en', now)).toEqual({+ text: 'journey.prep.never',+ tone: 'muted',+ });+ expect(prepStatusLine(prep({ enabled: false }), true, t, 'en', now)).toBeNull();+ });++ it('FE-JRN-PREP-MODEL-006: warns about what keeps it from working, a failure first and beside the state still shown', () => {+ expect(prepStatusLine(prep({ connection: 'not_connected' }), true, t, 'en', now)?.text).toBe(+ 'journey.prep.notConnected'+ );+ expect(prepStatusLine(prep(), false, t, 'en', now)?.text).toBe('journey.prep.noPeriods');+ expect(prepStatusLine(prep({ connection: 'sync_off' }), true, t, 'en', now)?.text).toBe('journey.prep.syncOff');+ expect(prepStatusLine(prep({ lastError: 'unreachable' }), true, t, 'en', now)).toEqual({+ text: 'journey.prep.failed {"reason":"UNREACHABLE","time":"2 hours ago"}',+ tone: 'warning',+ });+ expect(prepStatusLine(prep({ lastError: 'unauthorized', lastSuccessAt: null }), true, t, 'en', now)).toEqual({+ text: 'journey.prep.failedNever {"reason":"UNAUTHORIZED"}',+ tone: 'warning',+ });+ });+});diff --git a/client/src/components/Journey/journeyRecordingPrepModel.ts b/client/src/components/Journey/journeyRecordingPrepModel.tsnew file mode 100644index 000000000..b6b03a8dc--- /dev/null+++ b/client/src/components/Journey/journeyRecordingPrepModel.ts@@ -0,0 +1,92 @@+import type { JourneyRecordingPrep } from '@trek/shared';+import { localIsoDate } from '../../utils/localDate';+import { relativeTime } from '../../utils/relativeTime';+import { reasonText } from './journeyRecordingModel';++type Translate = (key: string, params?: Record<string, string | number>) => string;++/**+ * Where preparing one journey day stands (JRN-03), for its badge.+ * `running`: the day is today. `provisional`: the last fetch that came through+ * was before the day ended, so stays may be missing. `pending`: no fetch came+ * through yet. `complete`: fetched after the day was over.+ */+export interface JourneyDayPrep {+ state: 'running' | 'provisional' | 'pending' | 'complete';+ /** The last run failed; what the day shows is as new as `lastSuccessAt`. */+ failed: boolean;+ lastSuccessAt: string | null;+}++/**+ * A day of a linked trip period while the journey prepares its days for a+ * connected caller; null for every other day, including those still ahead.+ */+export function dayPrepOf(+ date: string,+ prep: JourneyRecordingPrep | null,+ periodDates: ReadonlySet<string>,+ now: Date = new Date()+): JourneyDayPrep | null {+ if (!prep?.enabled || prep.connection === 'not_connected' || !periodDates.has(date)) return null;+ const today = localIsoDate(now);+ if (date > today) return null;+ const base = { failed: prep.lastError !== null, lastSuccessAt: prep.lastSuccessAt };+ if (date === today) return { state: 'running', ...base };+ if (!prep.lastSuccessAt) return { state: 'pending', ...base };+ const dayEnd = new Date(`${date}T00:00:00`);+ dayEnd.setDate(dayEnd.getDate() + 1);+ return { state: Date.parse(prep.lastSuccessAt) < dayEnd.getTime() ? 'provisional' : 'complete', ...base };+}++/** Whether a day's badge marks it as not final: still running, fetched too early, not fetched, or stale after a failure. */+export function dayPrepUnsettled(day: JourneyDayPrep | null | undefined): boolean {+ return !!day && (day.state !== 'complete' || day.failed);+}++/** What a day's badge adds to its tooltip; empty for a day fetched whole by a run that came through. */+export function dayPrepText(day: JourneyDayPrep, t: Translate, locale: string, now: number = Date.now()): string {+ const parts: string[] = [];+ if (day.state === 'running') parts.push(t('journey.prep.dayRunning'));+ if (day.state === 'pending') parts.push(t('journey.prep.dayPending'));+ if (day.state === 'provisional' && day.lastSuccessAt) {+ parts.push(t('journey.prep.dayProvisional', { time: relativeTime(Date.parse(day.lastSuccessAt), locale, now) }));+ }+ if (day.failed) parts.push(t('journey.prep.dayFailed'));+ return parts.join(' ');+}++/** The line under the switch in the journey settings, and whether it asks for attention. */+export interface PrepStatusLine {+ text: string;+ tone: 'muted' | 'warning';+}++/**+ * What the caller's own preparation of a journey looks like right now, for+ * the settings: why nothing happens (no connection, no dated trip, background+ * sync off), the last failure next to the state still shown, or when it last+ * came through. Null while the switch is off.+ */+export function prepStatusLine(+ prep: JourneyRecordingPrep,+ hasPeriods: boolean,+ t: Translate,+ locale: string,+ now: number = Date.now()+): PrepStatusLine | null {+ if (!prep.enabled) return null;+ if (prep.connection === 'not_connected') return { text: t('journey.prep.notConnected'), tone: 'warning' };+ if (!hasPeriods) return { text: t('journey.prep.noPeriods'), tone: 'warning' };+ const success = prep.lastSuccessAt ? relativeTime(Date.parse(prep.lastSuccessAt), locale, now) : null;+ if (prep.lastError) {+ const reason = reasonText(prep.lastError, t);+ return {+ text: success ? t('journey.prep.failed', { reason, time: success }) : t('journey.prep.failedNever', { reason }),+ tone: 'warning',+ };+ }+ if (prep.connection === 'sync_off') return { text: t('journey.prep.syncOff'), tone: 'warning' };+ if (!success) return { text: t('journey.prep.never'), tone: 'muted' };+ return { text: t('journey.prep.lastSuccess', { time: success }), tone: 'muted' };+}diff --git a/client/src/components/Journey/useJourneyDayImport.test.ts b/client/src/components/Journey/useJourneyDayImport.test.tsindex 1dbd6b5a4..c9d259ff4 100644--- a/client/src/components/Journey/useJourneyDayImport.test.ts+++ b/client/src/components/Journey/useJourneyDayImport.test.ts@@ -1,4 +1,4 @@-// FE-JRN-DAYIMPORT-001 to FE-JRN-DAYIMPORT-007+// FE-JRN-DAYIMPORT-001 to FE-JRN-DAYIMPORT-008//// JRN-02: taking a recorded day with its stays into the journal, for the// desktop dialog and the phone sheet alike. Nothing is written before the@@ -9,6 +9,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';import { buildDayStays, buildRecordedDay, buildRecordingPreview } from '../../../tests/helpers/journeyRecording';import { act, renderHook, waitFor } from '../../../tests/helpers/render';import { TranslationProvider } from '../../i18n/TranslationContext';+import { localIsoDate } from '../../utils/localDate';import { useJourneyDayImport } from './useJourneyDayImport';const repo = vi.hoisted(() => ({@@ -26,7 +27,7 @@ vi.mock('../shared/Toast', () => ({ useToast: () => toast }));const HASH = 'a'.repeat(64);const httpError = (code: string) => Object.assign(new Error(code), { response: { data: { error: code, code } } });-function setup(over: { storedRoute?: ReturnType<typeof buildRecordedDay> } = {}) {+function setup(over: { storedRoute?: ReturnType<typeof buildRecordedDay>; date?: string } = {}) {const onTakenOver = vi.fn();const onKept = vi.fn();const onClose = vi.fn();@@ -34,7 +35,7 @@ function setup(over: { storedRoute?: ReturnType<typeof buildRecordedDay> } = {})() =>useJourneyDayImport({journeyId: 7,- date: '2026-05-14',+ date: over.date ?? '2026-05-14',dayColor: '#ff0055',storedRoute: over.storedRoute,onTakenOver,@@ -169,4 +170,15 @@ describe('useJourneyDayImport', () => {act(() => result.current.retry());await waitFor(() => expect(result.current.error).not.toBeNull());});++ it('FE-JRN-DAYIMPORT-008: today is marked as still running, a past day is not (JRN-03)', async () => {+ const past = setup();+ await waitFor(() => expect(past.result.current.loading).toBe(false));+ expect(past.result.current.running).toBe(false);+ past.unmount();++ const today = setup({ date: localIsoDate() });+ await waitFor(() => expect(today.result.current.loading).toBe(false));+ expect(today.result.current.running).toBe(true);+ });});diff --git a/client/src/components/Journey/useJourneyDayImport.ts b/client/src/components/Journey/useJourneyDayImport.tsindex 609dd92d8..cc03a1cf3 100644--- a/client/src/components/Journey/useJourneyDayImport.ts+++ b/client/src/components/Journey/useJourneyDayImport.ts@@ -9,6 +9,7 @@ import type {import { useCallback, useEffect, useMemo, useState } from 'react';import { useTranslation } from '../../i18n';import { journeyRecordingsRepo } from '../../repo/journeyRecordingsRepo';+import { localIsoDate } from '../../utils/localDate';import { useToast } from '../shared/Toast';import {anchorOf,@@ -292,6 +293,8 @@ export function useJourneyDayImport({return {review: day.review,loading: day.loading,+ /** The day is today: stays recorded later still arrive. */+ running: date === localIsoDate(),/** Translated; null while nothing failed. */error: day.failure === null ? null : recordingErrorText(day.failure, t),retry: day.reload,diff --git a/client/src/components/Journey/useJourneyRecordingPrep.test.ts b/client/src/components/Journey/useJourneyRecordingPrep.test.tsnew file mode 100644index 000000000..9b5f03db8--- /dev/null+++ b/client/src/components/Journey/useJourneyRecordingPrep.test.ts@@ -0,0 +1,129 @@+// FE-JRN-PREP-HOOK-001 to FE-JRN-PREP-HOOK-005+//+// JRN-03: a journey preparing its recorded days, as the journey page, the+// phone screen and both settings shells read it: the caller's status, the+// owner's switch that fetches at once when turned on, a fetch by hand, and+// where each day of the linked trips stands.+import type { JourneyRecordingPrep } from '@trek/shared';+import { beforeEach, describe, expect, it, vi } from 'vitest';+import { act, renderHook, waitFor } from '../../../tests/helpers/render';+import { useJourneyStore } from '../../store/journeyStore';+import { useJourneyRecordingPrep, type JourneyRecordingPrepOptions } from './useJourneyRecordingPrep';++const repo = vi.hoisted(() => ({ prep: vi.fn() }));+vi.mock('../../repo/journeyRecordingsRepo', () => ({ journeyRecordingsRepo: repo }));+const dawarich = vi.hoisted(() => ({ syncNow: vi.fn() }));+vi.mock('../../repo/dawarichRepo', () => ({ dawarichRepo: dawarich }));+const toast = vi.hoisted(() => ({ error: vi.fn(), success: vi.fn(), warning: vi.fn(), info: vi.fn() }));+vi.mock('../shared/Toast', () => ({ useToast: () => toast }));++const updateJourney = vi.fn(async (_id: number, _data: Record<string, unknown>) => {});+const PERIOD = new Set(['2026-05-14', '2026-05-15']);++function status(over: Partial<JourneyRecordingPrep> = {}): JourneyRecordingPrep {+ return {+ enabled: true,+ connection: 'ready',+ lastAttemptAt: '2026-05-16T08:00:00.000Z',+ lastSuccessAt: '2026-05-16T08:00:00.000Z',+ lastError: null,+ ...over,+ };+}++function options(over: Partial<JourneyRecordingPrepOptions> = {}): JourneyRecordingPrepOptions {+ return {+ journeyId: 7,+ enabled: true,+ active: true,+ periodDates: PERIOD,+ onSwitched: vi.fn(),+ onFetched: vi.fn(),+ ...over,+ };+}++beforeEach(() => {+ repo.prep.mockReset().mockResolvedValue(status());+ dawarich.syncNow.mockReset().mockResolvedValue({ state: 'ok', created: 0, updated: 0, missing: 0 });+ updateJourney.mockClear();+ toast.error.mockClear();+ useJourneyStore.setState({ updateJourney });+});++describe('useJourneyRecordingPrep', () => {+ it('FE-JRN-PREP-HOOK-001: reads the caller status and answers for each day of the linked trips', async () => {+ const { result } = renderHook(() => useJourneyRecordingPrep(options()));++ await waitFor(() => expect(result.current.prep).not.toBeNull());+ expect(repo.prep).toHaveBeenCalledWith(7, expect.any(AbortSignal));+ expect(result.current.statusLine?.tone).toBe('muted');+ expect(result.current.canFetch).toBe(true);+ expect(result.current.dayPrep('2026-05-14')?.state).toBe('complete');+ expect(result.current.dayPrep('2026-05-20')).toBeNull();+ });++ it('FE-JRN-PREP-HOOK-002: reads nothing for a reader or without the addon', async () => {+ const { result } = renderHook(() => useJourneyRecordingPrep(options({ active: false })));+ await act(async () => {});+ expect(repo.prep).not.toHaveBeenCalled();+ expect(result.current.prep).toBeNull();+ expect(result.current.statusLine).toBeNull();+ expect(result.current.canFetch).toBe(false);+ });++ it('FE-JRN-PREP-HOOK-003: switching on saves the journey and fetches at once; switching off only saves', async () => {+ repo.prep.mockResolvedValue(status({ enabled: false }));+ const opts = options({ enabled: false });+ const { result } = renderHook(() => useJourneyRecordingPrep(opts));+ await waitFor(() => expect(result.current.prep).not.toBeNull());++ await act(async () => {+ await result.current.setEnabled(true);+ });+ expect(updateJourney).toHaveBeenCalledWith(7, { auto_prepare_recordings: true });+ expect(opts.onSwitched).toHaveBeenCalledTimes(1);+ expect(dawarich.syncNow).toHaveBeenCalledTimes(1);+ expect(opts.onFetched).toHaveBeenCalledTimes(1);++ await act(async () => {+ await result.current.setEnabled(false);+ });+ expect(updateJourney).toHaveBeenLastCalledWith(7, { auto_prepare_recordings: false });+ expect(dawarich.syncNow).toHaveBeenCalledTimes(1);+ });++ it('FE-JRN-PREP-HOOK-004: a switch that fails to save says so and fetches nothing', async () => {+ updateJourney.mockRejectedValueOnce(new Error('down'));+ const opts = options({ enabled: false });+ const { result } = renderHook(() => useJourneyRecordingPrep(opts));+ await waitFor(() => expect(result.current.prep).not.toBeNull());++ await act(async () => {+ await result.current.setEnabled(true);+ });+ expect(toast.error).toHaveBeenCalledWith('Failed to save');+ expect(opts.onSwitched).not.toHaveBeenCalled();+ expect(dawarich.syncNow).not.toHaveBeenCalled();+ });++ it('FE-JRN-PREP-HOOK-005: a fetch by hand reads the status again, and one that cannot reach Dawarich says so', async () => {+ const opts = options();+ const { result } = renderHook(() => useJourneyRecordingPrep(opts));+ await waitFor(() => expect(repo.prep).toHaveBeenCalledTimes(1));++ await act(async () => {+ await result.current.fetchNow();+ });+ expect(opts.onFetched).toHaveBeenCalledTimes(1);+ await waitFor(() => expect(repo.prep).toHaveBeenCalledTimes(2));+ expect(result.current.fetching).toBe(false);++ dawarich.syncNow.mockRejectedValueOnce(new Error('offline'));+ await act(async () => {+ await result.current.fetchNow();+ });+ expect(toast.error).toHaveBeenCalledWith('Dawarich could not be asked right now.');+ await waitFor(() => expect(repo.prep).toHaveBeenCalledTimes(3));+ });+});diff --git a/client/src/components/Journey/useJourneyRecordingPrep.ts b/client/src/components/Journey/useJourneyRecordingPrep.tsnew file mode 100644index 000000000..751077b2d--- /dev/null+++ b/client/src/components/Journey/useJourneyRecordingPrep.ts@@ -0,0 +1,131 @@+import type { JourneyRecordingPrep } from '@trek/shared';+import { useCallback, useEffect, useMemo, useState } from 'react';+import { useTranslation } from '../../i18n';+import { dawarichRepo } from '../../repo/dawarichRepo';+import { journeyRecordingsRepo } from '../../repo/journeyRecordingsRepo';+import { useJourneyStore } from '../../store/journeyStore';+import { useToast } from '../shared/Toast';+import { dayPrepOf, prepStatusLine, type JourneyDayPrep, type PrepStatusLine } from './journeyRecordingPrepModel';++export interface JourneyRecordingPrepOptions {+ /** The journey the route names, or null while it loads. */+ journeyId: number | null;+ /** The journey's switch as last read, so a change reads the status again. */+ enabled: boolean;+ /** An editor with the Dawarich addon on: nobody else has anything of their own prepared. */+ active: boolean;+ /** The dates of the linked trips, the only days that are prepared. */+ periodDates: ReadonlySet<string>;+ /** The switch was saved: the journey is read again. */+ onSwitched: () => void;+ /** A fetch by hand came back: the stays waiting at the days are read again. */+ onFetched: () => void;+}++export interface JourneyRecordingPrepState {+ /** Null until read, and for anyone `active` leaves out. */+ prep: JourneyRecordingPrep | null;+ saving: boolean;+ /** A fetch asked for by hand is running. */+ fetching: boolean;+ /** The line under the switch in the settings; null while it is off or not read yet. */+ statusLine: PrepStatusLine | null;+ /** Whether a fetch by hand would reach anything. */+ canFetch: boolean;+ setEnabled: (next: boolean) => Promise<void>;+ fetchNow: () => Promise<void>;+ dayPrep: (date: string) => JourneyDayPrep | null;+}++/**+ * A journey preparing its recorded days (JRN-03), for the journey page, the+ * phone screen and both settings shells: the caller's own status, the owner's+ * switch, a fetch by hand and where each day stands. Switching it on fetches+ * at once, so the days fill without waiting for the next background run.+ */+export function useJourneyRecordingPrep({+ journeyId,+ enabled,+ active,+ periodDates,+ onSwitched,+ onFetched,+}: JourneyRecordingPrepOptions): JourneyRecordingPrepState {+ const { t, locale } = useTranslation();+ const toast = useToast();+ const updateJourney = useJourneyStore((s) => s.updateJourney);+ // Held with its journey, so a journey opened after another never shows the other's status.+ const [loaded, setLoaded] = useState<{ journeyId: number | null; prep: JourneyRecordingPrep | null }>(NOTHING);+ const [saving, setSaving] = useState(false);+ const [fetching, setFetching] = useState(false);+ const [readToken, setReadToken] = useState(0);+ const prep = active && loaded.journeyId === journeyId ? loaded.prep : null;++ useEffect(() => {+ if (!active || journeyId === null) return;+ const controller = new AbortController();+ void readPrep(journeyId, controller.signal).then((next) => {+ if (next && !controller.signal.aborted) setLoaded({ journeyId, prep: next });+ });+ return () => controller.abort();+ }, [journeyId, active, enabled, readToken]);++ const fetchNow = useCallback(async () => {+ setFetching(true);+ try {+ await dawarichRepo.syncNow();+ onFetched();+ } catch {+ toast.error(t('journey.prep.fetchFailed'));+ } finally {+ setFetching(false);+ setReadToken((n) => n + 1);+ }+ }, [onFetched, toast, t]);++ const setEnabled = useCallback(+ async (next: boolean) => {+ if (journeyId === null) return;+ setSaving(true);+ try {+ await updateJourney(journeyId, { auto_prepare_recordings: next });+ onSwitched();+ } catch {+ toast.error(t('journey.settings.saveFailed'));+ return;+ } finally {+ setSaving(false);+ }+ if (next && prep?.connection !== 'not_connected') await fetchNow();+ },+ [journeyId, updateJourney, onSwitched, toast, t, prep?.connection, fetchNow]+ );++ const statusLine = useMemo(+ () => (prep ? prepStatusLine(prep, periodDates.size > 0, t, locale) : null),+ [prep, periodDates, t, locale]+ );+ const dayPrep = useCallback((date: string) => dayPrepOf(date, prep, periodDates), [prep, periodDates]);++ return {+ prep,+ saving,+ fetching,+ statusLine,+ canFetch: !!prep?.enabled && prep.connection !== 'not_connected' && periodDates.size > 0,+ setEnabled,+ fetchNow,+ dayPrep,+ };+}++/** The status, or null when it could not be read: the last one read stays, a status line is no reason for a toast. */+async function readPrep(journeyId: number, signal: AbortSignal): Promise<JourneyRecordingPrep | null> {+ try {+ return await journeyRecordingsRepo.prep(journeyId, signal);+ } catch {+ return null;+ }+}++const NOTHING = { journeyId: null, prep: null };diff --git a/client/src/mobile/screens/journey/MJourneyDetail.tsx b/client/src/mobile/screens/journey/MJourneyDetail.tsxindex 2f77599bc..a1091c022 100644--- a/client/src/mobile/screens/journey/MJourneyDetail.tsx+++ b/client/src/mobile/screens/journey/MJourneyDetail.tsx@@ -25,6 +25,7 @@ import JourneyDayScrubber from '../../../components/Journey/JourneyDayScrubber'import { dayColorOf } from '../../../components/Journey/journeyCard'import { useJourneyCarouselSync } from '../../../components/Journey/useJourneyCarouselSync'import { useGalleryUpload } from '../../../components/Journey/useGalleryUpload'+import { dayPrepText, dayPrepUnsettled } from '../../../components/Journey/journeyRecordingPrepModel'import MJourneyEntrySheet from './MJourneyEntrySheet'import MJourneySettingsSheet from './MJourneySettingsSheet'import MJourneyDayImportSheet from './MJourneyDayImportSheet'@@ -50,7 +51,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyDshowInvite, setShowInvite,showSettings, setShowSettings,hideSkeletons, setHideSkeletons,- sidebarMapItems, tracks, recordings, canTakeOverRecording, dayImport, dayImportDates, dawarichByDate,+ sidebarMapItems, tracks, recordings, canTakeOverRecording, dayImport, dayImportDates, dawarichByDate, recordingPrep,dismissSuggestion, restoreSuggestions, openAtEntryId,loadJourney, updateEntry, deleteEntry, reorderEntries, uploadPhotos,addPickedProviderPhotos, addEntryProviderPhotos,@@ -67,6 +68,8 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyDconst dayImportRow = (date: string, closeMenu: () => void) => {const waiting = dawarichByDate.get(date)?.length ?? 0+ const prep = recordingPrep.dayPrep(date)+ const unsettled = dayPrepUnsettled(prep)return (<MListRowkey={date}@@ -74,9 +77,16 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyDlabel={t('journey.dayImport.openOn', {date: new Date(date + 'T00:00:00').toLocaleDateString(locale, { day: 'numeric', month: 'long' }),})}- trailing={waiting > 0 ? (- <span className="rounded-full bg-m-ic px-2 py-0.5 font-geist text-caption font-bold tabular-nums text-m-muted">- {waiting}+ trailing={waiting > 0 || unsettled ? (+ <span className="inline-flex items-center gap-1.5">+ {unsettled && prep && (+ <span className="h-1.5 w-1.5 rounded-full bg-warning" role="img" aria-label={dayPrepText(prep, t, locale)} />+ )}+ {waiting > 0 && (+ <span className="rounded-full bg-m-ic px-2 py-0.5 font-geist text-caption font-bold tabular-nums text-m-muted">+ {waiting}+ </span>+ )}</span>) : undefined}onClick={() => { closeMenu(); dayImport.open(date) }}@@ -625,6 +635,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyDonOpenInvite={() => setShowInvite(true)}onRefresh={() => loadJourney(Number(id))}onRestoreSuggestions={canEditEntries ? restoreSuggestions : undefined}+ recordingPrep={recordingPrep.prep ? recordingPrep : undefined}/>)}diff --git a/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx b/client/src/mobile/screens/journey/MJourneySettingsSheet.tsxindex 727c865c9..88293415d 100644--- a/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx+++ b/client/src/mobile/screens/journey/MJourneySettingsSheet.tsx@@ -1,5 +1,5 @@import { useRef, useState } from 'react'-import { X, Image, Plus, Trash2, UserPlus, Link as LinkIcon, List, Grid3x3, MapPin, Route, Archive, ArchiveRestore, Undo2, Link2 } from 'lucide-react'+import { X, Image, Plus, Trash2, UserPlus, Link as LinkIcon, List, Grid3x3, MapPin, Route, Archive, ArchiveRestore, Undo2, Link2, ListChecks, RefreshCw } from 'lucide-react'import MSheet from '../../components/MSheet'import MIconBtn from '../../components/MIconBtn'import MToggle from '../../components/MToggle'@@ -8,6 +8,7 @@ import { useTranslation } from '../../../i18n'import type { JourneyDetail, JourneyTripAccess } from '../../../store/journeyStore'import { useJourneySettings, useJourneyTripLinking } from '../../../components/Journey/useJourneySettings'import { useJourneyShareLink } from '../../../components/Journey/useJourneyShareLink'+import type { JourneyRecordingPrepState } from '../../../components/Journey/useJourneyRecordingPrep'import { pickGradient } from '../../../pages/journeyDetail/JourneyDetailPage.helpers'import { journeyCoverSrc } from './mobileJourneyMeta'@@ -19,6 +20,8 @@ interface MJourneySettingsSheetProps {onRefresh: () => void/** Bring back every suggestion waved away card by card. Absent for a viewer. */onRestoreSuggestions?: () => Promise<void> | void+ /** Preparing the recorded days (JRN-03); absent without the Dawarich addon. */+ recordingPrep?: JourneyRecordingPrepState}/**@@ -26,7 +29,7 @@ interface MJourneySettingsSheetProps {* with per-section toggles (timeline / gallery / map), archive and delete.*/export default function MJourneySettingsSheet({- journey, onClose, onSaved, onOpenInvite, onRefresh, onRestoreSuggestions,+ journey, onClose, onSaved, onOpenInvite, onRefresh, onRestoreSuggestions, recordingPrep,}: MJourneySettingsSheetProps) {const { t } = useTranslation()const {@@ -115,6 +118,41 @@ export default function MJourneySettingsSheet({ariaLabel={t('journey.settings.showTripTracks')}/></div>+ {recordingPrep && (+ <div className="mt-[6px] rounded-[14px] bg-[color:var(--m-ic)] px-3 py-[10px]">+ <div className="flex items-center gap-[11px]">+ <ListChecks size={16} strokeWidth={2} className="flex-none text-m-muted" />+ <div className="min-w-0 flex-1">+ <div className="text-body font-bold">{t('journey.settings.autoPrepare')}</div>+ <div className="font-geist text-caption text-m-muted">{t('journey.settings.autoPrepareHint')}</div>+ </div>+ <MToggle+ checked={!!journey.auto_prepare_recordings}+ onChange={next => { void recordingPrep.setEnabled(next) }}+ disabled={recordingPrep.saving}+ ariaLabel={t('journey.settings.autoPrepare')}+ />+ </div>+ {recordingPrep.statusLine && (+ <div className="mt-2 flex items-center gap-2 border-t border-[color:var(--m-rowbr)] pt-2">+ <div className={`min-w-0 flex-1 font-geist text-caption leading-[1.45] ${recordingPrep.statusLine.tone === 'warning' ? 'text-warning' : 'text-m-muted'}`}>+ {recordingPrep.statusLine.text}+ </div>+ {recordingPrep.canFetch && (+ <button+ type="button"+ onClick={() => { void recordingPrep.fetchNow() }}+ disabled={recordingPrep.fetching}+ aria-label={t('journey.prep.fetchNow')}+ className="grid h-8 w-8 flex-none place-items-center rounded-full bg-m-card text-m-muted disabled:opacity-50"+ >+ <RefreshCw size={14} strokeWidth={2.2} className={recordingPrep.fetching ? 'animate-spin' : undefined} />+ </button>+ )}+ </div>+ )}+ </div>+ )}{/* The three fields a journey may put away (discussion #2299) */}<div className={`${eyebrow} mb-[6px] mt-[14px]`}>{t('journey.settings.entryFields')}</div>diff --git a/client/src/pages/JourneyDetailPage.tsx b/client/src/pages/JourneyDetailPage.tsxindex 9bd170db4..abc2a0f35 100644--- a/client/src/pages/JourneyDetailPage.tsx+++ b/client/src/pages/JourneyDetailPage.tsx@@ -69,7 +69,7 @@ export function JourneyDetailPageDesktop({ journeyId, embedded = false }: JournegalleryUploadProgress, setGalleryUploadProgress,activeLocationId, handleMarkerClick, handleLocationClick,mapEntries, sidebarMapItems, tripDates, isMobile, tracks, mapPhotos, openMapPhotos,- recordings, canTakeOverRecording, recordingNeedsConnection, dayImport,+ recordings, canTakeOverRecording, recordingNeedsConnection, dayImport, recordingPrep,feedEdge, scrollFeedTo,loadJourney, updateEntry, deleteEntry, reorderEntries, uploadPhotos, deletePhoto,addPickedProviderPhotos, addEntryProviderPhotos,@@ -513,6 +513,7 @@ export function JourneyDetailPageDesktop({ journeyId, embedded = false }: Journepending={stays.length}canTakeOver={canTakeOverRecording}needsConnection={recordingNeedsConnection}+ prep={recordingPrep.dayPrep(date)}onOpen={() => dayImport.open(date)}/>{/* The only Add button used to be at the very top and always@@ -782,6 +783,7 @@ export function JourneyDetailPageDesktop({ journeyId, embedded = false }: JourneonOpenInvite={() => { setShowInvite(true) }}onRefresh={() => loadJourney(Number(id))}onRestoreSuggestions={canEditEntries ? restoreSuggestions : undefined}+ recordingPrep={recordingPrep.prep ? recordingPrep : undefined}/>)}diff --git a/client/src/pages/JourneyDetailPage.wiring.test.tsx b/client/src/pages/JourneyDetailPage.wiring.test.tsxindex e0fca1a00..458ad3839 100644--- a/client/src/pages/JourneyDetailPage.wiring.test.tsx+++ b/client/src/pages/JourneyDetailPage.wiring.test.tsx@@ -1,4 +1,4 @@-// FE-JRN-DETWIRE-001 to FE-JRN-DETWIRE-044+// FE-JRN-DETWIRE-001 to FE-JRN-DETWIRE-045import { describe, it, expect, beforeEach, vi } from 'vitest';import { render, screen, fireEvent, waitFor, within } from '../../tests/helpers/render';import { journeyApi } from '../api/client';@@ -110,6 +110,9 @@ function buildHook(over: Record<string, unknown> = {}): Record<string, unknown>recordings: { byDate: new Map(), dialog: null, open: vi.fn() },canTakeOverRecording: false, recordingNeedsConnection: false,dayImport: { open: vi.fn(), dialog: null },+ // Preparing the recorded days (JRN-03): not read here, so nothing is marked and the settings+ // get no switch; the model and the hook have suites of their own.+ recordingPrep: { prep: null, dayPrep: () => null },mapRef: { current: null }, fullMapRef: { current: null }, galleryUploadRef: { current: null },galleryProviders: [], setGalleryProviders: vi.fn(), galleryBrowseRef: { current: null },galleryUploadProgress: null, setGalleryUploadProgress: vi.fn(),@@ -631,4 +634,16 @@ describe('JourneyDetailPage wiring', () => {expect(screen.getByTestId('day-import-dialog')).toBeInTheDocument();expect(mocks.captured.dayImport).toMatchObject(dialog);});++ it('FE-JRN-DETWIRE-045: a prepared day is marked in its header, and the settings get the switch once it is read (JRN-03)', () => {+ const dayPrep = vi.fn((date: string) =>+ date === '2026-05-01' ? { state: 'provisional' as const, failed: false, lastSuccessAt: '2026-05-01T12:00:00Z' } : null,+ );+ const recordingPrep = { prep: { enabled: true }, dayPrep };+ setup({ canTakeOverRecording: true, showSettings: true, recordingPrep });++ expect(dayPrep).toHaveBeenCalledWith('2026-05-01');+ expect(screen.getAllByTestId('journey-day-prep-unsettled')).toHaveLength(1);+ expect(mocks.captured.settings.recordingPrep).toBe(recordingPrep);+ });});diff --git a/client/src/pages/journeyDetail/useJourneyDetail.ts b/client/src/pages/journeyDetail/useJourneyDetail.tsindex c1423c28d..c7754cc6c 100644--- a/client/src/pages/journeyDetail/useJourneyDetail.ts+++ b/client/src/pages/journeyDetail/useJourneyDetail.ts@@ -17,6 +17,8 @@ import { openStayDatesWithin, openStaysByDate } from '../../components/Dawarich/import type { DawarichSuggestion, DawarichSuggestionTarget } from '@trek/shared'import { useDawarichJournalTrail } from '../../hooks/useDawarichJournalTrail'+import { useJourneyRecordingPrep } from '../../components/Journey/useJourneyRecordingPrep'+import { useAddonStore } from '../../store/addonStore'import { useJourneyDetailDayImport } from './useJourneyDetailDayImport'import { useJourneyDetailRecordings } from './useJourneyDetailRecordings'import { useProviderPhotoAdds } from './useProviderPhotoAdds'@@ -533,6 +535,19 @@ export function useJourneyDetail({ journeyId, embedded = false }: JourneyDetailO// asked for should not reach across the network for it.const dawarichTrail = useDawarichJournalTrail(tripDates, showTripTracks)+ // The recorded days of the linked trips prepared in the background (JRN-03): the editor's+ // own status, the owner's switch, and where each day of the trips stands.+ const isAddonEnabled = useAddonStore(s => s.isEnabled)+ const reloadJourney = useCallback(() => { if (current) void loadJourney(current.id) }, [current, loadJourney])+ const recordingPrep = useJourneyRecordingPrep({+ journeyId: journeyLoaded && current ? current.id : null,+ enabled: !!current?.auto_prepare_recordings,+ active: canEditEntries && isAddonEnabled('dawarich'),+ periodDates: tripDates,+ onSwitched: reloadJourney,+ onFetched: dawarich.reload,+ })+const { recordings, colorOfDay, canTakeOverRecording, recordingNeedsConnection, mapTracks } = useJourneyDetailRecordings({loaded: journeyLoaded,journey: current,@@ -614,7 +629,7 @@ export function useJourneyDetail({ journeyId, embedded = false }: JourneyDetailOgalleryUploadProgress, setGalleryUploadProgress,activeLocationId, handleMarkerClick, handleLocationClick,mapEntries, sidebarMapItems, tripDates, isMobile, tracks: mapTracks, dawarichTrail,- recordings, canTakeOverRecording, recordingNeedsConnection, dayImport, dayImportDates,+ recordings, canTakeOverRecording, recordingNeedsConnection, dayImport, dayImportDates, recordingPrep,mapPhotos, openMapPhotos,feedEdge, scrollFeedTo,loadJourney, updateEntry, deleteEntry, reorderEntries, uploadPhotos, deletePhoto,diff --git a/client/src/repo/dawarichRepo.test.ts b/client/src/repo/dawarichRepo.test.tsindex 3f82370fa..ff0d66633 100644--- a/client/src/repo/dawarichRepo.test.ts+++ b/client/src/repo/dawarichRepo.test.ts@@ -291,4 +291,20 @@ describe('dawarichRepo contract enforcement', () => {expect(calls).toBe(2)})++ it('FE-DAWARICH-API-029: a sync by hand is asked online and answered as the server sent it, and never offline', async () => {+ let calls = 0+ server.use(+ http.post(`${BASE}/sync`, () => {+ calls += 1+ return HttpResponse.json({ state: 'ok', created: 2, updated: 0, missing: 0 })+ }),+ )++ expect(await dawarichRepo.syncNow()).toEqual({ state: 'ok', created: 2, updated: 0, missing: 0 })++ setForcedOffline(true)+ await expect(dawarichRepo.syncNow()).rejects.toBeInstanceOf(DawarichOfflineError)+ expect(calls).toBe(1)+ })})diff --git a/client/src/repo/dawarichRepo.ts b/client/src/repo/dawarichRepo.tsindex a2da9b2c7..68b6b4c32 100644--- a/client/src/repo/dawarichRepo.ts+++ b/client/src/repo/dawarichRepo.ts@@ -60,6 +60,12 @@ export const dawarichRepo = {return dawarichBucketScanSchema.parse(await dawarichApi.scanBucketList())},+ /** Asks for a sync now instead of at the next tick; a second one while it runs is answered, not started. */+ async syncNow() {+ requireOnline()+ return await dawarichApi.syncNow()+ },+async atlasSuggestions(from: string, to: string) {requireOnline()return dawarichAtlasSuggestionsSchema.parse(await dawarichApi.atlasSuggestions(from, to))diff --git a/client/src/repo/journeyRecordingsRepo.test.ts b/client/src/repo/journeyRecordingsRepo.test.tsindex a21f96271..2244e89cc 100644--- a/client/src/repo/journeyRecordingsRepo.test.ts+++ b/client/src/repo/journeyRecordingsRepo.test.ts@@ -4,7 +4,7 @@ import { journeyRecordingsApi } from '../api/journeyRecordings';import { journeyRecordingsRepo } from './journeyRecordingsRepo';import { OnlineOnlyError } from './onlineOnly';-// FE-REPO-JOURNEY-RECORDINGS-001 to FE-REPO-JOURNEY-RECORDINGS-004+// FE-REPO-JOURNEY-RECORDINGS-001 to FE-REPO-JOURNEY-RECORDINGS-005const network = vi.hoisted(() => ({ offline: false }));vi.mock('../sync/networkMode', () => ({ isEffectivelyOffline: () => network.offline }));@@ -71,4 +71,23 @@ describe('journeyRecordingsRepo', () => {await expect(journeyRecordingsRepo.reviewDay(7, '2026-05-14')).rejects.toBeInstanceOf(OnlineOnlyError);await expect(journeyRecordingsRepo.takeOverDay(7, '2026-05-14', body)).rejects.toBeInstanceOf(OnlineOnlyError);});++ it('FE-REPO-JOURNEY-RECORDINGS-005: reads how the journey prepares its days online only, parsing the answer (JRN-03)', async () => {+ const answer = {+ enabled: true,+ connection: 'ready',+ lastAttemptAt: null,+ lastSuccessAt: null,+ lastError: null,+ } as const;+ const prep = vi.spyOn(journeyRecordingsApi, 'prep').mockResolvedValue(answer);+ expect(await journeyRecordingsRepo.prep(7)).toEqual(answer);+ expect(prep).toHaveBeenCalledWith(7, undefined);++ prep.mockResolvedValue({ ...answer, connection: 'paused' } as never);+ await expect(journeyRecordingsRepo.prep(7)).rejects.toThrow();++ network.offline = true;+ await expect(journeyRecordingsRepo.prep(7)).rejects.toBeInstanceOf(OnlineOnlyError);+ });});diff --git a/client/src/repo/journeyRecordingsRepo.ts b/client/src/repo/journeyRecordingsRepo.tsindex 0e37a600b..eaf2e4357 100644--- a/client/src/repo/journeyRecordingsRepo.ts+++ b/client/src/repo/journeyRecordingsRepo.ts@@ -2,12 +2,14 @@ import {journeyDayImportResultSchema,journeyDayStaysSchema,journeyRecordedDaysResponseSchema,+ journeyRecordingPrepSchema,journeyRecordingPreviewSchema,journeyRecordingSaveResultSchema,type JourneyDayImportRequest,type JourneyDayImportResult,type JourneyDayStays,type JourneyRecordedDay,+ type JourneyRecordingPrep,type JourneyRecordingPreview,type JourneyRecordingPreviewRequest,type JourneyRecordingSaveRequest,@@ -28,6 +30,12 @@ export const journeyRecordingsRepo = {return journeyRecordedDaysResponseSchema.parse(await journeyRecordingsApi.list(journeyId, signal)).days;},+ /** JRN-03: whether the journey prepares its days and how the caller's last runs over it went. */+ async prep(journeyId: number, signal?: AbortSignal): Promise<JourneyRecordingPrep> {+ requireOnline();+ return journeyRecordingPrepSchema.parse(await journeyRecordingsApi.prep(journeyId, signal));+ },+async preview(journeyId: number,body: JourneyRecordingPreviewRequest,diff --git a/client/src/store/journeyStore.ts b/client/src/store/journeyStore.tsindex 9b44f78a4..006275890 100644--- a/client/src/store/journeyStore.ts+++ b/client/src/store/journeyStore.ts@@ -26,6 +26,8 @@ export interface Journey {show_trip_tracks?: number/** Entries without a place take the position of their first geotagged photo (#1003); 0/1, off by default. */photo_location?: number+ /** The Dawarich sync prepares the recorded days of the linked trips (JRN-03); 0/1, off by default. */+ auto_prepare_recordings?: number/*** Which of the optional entry fields this journey uses (discussion #2299).*diff --git a/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx b/client/tests/unit/mobile/journey/MJourneyDetail.test.tsxindex 45e0b067a..8b1327dbb 100644--- a/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx+++ b/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx@@ -1,4 +1,4 @@-// FE-MOB-JDET-001 to FE-MOB-JDET-044+// FE-MOB-JDET-001 to FE-MOB-JDET-045import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';import { render, screen, fireEvent, waitFor, act } from '../../../helpers/render';import MJourneyDetail from '../../../../src/mobile/screens/journey/MJourneyDetail';@@ -183,6 +183,8 @@ function buildHook(over: Record<string, unknown> = {}): Record<string, unknown>dayImport: { open: vi.fn(), dialog: null },dayImportDates: [],dawarichByDate: new Map(),+ // Preparing the recorded days (JRN-03): not read, so no day is marked and the settings get no switch.+ recordingPrep: { prep: null, dayPrep: () => null },loadJourney: vi.fn(),updateEntry: vi.fn(async () => {}),deleteEntry: vi.fn(async () => {}),@@ -742,4 +744,21 @@ describe('MJourneyDetail', () => {expect((hook.dayImport as { open: ReturnType<typeof vi.fn> }).open).toHaveBeenCalledWith('2026-05-03');expect(screen.queryByTestId('dawarich-panel')).not.toBeInTheDocument();});++ it('FE-MOB-JDET-045: a waiting day the journey prepares carries a dot that says why it is not final (JRN-03)', () => {+ useAddonStore.setState({ addons: [{ id: 'dawarich', enabled: true }] as never, loaded: true });+ setup({+ current: buildDetail({ entries: [], stats: { entries: 0, photos: 0, places: 0 } }),+ canTakeOverRecording: true,+ dawarichByDate: new Map([['2026-05-03', [{ id: 1 }]]]),+ dayImportDates: ['2026-05-03'],+ recordingPrep: {+ prep: { enabled: true },+ dayPrep: () => ({ state: 'running', failed: false, lastSuccessAt: null }),+ },+ });++ fireEvent.click(screen.getByRole('button', { name: 'dawarich.suggestions.title' }));+ expect(screen.getByRole('img', { name: 'journey.prep.dayRunning' })).toBeInTheDocument();+ });});diff --git a/client/tests/unit/mobile/journey/MJourneySettingsSheet.test.tsx b/client/tests/unit/mobile/journey/MJourneySettingsSheet.test.tsxindex 41af7234a..91deeff7b 100644--- a/client/tests/unit/mobile/journey/MJourneySettingsSheet.test.tsx+++ b/client/tests/unit/mobile/journey/MJourneySettingsSheet.test.tsx@@ -1,10 +1,11 @@-// FE-MOB-JSET-001 to FE-MOB-JSET-034+// FE-MOB-JSET-001 to FE-MOB-JSET-036import { describe, it, expect, beforeEach, afterEach, vi, type Mock } from 'vitest';import { render, screen, fireEvent, waitFor, within } from '../../../helpers/render';import MJourneySettingsSheet from '../../../../src/mobile/screens/journey/MJourneySettingsSheet';import { journeyApi } from '../../../../src/api/client';import { useJourneyStore } from '../../../../src/store/journeyStore';import type { JourneyDetail } from '../../../../src/store/journeyStore';+import type { JourneyRecordingPrepState } from '../../../../src/components/Journey/useJourneyRecordingPrep';const mockNavigate = vi.fn();vi.mock('react-router', async () => {@@ -42,13 +43,14 @@ function buildJourney(over: Partial<JourneyDetail> = {}): JourneyDetail {};}-function setup(over: Partial<JourneyDetail> = {}) {+function setup(over: Partial<JourneyDetail> = {}, recordingPrep?: JourneyRecordingPrepState) {const props = {journey: buildJourney(over),onClose: vi.fn(),onSaved: vi.fn(),onOpenInvite: vi.fn(),onRefresh: vi.fn(),+ recordingPrep,};const view = render(<MJourneySettingsSheet {...props} />);return { ...view, props };@@ -449,4 +451,33 @@ describe('MJourneySettingsSheet', () => {expect(props.onRefresh).not.toHaveBeenCalled();expect(props.onClose).not.toHaveBeenCalled();});++ it('FE-MOB-JSET-035: the owner switches the preparation of recorded days and fetches by hand under its status (JRN-03)', async () => {+ const recordingPrep: JourneyRecordingPrepState = {+ prep: { enabled: true, connection: 'ready', lastAttemptAt: null, lastSuccessAt: null, lastError: null },+ saving: false,+ fetching: false,+ statusLine: { text: 'Not fetched yet. The next background sync starts it.', tone: 'muted' },+ canFetch: true,+ setEnabled: vi.fn(async () => {}),+ fetchNow: vi.fn(async () => {}),+ dayPrep: () => null,+ };+ setup({ auto_prepare_recordings: 1 }, recordingPrep);++ const prepSwitch = await screen.findByRole('switch', { name: 'Prepare recorded days automatically' });+ expect(prepSwitch).toHaveAttribute('aria-checked', 'true');+ expect(screen.getByText('Not fetched yet. The next background sync starts it.')).toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: 'Fetch now' }));+ expect(recordingPrep.fetchNow).toHaveBeenCalledTimes(1);+ fireEvent.click(prepSwitch);+ expect(recordingPrep.setEnabled).toHaveBeenCalledWith(false);+ });++ it('FE-MOB-JSET-036: without the Dawarich addon the sheet offers no such switch', async () => {+ setup();+ await screen.findByRole('switch', { name: /GPX/i });+ expect(screen.queryByRole('switch', { name: 'Prepare recorded days automatically' })).not.toBeInTheDocument();+ });});diff --git a/scripts/ci/knip-baseline.json b/scripts/ci/knip-baseline.jsonindex 54aafed22..d77421e48 100644--- a/scripts/ci/knip-baseline.json+++ b/scripts/ci/knip-baseline.json@@ -159,7 +159,6 @@"client/src/help/defineScreen.ts": 1,"client/src/help/types.ts": 1,"client/src/hooks/useDawarichConnection.ts": 1,- "client/src/hooks/useDawarichSuggestions.ts": 1,"client/src/i18n/supportedLanguages.ts": 1,"client/src/mobile/components/MSegmented.tsx": 1,"client/src/mobile/components/MSheet.tsx": 2,diff --git a/server/scripts/repository-owners.json b/server/scripts/repository-owners.jsonindex 8b7fe3c11..ff54734ee 100644--- a/server/scripts/repository-owners.json+++ b/server/scripts/repository-owners.json@@ -47,6 +47,7 @@"JourneyEntryStays": "journey","JourneyPhotos": "journey","JourneyRecordedDays": "journey",+ "JourneyRecordingPrep": "journey","JourneyShareTokens": "journey","JourneyTrips": "journey","Journeys": "journey",diff --git a/server/scripts/tx-writes-baseline.json b/server/scripts/tx-writes-baseline.jsonindex 21cffd0da..6ca4efb2c 100644--- a/server/scripts/tx-writes-baseline.json+++ b/server/scripts/tx-writes-baseline.json@@ -31,7 +31,7 @@"src/nest/integrations/airtrail.service.ts#AirtrailService.saveSettings": 2,"src/nest/integrations/dawarich-sync.service.ts#DawarichSyncService.runSync": 2,"src/nest/integrations/dawarich-sync.service.ts#DawarichSyncService.syncTripWindow": 3,- "src/nest/integrations/dawarich-sync.service.ts#DawarichSyncService.syncUserOnce": 4,+ "src/nest/integrations/dawarich-sync.service.ts#DawarichSyncService.syncUserOnce": 3,"src/nest/journey/journey.controller.ts#JourneyController.galleryProviderPhotos": 2,"src/nest/journey/journey.controller.ts#JourneyController.providerPhotos": 2,"src/nest/journey/journey.controller.ts#JourneyController.uploadEntryPhotos": 4,diff --git a/server/src/db/entities/JourneyRecordingPrep.entity.ts b/server/src/db/entities/JourneyRecordingPrep.entity.tsnew file mode 100644index 000000000..320b0fe4b--- /dev/null+++ b/server/src/db/entities/JourneyRecordingPrep.entity.ts@@ -0,0 +1,37 @@+import { EntityRepositoryType, type Opt, type Ref, defineEntity, p } from '@mikro-orm/core';+import { JourneyRecordingPrepRepository } from '../repositories/JourneyRecordingPrep.repository';+import { Journeys } from './Journeys.entity';+import { Users } from './Users.entity';++export class JourneyRecordingPrep {+ [EntityRepositoryType]?: JourneyRecordingPrepRepository;+ id!: number & Opt;+ journey!: Ref<Journeys>;+ journey_id!: number;+ user!: Ref<Users>;+ user_id!: number;+ last_attempt_at?: string | null;+ last_success_at?: string | null;+ last_error?: string | null;+}++export const JourneyRecordingPrepSchema = defineEntity({+ class: JourneyRecordingPrep,+ repository: () => JourneyRecordingPrepRepository,+ uniques: [+ {+ name: 'idx_journey_recording_prep_person',+ properties: ['journey_id', 'user_id'],+ },+ ],+ properties: {+ id: p.integer().primary(),+ journey: () => p.manyToOne(Journeys).ref().deleteRule('cascade').hidden(),+ journey_id: p.integer().persist(false),+ user: () => p.manyToOne(Users).ref().deleteRule('cascade').hidden().index('idx_journey_recording_prep_user'),+ user_id: p.integer().persist(false).index('idx_journey_recording_prep_user'),+ last_attempt_at: p.text().nullable(),+ last_success_at: p.text().nullable(),+ last_error: p.text().nullable(),+ },+});diff --git a/server/src/db/entities/Journeys.entity.ts b/server/src/db/entities/Journeys.entity.tsindex 8b8d4722a..c377e2b97 100644--- a/server/src/db/entities/Journeys.entity.ts+++ b/server/src/db/entities/Journeys.entity.ts@@ -6,6 +6,7 @@ import { JourneyEntries } from './JourneyEntries.entity';import { JourneyEntryStays } from './JourneyEntryStays.entity';import { JourneyPhotos } from './JourneyPhotos.entity';import { JourneyRecordedDays } from './JourneyRecordedDays.entity';+import { JourneyRecordingPrep } from './JourneyRecordingPrep.entity';import { JourneyShareTokens } from './JourneyShareTokens.entity';import { JourneyTrips } from './JourneyTrips.entity';import { TripJournalLinks } from './TripJournalLinks.entity';@@ -29,12 +30,14 @@ export class Journeys {show_weather: number & Opt = 1;status_override?: string | null;photo_location: number & Opt = 0;+ auto_prepare_recordings: number & Opt = 0;journey_books_collection = new Collection<JourneyBooks>(this);journey_contributors_collection = new Collection<JourneyContributors>(this);journey_entries_collection = new Collection<JourneyEntries>(this);journey_entry_stays_collection = new Collection<JourneyEntryStays>(this);journey_photos_collection = new Collection<JourneyPhotos>(this);journey_recorded_days_collection = new Collection<JourneyRecordedDays>(this);+ journey_recording_prep_collection = new Collection<JourneyRecordingPrep>(this);journey_share_tokens: Ref<JourneyShareTokens> | null = null;journey_trips_collection = new Collection<JourneyTrips>(this);trip_journal_links_collection = new Collection<TripJournalLinks>(this);@@ -60,12 +63,14 @@ export const JourneysSchema = defineEntity({show_weather: p.integer().default(1),status_override: p.text().nullable(),photo_location: p.integer().default(0),+ auto_prepare_recordings: p.integer().default(0),journey_books_collection: () => p.oneToMany(JourneyBooks).mappedBy('journey').hidden(),journey_contributors_collection: () => p.oneToMany(JourneyContributors).mappedBy('journey').hidden(),journey_entries_collection: () => p.oneToMany(JourneyEntries).mappedBy('journey').hidden(),journey_entry_stays_collection: () => p.oneToMany(JourneyEntryStays).mappedBy('journey').hidden(),journey_photos_collection: () => p.oneToMany(JourneyPhotos).mappedBy('journey').hidden(),journey_recorded_days_collection: () => p.oneToMany(JourneyRecordedDays).mappedBy('journey').hidden(),+ journey_recording_prep_collection: () => p.oneToMany(JourneyRecordingPrep).mappedBy('journey').hidden(),journey_share_tokens: () => p.oneToOne(JourneyShareTokens).ref().mappedBy('journey').hidden(),journey_trips_collection: () => p.oneToMany(JourneyTrips).mappedBy('journey').hidden(),trip_journal_links_collection: () => p.oneToMany(TripJournalLinks).mappedBy('journey').hidden(),diff --git a/server/src/db/entities/Users.entity.ts b/server/src/db/entities/Users.entity.tsindex b5c12a413..aed467eed 100644--- a/server/src/db/entities/Users.entity.ts+++ b/server/src/db/entities/Users.entity.ts@@ -32,6 +32,7 @@ import { JourneyContributors } from './JourneyContributors.entity';import { JourneyEntries } from './JourneyEntries.entity';import { JourneyEntryStays } from './JourneyEntryStays.entity';import { JourneyRecordedDays } from './JourneyRecordedDays.entity';+import { JourneyRecordingPrep } from './JourneyRecordingPrep.entity';import { JourneyShareTokens } from './JourneyShareTokens.entity';import { Journeys } from './Journeys.entity';import { McpTokens } from './McpTokens.entity';@@ -162,6 +163,7 @@ export class Users {journey_entries_collection = new Collection<JourneyEntries>(this);journey_entry_stays_collection = new Collection<JourneyEntryStays>(this);journey_recorded_days_collection = new Collection<JourneyRecordedDays>(this);+ journey_recording_prep_collection = new Collection<JourneyRecordingPrep>(this);journey_share_tokens_collection = new Collection<JourneyShareTokens>(this);journeys_collection = new Collection<Journeys>(this);mcp_tokens_collection = new Collection<McpTokens>(this);@@ -314,6 +316,7 @@ export const UsersSchema = defineEntity({journey_entries_collection: () => p.oneToMany(JourneyEntries).mappedBy('author').hidden(),journey_entry_stays_collection: () => p.oneToMany(JourneyEntryStays).mappedBy('user').hidden(),journey_recorded_days_collection: () => p.oneToMany(JourneyRecordedDays).mappedBy('importedByRef').hidden(),+ journey_recording_prep_collection: () => p.oneToMany(JourneyRecordingPrep).mappedBy('user').hidden(),journey_share_tokens_collection: () => p.oneToMany(JourneyShareTokens).mappedBy('createdByRef').hidden(),journeys_collection: () => p.oneToMany(Journeys).mappedBy('user').hidden(),mcp_tokens_collection: () => p.oneToMany(McpTokens).mappedBy('user').hidden(),diff --git a/server/src/db/entities/index.ts b/server/src/db/entities/index.tsindex 0b376b155..ce5300b3b 100644--- a/server/src/db/entities/index.ts+++ b/server/src/db/entities/index.ts@@ -47,6 +47,7 @@ import { JourneyEntryPhotosSchema } from './JourneyEntryPhotos.entity';import { JourneyEntryStaysSchema } from './JourneyEntryStays.entity';import { JourneyPhotosSchema } from './JourneyPhotos.entity';import { JourneyRecordedDaysSchema } from './JourneyRecordedDays.entity';+import { JourneyRecordingPrepSchema } from './JourneyRecordingPrep.entity';import { JourneyShareTokensSchema } from './JourneyShareTokens.entity';import { JourneyTripsSchema } from './JourneyTrips.entity';import { JourneysSchema } from './Journeys.entity';@@ -200,6 +201,7 @@ export const ALL_ENTITIES: readonly EntitySchema[] = [JourneyEntryStaysSchema,JourneyPhotosSchema,JourneyRecordedDaysSchema,+ JourneyRecordingPrepSchema,JourneyShareTokensSchema,JourneyTripsSchema,JourneysSchema,diff --git a/server/src/db/kysely/JourneyRecordingPrep.table.ts b/server/src/db/kysely/JourneyRecordingPrep.table.tsnew file mode 100644index 000000000..4f6af5591--- /dev/null+++ b/server/src/db/kysely/JourneyRecordingPrep.table.ts@@ -0,0 +1,12 @@+// Generated by scripts/generate-db-types.ts from the migrated schema. Do not edit by hand:+// change the migration, then run `npm run gen:db-types`.+import type { InsertOptional } from './columns';++export interface JourneyRecordingPrepTable {+ id: InsertOptional<number>;+ journey_id: number;+ user_id: number;+ last_attempt_at: InsertOptional<string | null>;+ last_success_at: InsertOptional<string | null>;+ last_error: InsertOptional<string | null>;+}diff --git a/server/src/db/kysely/Journeys.table.ts b/server/src/db/kysely/Journeys.table.tsindex d45c94341..ee11d4bb0 100644--- a/server/src/db/kysely/Journeys.table.ts+++ b/server/src/db/kysely/Journeys.table.ts@@ -18,4 +18,5 @@ export interface JourneysTable {show_weather: InsertOptional<number>;status_override: InsertOptional<string | null>;photo_location: InsertOptional<number>;+ auto_prepare_recordings: InsertOptional<number>;}diff --git a/server/src/db/kysely/db.ts b/server/src/db/kysely/db.tsindex a00f11722..e6b5a3b68 100644--- a/server/src/db/kysely/db.ts+++ b/server/src/db/kysely/db.ts@@ -50,6 +50,7 @@ import type { JourneyEntryPhotosTable } from './JourneyEntryPhotos.table';import type { JourneyEntryStaysTable } from './JourneyEntryStays.table';import type { JourneyPhotosTable } from './JourneyPhotos.table';import type { JourneyRecordedDaysTable } from './JourneyRecordedDays.table';+import type { JourneyRecordingPrepTable } from './JourneyRecordingPrep.table';import type { JourneyShareTokensTable } from './JourneyShareTokens.table';import type { JourneyTripsTable } from './JourneyTrips.table';import type { JourneysTable } from './Journeys.table';@@ -209,6 +210,7 @@ export interface DB {journey_entry_stays: JourneyEntryStaysTable;journey_photos: JourneyPhotosTable;journey_recorded_days: JourneyRecordedDaysTable;+ journey_recording_prep: JourneyRecordingPrepTable;journey_share_tokens: JourneyShareTokensTable;journey_trips: JourneyTripsTable;journeys: JourneysTable;diff --git a/server/src/db/migrations/Migration20200101046180_journeys_can_prepare_recorded_days.ts b/server/src/db/migrations/Migration20200101046180_journeys_can_prepare_recorded_days.tsnew file mode 100644index 000000000..fe1a357fa--- /dev/null+++ b/server/src/db/migrations/Migration20200101046180_journeys_can_prepare_recorded_days.ts@@ -0,0 +1,42 @@+import { addColumnIfMissing } from '../migration-utils';+import { Migration } from '@mikro-orm/migrations';++/**+ * JRN-03: a journey can have its recorded days prepared while the trip runs.+ *+ * `journeys.auto_prepare_recordings` is the owner's switch, off by default, so+ * no journey starts fetching anything because of this step. With it on, the+ * Dawarich background sync also reads the stays of the journey's linked trip+ * periods for the owner and every editor with a connection of their own.+ *+ * `journey_recording_prep` is how far that got, one row per journey and+ * person: when it was last tried, when it last went through and why the last+ * try failed, kept apart so a failure never hides the data that is still+ * there. The row goes with its journey and with its person.+ */+export class Migration20200101046180_journeys_can_prepare_recorded_days extends Migration {+ override name = 'Migration20200101046180_journeys_can_prepare_recorded_days';++ override async up(): Promise<void> {+ await addColumnIfMissing(+ this,+ 'journeys',+ 'auto_prepare_recordings',+ `auto_prepare_recordings INTEGER NOT NULL DEFAULT 0`,+ );+ this.addSql(`+ CREATE TABLE IF NOT EXISTS journey_recording_prep (+ id INTEGER PRIMARY KEY,+ journey_id INTEGER NOT NULL REFERENCES journeys(id) ON DELETE CASCADE,+ user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,+ last_attempt_at TEXT,+ last_success_at TEXT,+ last_error TEXT+ )+ `);+ this.addSql(+ 'CREATE UNIQUE INDEX IF NOT EXISTS idx_journey_recording_prep_person ON journey_recording_prep(journey_id, user_id)',+ );+ this.addSql('CREATE INDEX IF NOT EXISTS idx_journey_recording_prep_user ON journey_recording_prep(user_id)');+ }+}diff --git a/server/src/db/repositories/JourneyRecordingPrep.repository.ts b/server/src/db/repositories/JourneyRecordingPrep.repository.tsnew file mode 100644index 000000000..81e942919--- /dev/null+++ b/server/src/db/repositories/JourneyRecordingPrep.repository.ts@@ -0,0 +1,87 @@+import type { JourneyRecordingPrep } from '../entities/JourneyRecordingPrep.entity';+import type { DB } from '../kysely/db';+import { TrekRepository } from './_shared/trek-repository';++type RecordingPrepDB = Pick<+ DB,+ 'journey_recording_prep' | 'journeys' | 'journey_contributors' | 'journey_trips' | 'trips'+>;++/** A linked trip of a journey that prepares its recorded days. */+export interface PreparedJourneyTripRow {+ journey_id: number;+ trip_id: number;+ start_date: string | null;+ end_date: string | null;+}++/** How far preparing a journey's recorded days got for one person. */+export interface JourneyRecordingPrepRow {+ last_attempt_at: string | null;+ last_success_at: string | null;+ last_error: string | null;+}++/**+ * `journey_recording_prep` (JRN-03): one row per journey and person, written+ * after each background run that prepared the journey's recorded days, and+ * the read of which journeys a person prepares at all.+ */+export class JourneyRecordingPrepRepository extends TrekRepository<JourneyRecordingPrep> {+ private db() {+ return this.kysely<RecordingPrepDB>();+ }++ /**+ * The dated, not archived linked trips of every journey that prepares its+ * recorded days and that this person may still edit, as owner or editor,+ * within the reach the trip sync keeps: ended on or after `endedAfter`+ * (or still open) and started by `startedBy`. Losing the edit role or the+ * switch takes a journey out of here and so out of the next run.+ */+ async listPreparedTrips(+ userId: number,+ reach: { endedAfter: string; startedBy: string },+ ): Promise<PreparedJourneyTripRow[]> {+ return await this.db()+ .selectFrom('journeys as j')+ .innerJoin('journey_trips as jt', 'jt.journey_id', 'j.id')+ .innerJoin('trips as t', 't.id', 'jt.trip_id')+ .leftJoin('journey_contributors as c', (join) =>+ join.onRef('c.journey_id', '=', 'j.id').on('c.user_id', '=', userId),+ )+ .select(['j.id as journey_id', 't.id as trip_id', 't.start_date', 't.end_date'])+ .where('j.auto_prepare_recordings', '=', 1)+ .where((eb) => eb.or([eb('j.user_id', '=', userId), eb('c.role', 'in', ['owner', 'editor'])]))+ .where((eb) => eb.or([eb('t.is_archived', 'is', null), eb('t.is_archived', '=', 0)]))+ .where('t.start_date', 'is not', null)+ .where('t.start_date', '<=', reach.startedBy)+ .where((eb) => eb.or([eb('t.end_date', 'is', null), eb('t.end_date', '>=', reach.endedAfter)]))+ .orderBy('j.id', 'asc')+ .orderBy('t.start_date', 'asc')+ .execute();+ }++ async findStatus(journeyId: number, userId: number): Promise<JourneyRecordingPrepRow | undefined> {+ return await this.db()+ .selectFrom('journey_recording_prep')+ .select(['last_attempt_at', 'last_success_at', 'last_error'])+ .where('journey_id', '=', journeyId)+ .where('user_id', '=', userId)+ .executeTakeFirst();+ }++ /**+ * One attempt, in one statement: a success clears the reason of an earlier+ * failure, a failure keeps the time of the last success, so what is still+ * there and why it is not newer stay apart.+ */+ async recordAttempt(journeyId: number, userId: number, at: string, error: string | null): Promise<void> {+ const outcome = error === null ? { last_success_at: at, last_error: null } : { last_error: error };+ await this.db()+ .insertInto('journey_recording_prep')+ .values({ journey_id: journeyId, user_id: userId, last_attempt_at: at, ...outcome })+ .onConflict((oc) => oc.columns(['journey_id', 'user_id']).doUpdateSet({ last_attempt_at: at, ...outcome }))+ .execute();+ }+}diff --git a/server/src/db/repositories/Journeys.repository.ts b/server/src/db/repositories/Journeys.repository.tsindex c8880b029..db1d7ebba 100644--- a/server/src/db/repositories/Journeys.repository.ts+++ b/server/src/db/repositories/Journeys.repository.ts@@ -30,6 +30,8 @@ export interface JourneyRow {status_override: string | null;/** Entries without a place take their first geotagged photo's position (#1003). */photo_location: number;+ /** The Dawarich sync prepares the recorded days of the linked trips (JRN-03). */+ auto_prepare_recordings: number;}/** JG8's dashboard row — `JourneyRow` plus the five correlated-subquery stat pills. */@@ -238,6 +240,7 @@ export class JourneysRepository extends TrekRepository<Journeys> {show_verdict: number;show_mood: number;show_weather: number;+ auto_prepare_recordings: number;updated_at: number;}>,): Promise<void> {diff --git a/server/src/nest/integrations/dawarich-sync.service.ts b/server/src/nest/integrations/dawarich-sync.service.tsindex 6db4520a1..3dacbbf1f 100644--- a/server/src/nest/integrations/dawarich-sync.service.ts+++ b/server/src/nest/integrations/dawarich-sync.service.ts@@ -11,6 +11,7 @@ import { AddonsService } from '../addons/addons.service';import { getCountryFromCoords } from '../atlas/atlas-geo';import { logError, logInfo } from '../audit/audit-log.logger';import { UnitOfWork } from '../database/unit-of-work';+import { JourneyRecordingPrepService, type PreparedJourney } from '../journey/journey-recording-prep.service';import { DawarichClient, DawarichError, type DawarichCreds, type DawarichVisitRaw } from './dawarich.client';import { distanceMeters, localDateOf, normalizeVisit, syncWindow, visitHash } from './dawarich.helpers';import { DawarichService } from './dawarich.service';@@ -85,6 +86,7 @@ export class DawarichSyncService {@InjectRepository(BucketList) private readonly bucketList: BucketListRepository,@InjectRepository(DawarichConnections) private readonly connections: DawarichConnectionsRepository,private readonly uow: UnitOfWork,+ private readonly journeyPrep: JourneyRecordingPrepService,) {}/** The addon gate, evaluated per tick so an admin toggle lands without a restart. */@@ -156,21 +158,66 @@ export class DawarichSyncService {}const trips = await this.listTripsToSync(userId);- if (trips.length === 0) {+ const journeys = await this.journeysToPrepare(userId);+ if (trips.length === 0 && journeys.length === 0) {// Nothing to ask about is a successful sync, not a failure — otherwise a// user with no dated trips sees a permanent red badge for doing nothing wrong.await this.dawarich.recordSyncResult(userId, 'ok', null);return { state: 'ok', created: 0, updated: 0, missing: 0 };}+ const now = new Date();+ const journeyTrips = tripsOnlyJourneysHold(journeys, trips);+ const { created, updated, missing, failures, lastError, outcomes } = await this.syncTrips(+ userId,+ creds,+ trips,+ journeyTrips,+ now,+ );+ await this.recordJourneyPrep(userId, journeys, outcomes, now);++ const asked = trips.length + journeyTrips.length;+ const state: DawarichSyncState = failures === 0 ? 'ok' : failures === asked ? 'failed' : 'partial';+ await this.dawarich.recordSyncResult(userId, state, state === 'ok' ? null : lastError);++ // The probe is cheap next to the windows just fetched, and re-running it is+ // how a Dawarich upgrade that finally ships `updated_at` starts being used+ // without anyone reconnecting.+ if (state !== 'failed') {+ try {+ await this.dawarich.storeCapabilities(userId, await this.dawarich.probeCapabilities(creds));+ } catch {+ // Capabilities are an optimisation; a failed probe is not a failed sync.+ }+ }++ if (created || updated || missing) {+ logInfo(`Dawarich sync for user ${userId}: ${created} new, ${updated} changed, ${missing} gone`);+ }+ return { state, created, updated, missing };+ }++ /**+ * Every trip's window in turn, one failing without stopping the next: the+ * person's own trips reconciled in full, then the trips only a journey they+ * prepare holds (JRN-03), read for new and changed stays only, since such a+ * window is no full re-read of anything their own sync keeps and its stays+ * belong to no trip of theirs. `outcomes` holds what each window came back+ * with, null when it went through and the reason otherwise.+ *+ * @txIndependent each window reconciles on its own after its network read.+ */+ private async syncTrips(userId: number, creds: DawarichCreds, trips: TripRow[], journeyTrips: TripRow[], now: Date) {let created = 0;let updated = 0;let missing = 0;let failures = 0;let lastError: string | null = null;- const now = new Date();+ const outcomes = new Map<number, string | null>();+ const own = new Set(trips.map((trip) => trip.id));- for (const trip of trips) {+ for (const trip of [...trips, ...journeyTrips]) {const window = syncWindow(trip.start_date,trip.end_date,@@ -181,34 +228,20 @@ export class DawarichSyncService {if (!window) continue;try {- const result = await this.syncTripWindow(userId, trip.id, creds, window.from, window.to, trips);+ const result = await (own.has(trip.id)+ ? this.syncTripWindow(userId, trip.id, creds, window.from, window.to, trips)+ : this.upsertWindow(userId, creds, window.from, window.to, trips));created += result.created;updated += result.updated;- missing += result.missing;+ if ('missing' in result) missing += result.missing;+ outcomes.set(trip.id, null);} catch (err) {failures++;lastError = err instanceof DawarichError ? err.code : 'unreachable';+ outcomes.set(trip.id, lastError);}}-- const state: DawarichSyncState = failures === 0 ? 'ok' : failures === trips.length ? 'failed' : 'partial';- await this.dawarich.recordSyncResult(userId, state, state === 'ok' ? null : lastError);-- // The probe is cheap next to the windows just fetched, and re-running it is- // how a Dawarich upgrade that finally ships `updated_at` starts being used- // without anyone reconnecting.- if (state !== 'failed') {- try {- await this.dawarich.storeCapabilities(userId, await this.dawarich.probeCapabilities(creds));- } catch {- // Capabilities are an optimisation; a failed probe is not a failed sync.- }- }-- if (created || updated || missing) {- logInfo(`Dawarich sync for user ${userId}: ${created} new, ${updated} changed, ${missing} gone`);- }- return { state, created, updated, missing };+ return { created, updated, missing, failures, lastError, outcomes };}/**@@ -366,16 +399,70 @@ export class DawarichSyncService {*/async refreshDay(userId: number, creds: DawarichCreds, date: string): Promise<{ truncated: boolean }> {const day = Date.parse(`${date}T00:00:00Z`);- const { visits, truncated } = await this.client.listVisits(+ const trips = await this.listTripsToSync(userId);+ const { truncated } = await this.upsertWindow(+ userId,creds,new Date(day - DAY_MS),new Date(day + 2 * DAY_MS),+ trips,);- const trips = await this.listTripsToSync(userId);- for (const raw of visits) await this.upsertVisit(userId, null, raw, trips);return { truncated };}+ /**+ * A window's stays inserted or brought up to date, never flagged missing:+ * for a window that is no full re-read of a trip the person's own sync holds.+ *+ * @txIndependent one stay at a time after the network read, as the trip sync writes them.+ */+ private async upsertWindow(+ userId: number,+ creds: DawarichCreds,+ from: Date,+ to: Date,+ trips: TripRow[],+ ): Promise<{ created: number; updated: number; truncated: boolean }> {+ const { visits, truncated } = await this.client.listVisits(creds, from, to);+ let created = 0;+ let updated = 0;+ for (const raw of visits) {+ const outcome = await this.upsertVisit(userId, null, raw, trips);+ if (outcome?.change === 'created') created++;+ else if (outcome?.change === 'updated') updated++;+ }+ return { created, updated, truncated };+ }++ /**+ * The journeys whose recorded days this person prepares (JRN-03), while the+ * Journey addon is on; none otherwise, so the switch costs nothing then.+ */+ private async journeysToPrepare(userId: number): Promise<PreparedJourney[]> {+ if (!(await this.addons.isAddonEnabled(ADDON_IDS.JOURNEY))) return [];+ return await this.journeyPrep.listFor(userId);+ }++ /**+ * Each prepared journey's outcome of this run, for this person: failed when+ * one of its trip windows failed, through when all of them came back. Nothing+ * is written into a journey; the stays wait at their day until the person+ * reviews them. A journey none of whose periods has begun records nothing.+ */+ private async recordJourneyPrep(+ userId: number,+ journeys: PreparedJourney[],+ outcomes: Map<number, string | null>,+ now: Date,+ ): Promise<void> {+ const runs = journeys.flatMap((journey) => {+ const reasons = journey.trips.filter((trip) => outcomes.has(trip.id)).map((trip) => outcomes.get(trip.id));+ if (reasons.length === 0) return [];+ return [{ journeyId: journey.journeyId, failure: reasons.find((reason) => typeof reason === 'string') ?? null }];+ });+ await Promise.all(runs.map((run) => this.journeyPrep.record(run.journeyId, userId, run.failure, now)));+ }+/*** Mark everything TREK holds for this window that the source no longer lists.*@@ -511,6 +598,21 @@ interface TripRow {end_date: string | null;}+/**+ * The linked trips of the prepared journeys that the person's own trip sync+ * does not walk (a journey they write in but do not travel on), each once.+ */+function tripsOnlyJourneysHold(journeys: PreparedJourney[], trips: TripRow[]): TripRow[] {+ const seen = new Set(trips.map((trip) => trip.id));+ const extra: TripRow[] = [];+ for (const trip of journeys.flatMap((journey) => journey.trips)) {+ if (seen.has(trip.id)) continue;+ seen.add(trip.id);+ extra.push(trip);+ }+ return extra;+}+/*** Does the trip's own span, not its widened window, hold this local date?*diff --git a/server/src/nest/journey-recordings/journey-recordings.controller.ts b/server/src/nest/journey-recordings/journey-recordings.controller.tsindex 1af420744..f50e363ae 100644--- a/server/src/nest/journey-recordings/journey-recordings.controller.ts+++ b/server/src/nest/journey-recordings/journey-recordings.controller.ts@@ -23,6 +23,7 @@ import {import {journeyRecordedDaysResponseSchema,journeyRecordingDateSchema,+ journeyRecordingPrepSchema,journeyRecordingPreviewSchema,journeyRecordingSaveResultSchema,successResponseSchema,@@ -46,6 +47,13 @@ export class JourneyRecordingsController {return { days: await this.recordings.list(user.id, Number(id)) };}+ /** JRN-03: whether the journey prepares its recorded days, and how the caller's last runs went. */+ @Get('prep')+ @ResponseContract(journeyRecordingPrepSchema)+ async prep(@CurrentUser() user: User, @Param('id') id: string) {+ return await this.recordings.prepStatus(user.id, Number(id));+ }+@Post('preview')@HttpCode(200)@ResponseContract(journeyRecordingPreviewSchema)diff --git a/server/src/nest/journey-recordings/journey-recordings.mcp.ts b/server/src/nest/journey-recordings/journey-recordings.mcp.tsindex ddfb68852..30a89c9cb 100644--- a/server/src/nest/journey-recordings/journey-recordings.mcp.ts+++ b/server/src/nest/journey-recordings/journey-recordings.mcp.ts@@ -53,6 +53,19 @@ export class JourneyRecordingsMcp {return ok({ days: (await this.recordings.list(ctx.userId, journeyId)).map(summary) });}+ @Tool({+ name: 'get_journey_recording_prep',+ description:+ "Whether a journey prepares its recorded days from Dawarich in the background (its owner's switch, update_journey auto_prepare_recordings) and how the caller's own last runs over its linked trip periods went: when the last one was tried, when one last came through (the stays waiting at the journey's days are as new as that) and why the last one failed, plus whether the caller's connection can prepare anything at all (ready, sync_off, not_connected). Prepared stays are reviewed and taken over with review_journey_day_stays and take_over_journey_day_stays; nothing is ever written into the journey on its own. Needs edit access to the journey.",+ inputSchema: { journeyId: idSchema },+ annotations: TOOL_ANNOTATIONS_READONLY,+ when: bothAddonsOn,+ access: { group: 'journey', mode: 'read' },+ })+ async getRecordingPrep({ journeyId }: { journeyId: number }, ctx: McpContext) {+ return ok(await this.recordings.prepStatus(ctx.userId, journeyId));+ }+@Tool({name: 'preview_journey_recorded_day',description:diff --git a/server/src/nest/journey-recordings/journey-recordings.service.ts b/server/src/nest/journey-recordings/journey-recordings.service.tsindex 942d48ef9..f0553871d 100644--- a/server/src/nest/journey-recordings/journey-recordings.service.ts+++ b/server/src/nest/journey-recordings/journey-recordings.service.ts@@ -2,12 +2,15 @@ import { ADDON_IDS } from '../../addons';import { AddonsService } from '../addons/addons.service';import { DomainError, conflict, forbidden, notFound } from '../common/domain-error';import { DawarichTracksService } from '../integrations/dawarich-tracks.service';+import { DawarichService } from '../integrations/dawarich.service';import { JourneyDomainService } from '../journey/journey-domain.service';import { JourneyRecordedDaysService } from '../journey/journey-recorded-days.service';+import { JourneyRecordingPrepService } from '../journey/journey-recording-prep.service';import { Injectable } from '@nestjs/common';import {recordingStats,type JourneyRecordedDay,+ type JourneyRecordingPrep,type JourneyRecordingPreview,type JourneyRecordingPreviewRequest,type JourneyRecordingSaveRequest,@@ -36,6 +39,8 @@ export class JourneyRecordingsService {private readonly recordedDays: JourneyRecordedDaysService,private readonly tracks: DawarichTracksService,private readonly addons: AddonsService,+ private readonly prep: JourneyRecordingPrepService,+ private readonly dawarich: DawarichService,) {}/** The days a journey keeps, for anyone who can open it. Needs no Dawarich. */@@ -130,6 +135,22 @@ export class JourneyRecordingsService {await this.journeys.broadcastJourneyEvent(journeyId, 'journey:recording:updated', { date }, socketId);}+ /**+ * Whether the journey prepares its recorded days (JRN-03) and how the+ * caller's own last runs over it went, with what their connection allows.+ * Only for those who may edit it: a reader has nothing of theirs prepared.+ */+ async prepStatus(userId: number, journeyId: number): Promise<JourneyRecordingPrep> {+ const journey = await this.requireEditable(journeyId, userId);+ await this.requireDawarich();+ const connection = await this.dawarich.getConnection(userId);+ return {+ enabled: !!journey.auto_prepare_recordings,+ connection: !connection.connected ? 'not_connected' : connection.syncEnabled ? 'ready' : 'sync_off',+ ...(await this.prep.status(journeyId, userId)),+ };+ }+/** The journey, when the caller may edit it: 404 when they cannot open it, 403 when they only read it. */async requireEditable(journeyId: number, userId: number) {const journey = await this.journeys.canAccessJourney(journeyId, userId);diff --git a/server/src/nest/journey/journey-domain.module.ts b/server/src/nest/journey/journey-domain.module.tsindex f329fcefb..2f97b3993 100644--- a/server/src/nest/journey/journey-domain.module.ts+++ b/server/src/nest/journey/journey-domain.module.ts@@ -4,6 +4,7 @@ import { JourneyEntryPhotos } from '../../db/entities/JourneyEntryPhotos.entity'import { JourneyEntryStays } from '../../db/entities/JourneyEntryStays.entity';import { JourneyPhotos } from '../../db/entities/JourneyPhotos.entity';import { JourneyRecordedDays } from '../../db/entities/JourneyRecordedDays.entity';+import { JourneyRecordingPrep } from '../../db/entities/JourneyRecordingPrep.entity';import { JourneyShareTokens } from '../../db/entities/JourneyShareTokens.entity';import { JourneyTrips } from '../../db/entities/JourneyTrips.entity';import { Journeys } from '../../db/entities/Journeys.entity';@@ -16,6 +17,7 @@ import { SettingsModule } from '../settings/settings.module';import { JourneyDomainService } from './journey-domain.service';import { JourneyEntryStaysService } from './journey-entry-stays.service';import { JourneyRecordedDaysService } from './journey-recorded-days.service';+import { JourneyRecordingPrepService } from './journey-recording-prep.service';import { JourneyShareService } from './journey-share.service';import { MikroOrmModule } from '@mikro-orm/nestjs';import { Module } from '@nestjs/common';@@ -70,6 +72,9 @@ import { Module } from '@nestjs/common';* needs nothing of the integration they were taken over from.* `JourneyEntryStays` (JRN-02) is the recorded stays an entry was taken over* from, held by `JourneyEntryStaysService` for the same reason.+ * `JourneyRecordingPrep` (JRN-03) is how far preparing a journey's recorded+ * days got for each person; `JourneyRecordingPrepService` keeps it and tells+ * the Dawarich sync which journeys to read.*/@Module({imports: [@@ -89,9 +94,22 @@ import { Module } from '@nestjs/common';JourneyShareTokens,JourneyRecordedDays,JourneyEntryStays,+ JourneyRecordingPrep,]),],- providers: [JourneyDomainService, JourneyShareService, JourneyRecordedDaysService, JourneyEntryStaysService],- exports: [JourneyDomainService, JourneyShareService, JourneyRecordedDaysService, JourneyEntryStaysService],+ providers: [+ JourneyDomainService,+ JourneyShareService,+ JourneyRecordedDaysService,+ JourneyEntryStaysService,+ JourneyRecordingPrepService,+ ],+ exports: [+ JourneyDomainService,+ JourneyShareService,+ JourneyRecordedDaysService,+ JourneyEntryStaysService,+ JourneyRecordingPrepService,+ ],})export class JourneyDomainModule {}diff --git a/server/src/nest/journey/journey-domain.service.ts b/server/src/nest/journey/journey-domain.service.tsindex 4454c8f23..364bfdf3e 100644--- a/server/src/nest/journey/journey-domain.service.ts+++ b/server/src/nest/journey/journey-domain.service.ts@@ -329,6 +329,7 @@ export class JourneyDomainService {show_verdict: boolean | number;show_mood: boolean | number;show_weather: boolean | number;+ auto_prepare_recordings: boolean | number;}>,): Promise<Journey | null> {// Journey-level settings (title, cover, status) are owner-only — editors@@ -338,11 +339,8 @@ export class JourneyDomainService {const ALLOWED_STATUSES = ['draft', 'active', 'completed', 'archived'];// null hands the state back to the trip dates (#762).const ALLOWED_OVERRIDES: (string | null)[] = [null, 'draft', 'live', 'completed'];- // JG24 — R6's `presenceSet` conversion. The SERVICE resolves each field- // to its final bound value (the `status` allow-list check, the- // `show_*` boolean-to-0/1 coercion) before handing it to the repository;- // a field absent here never reaches the SET clause, matching the legacy- // dynamic-SET-list's own "not present, not touched" behavior.+ // JG24: each field is resolved to its bound value here (the status allow-list, every flag to 0/1);+ // a field absent from `data` never reaches the SET clause, as the legacy dynamic SET list behaved.const patch = presenceSet<{title: string;subtitle: string | null;@@ -355,6 +353,7 @@ export class JourneyDomainService {show_verdict: number;show_mood: number;show_weather: number;+ auto_prepare_recordings: number;}>({title: [data.title !== undefined, data.title as string],subtitle: [data.subtitle !== undefined, data.subtitle as string],@@ -370,6 +369,7 @@ export class JourneyDomainService {show_verdict: [data.show_verdict !== undefined, data.show_verdict ? 1 : 0],show_mood: [data.show_mood !== undefined, data.show_mood ? 1 : 0],show_weather: [data.show_weather !== undefined, data.show_weather ? 1 : 0],+ auto_prepare_recordings: [data.auto_prepare_recordings !== undefined, data.auto_prepare_recordings ? 1 : 0],});if (Object.keys(patch).length === 0) return ((await this.journeysRepo.findById(journeyId)) as Journey) ?? null;diff --git a/server/src/nest/journey/journey-recording-prep.service.ts b/server/src/nest/journey/journey-recording-prep.service.tsnew file mode 100644index 000000000..6d926285b--- /dev/null+++ b/server/src/nest/journey/journey-recording-prep.service.ts@@ -0,0 +1,78 @@+import { JourneyRecordingPrep } from '../../db/entities/JourneyRecordingPrep.entity';+import type { JourneyRecordingPrepRepository } from '../../db/repositories/JourneyRecordingPrep.repository';+import { InjectRepository } from '@mikro-orm/nestjs';+import { Injectable } from '@nestjs/common';++const DAY_MS = 86_400_000;++/**+ * How far back a finished trip is still read, as `TripsRepository.listTripsToSync`+ * reads a person's own trips: a journey must not reach further into the past+ * than the trip sync it rides on.+ */+const SYNC_REACH_DAYS = 400;++/** A journey that prepares its recorded days, with the linked trips the next run reads. */+export interface PreparedJourney {+ journeyId: number;+ trips: Array<{ id: number; start_date: string | null; end_date: string | null }>;+}++/** The last background run over a journey's recorded days, for one person. */+export interface JourneyRecordingPrepStatus {+ lastAttemptAt: string | null;+ lastSuccessAt: string | null;+ lastError: string | null;+}++/**+ * Preparing a journey's recorded days (JRN-03): which journeys a person's+ * Dawarich sync also reads, and how the last of those runs went for them.+ * The journey owns the switch and the status; the reading itself is the+ * Dawarich sync's, which calls in here and never the other way round.+ */+@Injectable()+export class JourneyRecordingPrepService {+ constructor(@InjectRepository(JourneyRecordingPrep) private readonly prep: JourneyRecordingPrepRepository) {}++ /** The journeys this person prepares now, each with its linked trips within the sync's reach. */+ async listFor(userId: number, now: Date = new Date()): Promise<PreparedJourney[]> {+ const rows = await this.prep.listPreparedTrips(userId, {+ endedAfter: isoDate(now.getTime() - SYNC_REACH_DAYS * DAY_MS),+ startedBy: isoDate(now.getTime() + DAY_MS),+ });+ const byJourney = new Map<number, PreparedJourney>();+ for (const row of rows) {+ let journey = byJourney.get(row.journey_id);+ if (!journey) {+ journey = { journeyId: row.journey_id, trips: [] };+ byJourney.set(row.journey_id, journey);+ }+ journey.trips.push({ id: row.trip_id, start_date: row.start_date, end_date: row.end_date });+ }+ return [...byJourney.values()];+ }++ /**+ * One run's outcome for a journey and person: `error` is Dawarich's reason,+ * null when every period came through.+ *+ * @txStandalone a status row, complete on its own whatever the run around it wrote.+ */+ async record(journeyId: number, userId: number, error: string | null, at: Date = new Date()): Promise<void> {+ await this.prep.recordAttempt(journeyId, userId, at.toISOString(), error);+ }++ async status(journeyId: number, userId: number): Promise<JourneyRecordingPrepStatus> {+ const row = await this.prep.findStatus(journeyId, userId);+ return {+ lastAttemptAt: row?.last_attempt_at ?? null,+ lastSuccessAt: row?.last_success_at ?? null,+ lastError: row?.last_error ?? null,+ };+ }+}++function isoDate(ms: number): string {+ return new Date(ms).toISOString().slice(0, 10);+}diff --git a/server/src/nest/journey/journey.mcp.ts b/server/src/nest/journey/journey.mcp.tsindex 07ac38d48..e431adafe 100644--- a/server/src/nest/journey/journey.mcp.ts+++ b/server/src/nest/journey/journey.mcp.ts@@ -17,7 +17,7 @@ import { AddonsService } from '../addons/addons.service';import { JourneyDomainService } from './journey-domain.service';import { JourneyPhotoCaptureService } from './journey-photo-capture.service';import { JourneyShareService } from './journey-share.service';-import { idSchema } from '@trek/shared';+import { idSchema, journeyUpdateRequestSchema } from '@trek/shared';import { z } from 'zod';@@ -258,7 +258,7 @@ export class JourneyMcp {@Tool({name: 'update_journey',description:- "Update an existing journey's title, subtitle, cover, or status. Owner only. status_override sets the state shown for the journey (draft, live, completed) instead of deriving it from the linked trips' dates; null goes back to the dates.",+ "Update an existing journey's title, subtitle, cover, or status. Owner only. status_override sets the state shown for the journey (draft, live, completed) instead of deriving it from the linked trips' dates; null goes back to the dates. auto_prepare_recordings switches the background preparation of its recorded days from Dawarich on or off (see get_journey_recording_prep).",inputSchema: {journeyId: idSchema,title: z.string().min(1).max(200).optional(),@@ -276,6 +276,7 @@ export class JourneyMcp {.boolean().optional().describe('Whether an entry without a place takes the position of the first geotagged photo added to it'),+ auto_prepare_recordings: journeyUpdateRequestSchema.shape.auto_prepare_recordings,},annotations: TOOL_ANNOTATIONS_WRITE,when: journeyAddonOn,@@ -295,6 +296,7 @@ export class JourneyMcp {show_mood?: boolean;show_weather?: boolean;photo_location?: boolean;+ auto_prepare_recordings?: boolean;},ctx: McpContext,) {diff --git a/server/src/nest/plugins/protocol/output-contract.ts b/server/src/nest/plugins/protocol/output-contract.tsindex 06303f3f6..45a9b36c7 100644--- a/server/src/nest/plugins/protocol/output-contract.ts+++ b/server/src/nest/plugins/protocol/output-contract.ts@@ -441,7 +441,8 @@ export const PLUGIN_ENTITY_CONTRACT = {'status_override','photo_location',],- withheld: [],+ // A person's own sync setting for the journey, nothing a plugin acts on.+ withheld: ['auto_prepare_recordings'],wholeRow: true,derived: ['entry_count', 'photo_count', 'place_count', 'trip_date_min', 'trip_date_max'],},diff --git a/server/src/types.ts b/server/src/types.tsindex 94bc23c5d..e218f2780 100644--- a/server/src/types.ts+++ b/server/src/types.ts@@ -229,6 +229,8 @@ export interface Journey {status_override?: 'draft' | 'live' | 'completed' | null;/** Entries without a place take the spot of their first geotagged photo (#1003). 0 by default. */photo_location?: number;+ /** The Dawarich sync prepares the recorded days of the linked trips (JRN-03). 0 by default. */+ auto_prepare_recordings?: number;created_at: number;updated_at: number;}diff --git a/server/tests/e2e/journey-recordings.e2e.test.ts b/server/tests/e2e/journey-recordings.e2e.test.tsindex fd172e33d..e1e4367b4 100644--- a/server/tests/e2e/journey-recordings.e2e.test.ts+++ b/server/tests/e2e/journey-recordings.e2e.test.ts@@ -10,21 +10,25 @@** The walk: preview, keep, read the day back once the connection is gone,* take the same day over again without a second copy, replace it on purpose,- * keep the version when Dawarich fails, and drop it.+ * keep the version when Dawarich fails, and drop it. Then the preparation of+ * the journey's days (JRN-03) as each caller sees it.*/import { DawarichConnections } from '../../src/db/entities/DawarichConnections.entity';import { JourneyRecordedDays } from '../../src/db/entities/JourneyRecordedDays.entity';+import { Journeys } from '../../src/db/entities/Journeys.entity';import { encrypt_api_key } from '../../src/nest/common/crypto/apiKeyCrypto';import { TrekExceptionFilter } from '../../src/nest/common/trek-exception.filter';import { ZodValidationPipe } from '../../src/nest/common/zod-validation.pipe';+import { DawarichSyncService } from '../../src/nest/integrations/dawarich-sync.service';import { DawarichClient, DawarichError } from '../../src/nest/integrations/dawarich.client';import { JourneyRecordingsModule } from '../../src/nest/journey-recordings/journey-recordings.module';import { RealtimeModule } from '../../src/nest/realtime/realtime.module';import { RealtimeService } from '../../src/nest/realtime/realtime.service';import { createSnapshotTestDb } from '../helpers/db-mock';-import { addJourneyContributor, makeJourney } from '../helpers/factories/journeys';-import { countRows, deleteRows, insertRow } from '../helpers/factories/rows';+import { addJourneyContributor, linkTripToJourney, makeJourney } from '../helpers/factories/journeys';+import { countRows, deleteRows, insertRow, updateRows } from '../helpers/factories/rows';import { setAddonEnabled } from '../helpers/factories/settings';+import { makeTrip } from '../helpers/factories/trips';import { makeUser } from '../helpers/factories/users';import { FakeRealtimeService } from '../helpers/fake-realtime';import { createTestMikroOrmModule, createTestOrm, type TestOrm } from '../helpers/test-orm';@@ -292,4 +296,34 @@ describe('Journey recordings e2e (real guards + temp SQLite)', () => {expect(await countRows(orm, JourneyRecordedDays)).toBe(0);expect((await request(server).delete(`${base()}/${DAY}`).set(as(EDITOR))).status).toBe(404);});++ it('reports how the journey prepares its days for each caller, off at first and after a sync run once on', async () => {+ const off = await request(server).get(`${base()}/prep`).set(as(OWNER));+ expect(off.status).toBe(200);+ expect(off.body).toEqual({+ enabled: false,+ connection: 'ready',+ lastAttemptAt: null,+ lastSuccessAt: null,+ lastError: null,+ });++ const today = new Date().toISOString().slice(0, 10);+ const trip = await makeTrip(orm, OWNER, { start_date: today, end_date: today });+ await linkTripToJourney(orm, journeyId, trip.id);+ await updateRows(orm, Journeys, { id: journeyId }, { auto_prepare_recordings: 1 });+ client.listVisits.mockResolvedValue({ visits: [], truncated: false, version: null });+ await app.get(DawarichSyncService).syncUser(OWNER);++ const on = await request(server).get(`${base()}/prep`).set(as(OWNER));+ expect(on.body).toMatchObject({ enabled: true, connection: 'ready', lastError: null });+ expect(on.body.lastSuccessAt).toEqual(expect.any(String));+ expect((await request(server).get(`${base()}/prep`).set(as(EDITOR))).body).toMatchObject({+ enabled: true,+ connection: 'not_connected',+ lastSuccessAt: null,+ });+ expect((await request(server).get(`${base()}/prep`).set(as(VIEWER))).status).toBe(403);+ expect((await request(server).get(`${base()}/prep`).set(as(OUTSIDER))).status).toBe(404);+ });});diff --git a/server/tests/unit/db/entities-index.test.ts b/server/tests/unit/db/entities-index.test.tsindex 8b1064d94..1c18a9701 100644--- a/server/tests/unit/db/entities-index.test.ts+++ b/server/tests/unit/db/entities-index.test.ts@@ -48,14 +48,15 @@ describe('ALL_ENTITIES', () => {* + tour_packing_links, the packing list or category a tour points at* + tour_source_hints, what the wanderer watch found about a snapshot's source* + journey_recorded_days, the recorded route a journey keeps per day- * + journey_entry_stays, the recorded stays a journey entry was taken over from)+ * + journey_entry_stays, the recorded stays a journey entry was taken over from+ * + journey_recording_prep, how far preparing a journey's recorded days got for each person)* is registered, and no two share a class name (a silent duplicate would* shadow one of them in `orm.getMetadata()`, exactly the kind of drift* `entity-schema-parity.test.ts` can't see — it iterates the metadata map,* which de-duplicates by class name).*/- it('ENT-003: exactly 151 entities, every class name unique', () => {- expect(ALL_ENTITIES.length).toBe(151);+ it('ENT-003: exactly 152 entities, every class name unique', () => {+ expect(ALL_ENTITIES.length).toBe(152);const names = ALL_ENTITIES.map((s) => s.meta.className);expect(new Set(names).size).toBe(names.length);});diff --git a/server/tests/unit/db/entity-class-fields.test.ts b/server/tests/unit/db/entity-class-fields.test.tsindex 556957b01..fab75f6eb 100644--- a/server/tests/unit/db/entity-class-fields.test.ts+++ b/server/tests/unit/db/entity-class-fields.test.ts@@ -47,7 +47,8 @@ import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest';// window_to, segments, point_count, content_hash, fetched_at (a kept day is only ever written whole).// + journey_entry_stays: id, journey_id, entry_id, source_visit_id, name, started_at, ended_at (a stay is// only ever written whole, by the take-over of its day).-const KNOWN_UNINITIALISED_NOT_NULL_SCALARS = 537;+// + journey_recording_prep: id, journey_id, user_id (a status row always names its journey and its person).+const KNOWN_UNINITIALISED_NOT_NULL_SCALARS = 540;describe('entity class fields never carry a NaN initialiser (task-4-review-shape.md, Important 1)', () => {it('CLASSFIELD-001: new X() has no own property whose value is NaN, across all 133 entities', () => {diff --git a/server/tests/unit/db/legacy-baseline.test.ts b/server/tests/unit/db/legacy-baseline.test.tsindex 955d19d05..d233d5a9a 100644--- a/server/tests/unit/db/legacy-baseline.test.ts+++ b/server/tests/unit/db/legacy-baseline.test.ts@@ -84,6 +84,7 @@ const UNNUMBERED = ['Migration20200101046150_a_ski_tour_keeps_its_piste_router_options','Migration20200101046160_a_journey_keeps_its_recorded_days','Migration20200101046170_a_journey_entry_remembers_the_stays_it_came_from',+ 'Migration20200101046180_journeys_can_prepare_recorded_days',];// The last step the positional runner ever had; planLegacyBaseline refuses a// schema_version past it.diff --git a/server/tests/unit/db/repositories/JourneyRecordingPrep.repository.test.ts b/server/tests/unit/db/repositories/JourneyRecordingPrep.repository.test.tsnew file mode 100644index 000000000..b133c3161--- /dev/null+++ b/server/tests/unit/db/repositories/JourneyRecordingPrep.repository.test.ts@@ -0,0 +1,129 @@+/**+ * `JourneyRecordingPrepRepository` (JRN-03): the linked trips of the journeys+ * a person prepares, only while the journey asks for it and the person may+ * edit it, within the sync's reach; and the status row of one journey and+ * person, where a success clears an earlier failure and a failure keeps the+ * last success.+ */+import { JourneyRecordingPrep } from '../../../../src/db/entities/JourneyRecordingPrep.entity';+import { Journeys } from '../../../../src/db/entities/Journeys.entity';+import type { JourneyRecordingPrepRepository } from '../../../../src/db/repositories/JourneyRecordingPrep.repository';+import { createSnapshotTestDb } from '../../../helpers/db-mock';+import { addJourneyContributor, linkTripToJourney, makeJourney } from '../../../helpers/factories/journeys';+import { countRows, deleteRows, updateRows } from '../../../helpers/factories/rows';+import { makeTrip, type TripOverrides } from '../../../helpers/factories/trips';+import { makeUser } from '../../../helpers/factories/users';+import { resetTestDb } from '../../../helpers/test-db';+import { createTestOrm, type TestOrm } from '../../../helpers/test-orm';++import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest';++const testDb = createSnapshotTestDb();+let t: TestOrm;+let prep: JourneyRecordingPrepRepository;++beforeAll(async () => {+ t = await createTestOrm(testDb);+ prep = t.repo(JourneyRecordingPrep);+});+beforeEach(() => {+ resetTestDb(testDb);+ t.clear();+});+afterAll(async () => {+ await t.close();+ testDb.close();+});++const REACH = { endedAfter: '2025-09-01', startedBy: '2026-10-22' };++async function preparedJourney() {+ const { user: owner } = await makeUser(t);+ const journey = await makeJourney(t, owner.id, { auto_prepare_recordings: 1 });+ const trip = await makeTrip(t, owner.id, { start_date: '2026-05-12', end_date: '2026-05-18' });+ await linkTripToJourney(t, journey.id, trip.id);+ return { owner, journey, trip };+}++describe('JourneyRecordingPrepRepository.listPreparedTrips', () => {+ it('JRNPREP-REPO-001: lists the linked trips of a prepared journey for its owner and its editors, not its readers', async () => {+ const { owner, journey, trip } = await preparedJourney();+ const { user: editor } = await makeUser(t);+ const { user: viewer } = await makeUser(t);+ await addJourneyContributor(t, journey.id, editor.id, 'editor');+ await addJourneyContributor(t, journey.id, viewer.id, 'viewer');+ const row = { journey_id: journey.id, trip_id: trip.id, start_date: '2026-05-12', end_date: '2026-05-18' };++ expect(await prep.listPreparedTrips(owner.id, REACH)).toEqual([row]);+ expect(await prep.listPreparedTrips(editor.id, REACH)).toEqual([row]);+ expect(await prep.listPreparedTrips(viewer.id, REACH)).toEqual([]);+ });++ it('JRNPREP-REPO-002: a journey with the switch off, and an undated, archived or out-of-reach trip, give nothing', async () => {+ const { owner, journey } = await preparedJourney();+ const link = async (overrides: TripOverrides) =>+ linkTripToJourney(t, journey.id, (await makeTrip(t, owner.id, overrides)).id);+ await link({ start_date: null, end_date: null });+ await link({ start_date: '2026-06-01', end_date: '2026-06-05', is_archived: 1 });+ await link({ start_date: '2024-05-01', end_date: '2024-05-10' });+ await link({ start_date: '2026-12-01', end_date: '2026-12-10' });+ await link({ start_date: '2026-10-01', end_date: null });++ expect((await prep.listPreparedTrips(owner.id, REACH)).map((row) => row.start_date)).toEqual([+ '2026-05-12',+ '2026-10-01',+ ]);++ await updateRows(t, Journeys, { id: journey.id }, { auto_prepare_recordings: 0 });+ expect(await prep.listPreparedTrips(owner.id, REACH)).toEqual([]);+ });+});++describe('JourneyRecordingPrepRepository status', () => {+ it('JRNPREP-REPO-003: reads nothing before the first run, then one row per journey and person', async () => {+ const { owner, journey } = await preparedJourney();+ expect(await prep.findStatus(journey.id, owner.id)).toBeUndefined();++ await prep.recordAttempt(journey.id, owner.id, '2026-05-14T08:00:00.000Z', null);+ await prep.recordAttempt(journey.id, owner.id, '2026-05-14T09:00:00.000Z', null);++ expect(await prep.findStatus(journey.id, owner.id)).toEqual({+ last_attempt_at: '2026-05-14T09:00:00.000Z',+ last_success_at: '2026-05-14T09:00:00.000Z',+ last_error: null,+ });+ expect(await countRows(t, JourneyRecordingPrep, {})).toBe(1);+ });++ it('JRNPREP-REPO-004: a failure keeps the last success, the next success clears the failure', async () => {+ const { owner, journey } = await preparedJourney();+ await prep.recordAttempt(journey.id, owner.id, '2026-05-14T08:00:00.000Z', null);+ await prep.recordAttempt(journey.id, owner.id, '2026-05-14T09:00:00.000Z', 'unreachable');++ expect(await prep.findStatus(journey.id, owner.id)).toEqual({+ last_attempt_at: '2026-05-14T09:00:00.000Z',+ last_success_at: '2026-05-14T08:00:00.000Z',+ last_error: 'unreachable',+ });++ await prep.recordAttempt(journey.id, owner.id, '2026-05-14T10:00:00.000Z', null);+ expect(await prep.findStatus(journey.id, owner.id)).toMatchObject({+ last_success_at: '2026-05-14T10:00:00.000Z',+ last_error: null,+ });+ });++ it('JRNPREP-REPO-005: a first run that fails has no success yet, and the row goes with its journey', async () => {+ const { owner, journey } = await preparedJourney();+ await prep.recordAttempt(journey.id, owner.id, '2026-05-14T08:00:00.000Z', 'unauthorized');++ expect(await prep.findStatus(journey.id, owner.id)).toEqual({+ last_attempt_at: '2026-05-14T08:00:00.000Z',+ last_success_at: null,+ last_error: 'unauthorized',+ });++ await deleteRows(t, Journeys, { id: journey.id });+ expect(await countRows(t, JourneyRecordingPrep, {})).toBe(0);+ });+});diff --git a/server/tests/unit/mcp/tools-journey.test.ts b/server/tests/unit/mcp/tools-journey.test.tsindex fb911d593..d21d009c7 100644--- a/server/tests/unit/mcp/tools-journey.test.ts+++ b/server/tests/unit/mcp/tools-journey.test.ts@@ -349,6 +349,25 @@ describe('journey write tools', () => {});});+ it('update_journey switches the preparation of recorded days on and refuses a value that is no boolean', async () => {+ const { user } = createUser(testDb);+ await withHarness(user.id, async (h) => {+ const journey = await seedJourney(h);+ const updated = parseToolResult(+ await h.client.callTool({+ name: 'update_journey',+ arguments: { journeyId: journey.id, auto_prepare_recordings: true },+ }),+ ) as { journey: { auto_prepare_recordings: number } };+ expect(updated.journey.auto_prepare_recordings).toBe(1);+ const refused = await h.client.callTool({+ name: 'update_journey',+ arguments: { journeyId: journey.id, auto_prepare_recordings: 'yes' },+ });+ expect(refused.isError).toBe(true);+ });+ });+it('delete_journey removes it and refuses a foreign journey', async () => {const { user } = createUser(testDb);const { journeyId } = await foreignJourney();diff --git a/server/tests/unit/nest/dawarich-sync-journeys.service.test.ts b/server/tests/unit/nest/dawarich-sync-journeys.service.test.tsnew file mode 100644index 000000000..0e3927e95--- /dev/null+++ b/server/tests/unit/nest/dawarich-sync-journeys.service.test.ts@@ -0,0 +1,273 @@+/**+ * DawarichSyncService preparing the recorded days of journeys (JRN-03). The+ * suite takes the sync from its module over a snapshot test db; only the+ * Dawarich instance and the connection store are replaced, so the journey+ * access, the switch, the stays and the status rows are the real ones.+ *+ * What it pins: nothing is prepared while a journey's switch is off; with it+ * on, the linked trip periods are read with the person's own connection, a+ * period their own trip sync read already is not asked twice, and a period+ * of a trip they are not on files its stays under no trip; repeated runs+ * write no second stay and leave a taken-over one as it was; a failure keeps+ * the last success apart from its reason; a reader, a disconnected person or+ * the Journey addon switched off prepare nothing.+ */+import { DawarichVisitSuggestions } from '../../../src/db/entities/DawarichVisitSuggestions.entity';+import { JourneyRecordingPrep } from '../../../src/db/entities/JourneyRecordingPrep.entity';+import { Journeys } from '../../../src/db/entities/Journeys.entity';+import { DawarichSyncService } from '../../../src/nest/integrations/dawarich-sync.service';+import { DawarichClient, DawarichError, type DawarichVisitRaw } from '../../../src/nest/integrations/dawarich.client';+import { DawarichModule } from '../../../src/nest/integrations/dawarich.module';+import { DawarichService } from '../../../src/nest/integrations/dawarich.service';+import { JourneyDomainService } from '../../../src/nest/journey/journey-domain.service';+import { JourneyRecordingPrepService } from '../../../src/nest/journey/journey-recording-prep.service';+import { createSnapshotTestDb } from '../../helpers/db-mock';+import { addJourneyContributor, linkTripToJourney, makeJourney } from '../../helpers/factories/journeys';+import { countRows, findRow, findRows, updateRows } from '../../helpers/factories/rows';+import { setAddonEnabled } from '../../helpers/factories/settings';+import { makeTrip } from '../../helpers/factories/trips';+import { makeUser } from '../../helpers/factories/users';+import { resetTestDb } from '../../helpers/test-db';+import { createTestModule, type TestModule } from '../../helpers/test-module';+import { createTestOrm, type TestOrm } from '../../helpers/test-orm';++import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';++const db = createSnapshotTestDb();+const CREDS = { baseUrl: 'https://dawarich.example.com', apiKey: 'key', allowInsecureTls: false };+const listVisits = vi.fn<(...args: unknown[]) => Promise<{ visits: DawarichVisitRaw[]; truncated: boolean }>>();+const getCredentials = vi.fn();+const recordSyncResult = vi.fn();+const storeCapabilities = vi.fn();+const probeCapabilities = vi.fn();+let t: TestModule;+let orm: TestOrm;+let sync: DawarichSyncService;+let prep: JourneyRecordingPrepService;++beforeAll(async () => {+ t = await createTestModule({+ db,+ imports: [DawarichModule],+ overrides: [+ { provide: DawarichClient, useValue: { listVisits } },+ {+ provide: DawarichService,+ useValue: { getCredentials, recordSyncResult, storeCapabilities, probeCapabilities },+ },+ ],+ });+ sync = t.get(DawarichSyncService);+ prep = t.get(JourneyRecordingPrepService);+ orm = await createTestOrm(db);+});+beforeEach(async () => {+ resetTestDb(db);+ orm.clear();+ listVisits.mockReset().mockResolvedValue({ visits: [], truncated: false });+ getCredentials.mockReset().mockResolvedValue(CREDS);+ recordSyncResult.mockReset();+ storeCapabilities.mockReset();+ probeCapabilities.mockReset().mockResolvedValue(null);+ await setAddonEnabled(orm, 'journey', true);+ await setAddonEnabled(orm, 'dawarich', true);+});+afterAll(async () => {+ await orm.close();+ await t.close();+ db.close();+});++const DAY_MS = 86_400_000;++/** A calendar date relative to today, so a fixture never ages out of the sync's reach. */+function dayOffset(days: number): string {+ return new Date(Date.now() + days * DAY_MS).toISOString().slice(0, 10);+}++const TRIP_START = dayOffset(-6);+const TRIP_END = dayOffset(-2);+const VISIT_DAY = dayOffset(-4);++function visit(id: number, name: string): DawarichVisitRaw {+ return {+ id,+ area_id: null,+ started_at: `${VISIT_DAY}T09:00:00Z`,+ ended_at: `${VISIT_DAY}T10:30:00Z`,+ duration: null,+ name,+ status: 'suggested',+ confidence: 80,+ confidence_band: 'high',+ place: { latitude: 45.434, longitude: 12.3388, id: null },+ };+}++/** Marta's trip behind a journey that prepares its days, with Jonas writing in it but not on the trip. */+async function fixture(autoPrepare = 1) {+ const { user: owner } = await makeUser(orm, { username: 'marta' });+ const { user: editor } = await makeUser(orm, { username: 'jonas' });+ const { user: viewer } = await makeUser(orm);+ const journey = await makeJourney(orm, owner.id, { title: 'Venice', auto_prepare_recordings: autoPrepare });+ await addJourneyContributor(orm, journey.id, editor.id, 'editor');+ await addJourneyContributor(orm, journey.id, viewer.id, 'viewer');+ const trip = await makeTrip(orm, owner.id, { start_date: TRIP_START, end_date: TRIP_END });+ await linkTripToJourney(orm, journey.id, trip.id);+ return { owner, editor, viewer, journey, trip };+}++function staysOf(userId: number) {+ return findRows(orm, DawarichVisitSuggestions, { user: userId }, { id: 'asc' });+}++async function onlyStayOf(userId: number) {+ const [stay, ...rest] = await staysOf(userId);+ expect(rest).toEqual([]);+ if (!stay) throw new Error(`no stay for user ${userId}`);+ return stay;+}++describe('DawarichSyncService preparing journeys', () => {+ it('JRNPREP-SYNC-001: an editor not on the trip gets its stays prepared under no trip, and the journey records the run', async () => {+ const f = await fixture();+ listVisits.mockResolvedValue({ visits: [visit(701, 'Piazza San Marco')], truncated: false });++ const outcome = await sync.syncUser(f.editor.id);++ expect(outcome).toMatchObject({ state: 'ok', created: 1 });+ expect(listVisits).toHaveBeenCalledTimes(1);+ expect((await staysOf(f.editor.id)).map((row) => [row.name, row.trip_id, row.state])).toEqual([+ ['Piazza San Marco', null, 'new'],+ ]);+ const status = await prep.status(f.journey.id, f.editor.id);+ expect(status.lastError).toBeNull();+ expect(status.lastSuccessAt).toBe(status.lastAttemptAt);+ expect(status.lastSuccessAt).not.toBeNull();+ });++ it('JRNPREP-SYNC-002: the owner on the trip is asked once for the period, and the journey takes that answer', async () => {+ const f = await fixture();+ listVisits.mockResolvedValue({ visits: [visit(702, 'Rialto')], truncated: false });++ await sync.syncUser(f.owner.id);++ expect(listVisits).toHaveBeenCalledTimes(1);+ expect((await staysOf(f.owner.id)).map((row) => row.trip_id)).toEqual([f.trip.id]);+ expect((await prep.status(f.journey.id, f.owner.id)).lastError).toBeNull();+ });++ it('JRNPREP-SYNC-003: with the switch off nothing is asked for the journey and no status is written', async () => {+ const f = await fixture(0);++ expect(await sync.syncUser(f.editor.id)).toMatchObject({ state: 'ok', created: 0 });++ expect(listVisits).not.toHaveBeenCalled();+ expect(await countRows(orm, JourneyRecordingPrep, {})).toBe(0);+ });++ it('JRNPREP-SYNC-004: repeated runs write no second stay and leave a taken-over one as it was', async () => {+ const f = await fixture();+ listVisits.mockResolvedValue({ visits: [visit(703, 'Giudecca')], truncated: false });+ await sync.syncUser(f.editor.id);+ const stay = await onlyStayOf(f.editor.id);+ await updateRows(+ orm,+ DawarichVisitSuggestions,+ { id: stay.id },+ { state: 'accepted', accepted_hash: stay.source_hash },+ );++ listVisits.mockResolvedValue({ visits: [visit(703, 'Giudecca, renamed')], truncated: false });+ expect(await sync.syncUser(f.editor.id)).toMatchObject({ created: 0, updated: 1 });++ const after = await onlyStayOf(f.editor.id);+ expect(after).toMatchObject({ name: 'Giudecca', state: 'accepted' });+ expect(after.source_hash).not.toBe(stay.source_hash);+ });++ it('JRNPREP-SYNC-005: a failed run keeps the stays and the last success, says why, and the next success clears it', async () => {+ const f = await fixture();+ listVisits.mockResolvedValue({ visits: [visit(704, 'Zattere')], truncated: false });+ await sync.syncUser(f.editor.id);+ const before = await prep.status(f.journey.id, f.editor.id);++ listVisits.mockRejectedValue(new DawarichError('unreachable', 'down'));+ expect(await sync.syncUser(f.editor.id)).toMatchObject({ state: 'failed' });++ expect(recordSyncResult).toHaveBeenLastCalledWith(f.editor.id, 'failed', 'unreachable');+ expect(await staysOf(f.editor.id)).toHaveLength(1);+ const failed = await prep.status(f.journey.id, f.editor.id);+ expect(failed).toMatchObject({ lastSuccessAt: before.lastSuccessAt, lastError: 'unreachable' });++ listVisits.mockResolvedValue({ visits: [], truncated: false });+ await sync.syncUser(f.editor.id);+ expect((await prep.status(f.journey.id, f.editor.id)).lastError).toBeNull();+ });++ it('JRNPREP-SYNC-006: a reader, the Journey addon off or a trip still days ahead prepare nothing', async () => {+ const f = await fixture();++ await sync.syncUser(f.viewer.id);+ expect(listVisits).not.toHaveBeenCalled();++ await setAddonEnabled(orm, 'journey', false);+ await sync.syncUser(f.editor.id);+ expect(listVisits).not.toHaveBeenCalled();++ await setAddonEnabled(orm, 'journey', true);+ const later = await makeJourney(orm, f.owner.id, { auto_prepare_recordings: 1 });+ await addJourneyContributor(orm, later.id, f.editor.id, 'editor');+ const ahead = await makeTrip(orm, f.owner.id, { start_date: dayOffset(5), end_date: dayOffset(8) });+ await linkTripToJourney(orm, later.id, ahead.id);+ await sync.syncUser(f.editor.id);+ expect(await findRow(orm, JourneyRecordingPrep, { journey: later.id })).toBeNull();+ expect(await findRow(orm, JourneyRecordingPrep, { journey: f.journey.id })).not.toBeNull();+ });++ it('JRNPREP-SYNC-007: without a connection nothing is asked and nothing recorded', async () => {+ const f = await fixture();+ getCredentials.mockResolvedValue(null);++ expect(await sync.syncUser(f.editor.id)).toMatchObject({ state: 'failed' });++ expect(listVisits).not.toHaveBeenCalled();+ expect(await countRows(orm, JourneyRecordingPrep, {})).toBe(0);+ });+});++describe('JourneyRecordingPrepService', () => {+ it('JRNPREP-SVC-001: groups the linked trips by journey and reads no status before the first run', async () => {+ const f = await fixture();+ const second = await makeTrip(orm, f.owner.id, { start_date: dayOffset(-1), end_date: dayOffset(2) });+ await linkTripToJourney(orm, f.journey.id, second.id);++ expect(await prep.listFor(f.editor.id)).toEqual([+ {+ journeyId: f.journey.id,+ trips: [+ { id: f.trip.id, start_date: TRIP_START, end_date: TRIP_END },+ { id: second.id, start_date: dayOffset(-1), end_date: dayOffset(2) },+ ],+ },+ ]);+ expect(await prep.status(f.journey.id, f.editor.id)).toEqual({+ lastAttemptAt: null,+ lastSuccessAt: null,+ lastError: null,+ });+ });++ it('JRNPREP-SVC-002: the owner switches it on and off through the journey, an editor cannot', async () => {+ const f = await fixture(0);+ const journeys = t.get(JourneyDomainService);++ expect(await journeys.updateJourney(f.journey.id, f.editor.id, { auto_prepare_recordings: true })).toBeNull();+ await journeys.updateJourney(f.journey.id, f.owner.id, { auto_prepare_recordings: true });+ expect((await findRow(orm, Journeys, { id: f.journey.id }))?.auto_prepare_recordings).toBe(1);+ expect(await prep.listFor(f.owner.id)).toHaveLength(1);++ await journeys.updateJourney(f.journey.id, f.owner.id, { auto_prepare_recordings: false });+ expect(await prep.listFor(f.owner.id)).toEqual([]);+ });+});diff --git a/server/tests/unit/nest/dawarich-sync.service.test.ts b/server/tests/unit/nest/dawarich-sync.service.test.tsindex cc1fb3c3e..b03157ee9 100644--- a/server/tests/unit/nest/dawarich-sync.service.test.ts+++ b/server/tests/unit/nest/dawarich-sync.service.test.ts@@ -29,6 +29,7 @@ import { DawarichSyncService } from '../../../src/nest/integrations/dawarich-synimport { DawarichError } from '../../../src/nest/integrations/dawarich.client';import type { DawarichClient, DawarichCreds, DawarichVisitRaw } from '../../../src/nest/integrations/dawarich.client';import type { DawarichService } from '../../../src/nest/integrations/dawarich.service';+import type { JourneyRecordingPrepService } from '../../../src/nest/journey/journey-recording-prep.service';import {createTestDawarichConnectionsRepo,createTestDawarichVisitSuggestionsRepo,@@ -120,6 +121,9 @@ const dawarich = {probeCapabilities,} as unknown as DawarichService;+/** No journey prepares its days here; dawarich-sync-journeys.service.test.ts covers that half. */+const noJourneysToPrepare = { listFor: async () => [], record: vi.fn() } as unknown as JourneyRecordingPrepService;+// Direct construction over the shared test connection — no TestingModule// (repo convention for DI-native service unit tests).let t: TestOrm;@@ -264,6 +268,7 @@ beforeAll(async () => {bucketList,connections,await createTestUnitOfWork(testDb),+ noJourneysToPrepare,);});diff --git a/server/tests/unit/nest/journey-recordings.controller.test.ts b/server/tests/unit/nest/journey-recordings.controller.test.tsindex 96b00d7a6..823ae3321 100644--- a/server/tests/unit/nest/journey-recordings.controller.test.ts+++ b/server/tests/unit/nest/journey-recordings.controller.test.ts@@ -25,6 +25,7 @@ function controllerWith() {preview: vi.fn(async () => ({ date: '2026-05-14' })),save: vi.fn(async () => ({ outcome: 'created' })),remove: vi.fn(async () => undefined),+ prepStatus: vi.fn(async () => ({ enabled: true })),};return {service,@@ -42,6 +43,7 @@ describe('JourneyRecordingsController', () => {});const routes = [['list', RequestMethod.GET, '/', undefined],+ ['prep', RequestMethod.GET, 'prep', undefined],['preview', RequestMethod.POST, 'preview', 200],['save', RequestMethod.PUT, ':date', undefined],['remove', RequestMethod.DELETE, ':date', 200],@@ -90,4 +92,11 @@ describe('JourneyRecordingsController', () => {expect(service.remove).not.toHaveBeenCalled();expect(service.save).not.toHaveBeenCalled();});++ it('JRNREC-CTL-004: asks the service how the journey is prepared for the caller (JRN-03)', async () => {+ const { service, controller } = controllerWith();++ expect(await controller.prep(user, '9')).toEqual({ enabled: true });+ expect(service.prepStatus).toHaveBeenCalledExactlyOnceWith(4, 9);+ });});diff --git a/server/tests/unit/nest/journey-recordings.mcp.test.ts b/server/tests/unit/nest/journey-recordings.mcp.test.tsindex 6c51da572..9216e73cd 100644--- a/server/tests/unit/nest/journey-recordings.mcp.test.ts+++ b/server/tests/unit/nest/journey-recordings.mcp.test.ts@@ -161,19 +161,33 @@ describe('JourneyRecordingsMcp', () => {return entry.options;};const enabled = vi.spyOn(t.get(AddonsService), 'isAddonEnabled').mockResolvedValue(true);- const ALL = ['listRecordedDays', 'deleteRecordedDay', 'previewRecordedDay', 'saveRecordedDay'];+ const ALL = ['listRecordedDays', 'deleteRecordedDay', 'previewRecordedDay', 'saveRecordedDay', 'getRecordingPrep'];const gates = () => Promise.all(ALL.map((name) => options(name).when?.(ctx(1), mcp)));- expect(await gates()).toEqual([true, true, true, true]);+ expect(await gates()).toEqual([true, true, true, true, true]);enabled.mockImplementation(async (id: string) => id !== 'dawarich');- expect(await gates()).toEqual([true, true, false, false]);+ expect(await gates()).toEqual([true, true, false, false, false]);enabled.mockImplementation(async (id: string) => id !== 'journey');- expect(await gates()).toEqual([false, false, false, false]);+ expect(await gates()).toEqual([false, false, false, false, false]);expect(options('listRecordedDays').access).toEqual({ group: 'journey', mode: 'read' });expect(options('previewRecordedDay').access).toEqual({ group: 'journey', mode: 'read' });expect(options('saveRecordedDay').access).toEqual({ group: 'journey', mode: 'write' });expect(options('deleteRecordedDay').access).toEqual({ group: 'journey', mode: 'write' });+ expect(options('getRecordingPrep').access).toEqual({ group: 'journey', mode: 'read' });+ });++ it('JRNREC-MCP-004: reads how the journey prepares its days for the caller, and refuses a reader as REST does', async () => {+ const f = await fixture();++ expect(read(await mcp.getRecordingPrep({ journeyId: f.journey.id }, ctx(f.owner.id)))).toEqual({+ enabled: false,+ connection: 'not_connected',+ lastAttemptAt: null,+ lastSuccessAt: null,+ lastError: null,+ });+ await expect(mcp.getRecordingPrep({ journeyId: f.journey.id }, ctx(f.viewer.id))).rejects.toThrow('Not allowed');});});diff --git a/server/tests/unit/nest/journey-recordings.service.test.ts b/server/tests/unit/nest/journey-recordings.service.test.tsindex cfafdf91e..e29a5953f 100644--- a/server/tests/unit/nest/journey-recordings.service.test.ts+++ b/server/tests/unit/nest/journey-recordings.service.test.ts@@ -8,18 +8,22 @@* which journey and day and who would see it; a save keeps exactly the day* that was previewed, once, replaces a different version only when asked and* never touches an entry; a failed read keeps the version the journey had;- * reading and removing kept days need no Dawarich at all.+ * reading and removing kept days need no Dawarich at all. The status of+ * preparing the days (JRN-03) is the caller's own and only for editors.*/+import { DawarichConnections } from '../../../src/db/entities/DawarichConnections.entity';import { JourneyEntries } from '../../../src/db/entities/JourneyEntries.entity';import { JourneyRecordedDays } from '../../../src/db/entities/JourneyRecordedDays.entity';import { DomainError } from '../../../src/nest/common/domain-error';import { DawarichTracksService, type RecordedDayFetch } from '../../../src/nest/integrations/dawarich-tracks.service';import { JourneyRecordingsModule } from '../../../src/nest/journey-recordings/journey-recordings.module';import { JourneyRecordingsService } from '../../../src/nest/journey-recordings/journey-recordings.service';+import { JourneyDomainService } from '../../../src/nest/journey/journey-domain.service';import { JourneyRecordedDaysService } from '../../../src/nest/journey/journey-recorded-days.service';+import { JourneyRecordingPrepService } from '../../../src/nest/journey/journey-recording-prep.service';import { createSnapshotTestDb } from '../../helpers/db-mock';import { addJourneyContributor, makeJourney, makeJourneyEntry } from '../../helpers/factories/journeys';-import { countRows, findRow } from '../../helpers/factories/rows';+import { countRows, findRow, upsertRow } from '../../helpers/factories/rows';import { setAddonEnabled } from '../../helpers/factories/settings';import { makeUser } from '../../helpers/factories/users';import { resetTestDb } from '../../helpers/test-db';@@ -373,3 +377,58 @@ describe('JourneyRecordingsService.list and remove', () => {});});});++describe('JourneyRecordingsService.prepStatus', () => {+ it('JRNREC-SVC-014: says whether the journey prepares its days and what the connection of the caller allows', async () => {+ const f = await fixture();+ expect(await svc.prepStatus(f.editor.id, f.journey.id)).toEqual({+ enabled: false,+ connection: 'not_connected',+ lastAttemptAt: null,+ lastSuccessAt: null,+ lastError: null,+ });++ await t+ .get(JourneyRecordingPrepService)+ .record(f.journey.id, f.editor.id, 'unreachable', new Date('2026-05-14T08:00:00Z'));+ await upsertRow(orm, DawarichConnections, {+ user: f.editor.id,+ url: 'https://dawarich.test',+ api_key: 'k',+ sync_enabled: 0,+ });+ expect(await svc.prepStatus(f.editor.id, f.journey.id)).toEqual({+ enabled: false,+ connection: 'sync_off',+ lastAttemptAt: '2026-05-14T08:00:00.000Z',+ lastSuccessAt: null,+ lastError: 'unreachable',+ });+ });++ it('JRNREC-SVC-015: the switch of the owner and a connection with its background sync on read as ready', async () => {+ const f = await fixture();+ await t.get(JourneyDomainService).updateJourney(f.journey.id, f.owner.id, { auto_prepare_recordings: true });+ await upsertRow(orm, DawarichConnections, {+ user: f.owner.id,+ url: 'https://dawarich.test',+ api_key: 'k',+ sync_enabled: 1,+ });++ expect(await svc.prepStatus(f.owner.id, f.journey.id)).toMatchObject({ enabled: true, connection: 'ready' });+ });++ it('JRNREC-SVC-016: a reader, a stranger and a switched off Dawarich are refused as the other routes refuse them', async () => {+ const f = await fixture();++ expect((await refusal(svc.prepStatus(f.viewer.id, f.journey.id))).status).toBe(403);+ expect((await refusal(svc.prepStatus(f.outsider.id, f.journey.id))).status).toBe(404);+ await setAddonEnabled(orm, 'dawarich', false);+ expect(await refusal(svc.prepStatus(f.owner.id, f.journey.id))).toMatchObject({+ status: 404,+ body: { code: 'addon_disabled' },+ });+ });+});diff --git a/shared/src/i18n/ar/journey.ts b/shared/src/i18n/ar/journey.tsindex e91d36da6..877cb7b27 100644--- a/shared/src/i18n/ar/journey.ts+++ b/shared/src/i18n/ar/journey.ts@@ -265,6 +265,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'مسارات GPX','journey.settings.showTripTracks': 'إظهار جميع مسارات GPX للرحلات','journey.settings.showTripTracksHint': 'يرسم على الخريطة المسارات المسجَّلة من الرحلات المرتبطة.',+ 'journey.settings.autoPrepare': 'تحضير الأيام المسجلة تلقائيًا',+ 'journey.settings.autoPrepareHint':+ 'ما دامت رحلة مرتبطة جارية، تنتظر محطات التوقف من Dawarich الخاص بك عند يومها لتراجعها. يحصل المحررون الذين لديهم اتصالهم الخاص على محطاتهم. لا يُكتب شيء في اليومية من تلقاء نفسه.','journey.settings.status': 'الحالة','journey.settings.statusAuto': 'تلقائي','journey.settings.statusAutoHint': 'يتبع تواريخ الرحلات المرتبطة. بدون رحلة تبقى الرحلة مسودة.',@@ -901,5 +904,20 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'لم يستجب Dawarich: {reason} تُعرض محطات التوقف التي يعرفها TREK بالفعل.','journey.dayImport.truncated': 'أرسل Dawarich جزءًا من هذا اليوم فقط. قد تكون بعض محطات التوقف مفقودة.','journey.dayImport.empty': 'لم يجد Dawarich أي محطات توقف في هذا اليوم.',+ 'journey.prep.lastSuccess': 'آخر جلب {time}.',+ 'journey.prep.never': 'لم يتم الجلب بعد. ستبدأ المزامنة التالية في الخلفية ذلك.',+ 'journey.prep.failed': 'فشل التحديث الأخير: {reason} يُعرض ما جُلب {time}.',+ 'journey.prep.failedNever': 'فشل الجلب الأول: {reason}',+ 'journey.prep.notConnected': 'اربط Dawarich في إعداداتك حتى يمكن تحضير أيامك.',+ 'journey.prep.noPeriods': 'اربط رحلة لها تواريخ: تُحضَّر أيامها فقط.',+ 'journey.prep.syncOff': 'المزامنة في الخلفية متوقفة في إعدادات Dawarich، لذا تُجلب الأيام فقط عندما تطلب ذلك.',+ 'journey.prep.fetchNow': 'اجلب الآن',+ 'journey.prep.fetching': 'جارٍ الجلب…',+ 'journey.prep.fetchFailed': 'تعذّر سؤال Dawarich الآن.',+ 'journey.prep.dayRunning': 'اليوم لم ينتهِ بعد، قد تتبعه محطات توقف أخرى.',+ 'journey.prep.dayPending': 'لم يتم الجلب بعد.',+ 'journey.prep.dayProvisional': 'جُلب {time} قبل انتهاء اليوم، لذا قد تكون بعض محطات التوقف مفقودة.',+ 'journey.prep.dayFailed': 'فشل التحديث الأخير، هذه هي الحالة الأقدم.',+ 'journey.dayImport.running': 'هذا اليوم لم ينتهِ بعد. تظهر محطات التوقف المسجلة لاحقًا بمجرد أن تصل إلى Dawarich.',};export default journey;diff --git a/shared/src/i18n/az/journey.ts b/shared/src/i18n/az/journey.tsindex 0f3469f60..3d426fe89 100644--- a/shared/src/i18n/az/journey.ts+++ b/shared/src/i18n/az/journey.ts@@ -241,6 +241,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX izləri','journey.settings.showTripTracks': 'Bütün səyahət GPX izlərini göstər','journey.settings.showTripTracksHint': 'Əlaqələndirilmiş səyahətlərdə qeydə alınmış marşrutları xəritədə göstərir.',+ 'journey.settings.autoPrepare': 'Qeydə alınmış günləri avtomatik hazırla',+ 'journey.settings.autoPrepareHint':+ 'Bağlı səyahət davam etdikcə Dawarich-dəki dayanacaqların öz günlərində yoxlamanı gözləyir. Öz bağlantısı olan redaktorlar özlərininkini alır. Jurnala heç nə öz-özünə yazılmır.','journey.settings.status': 'Status','journey.settings.statusAuto': 'Avtomatik','journey.settings.statusAutoHint': 'Bağlı səfərlərin tarixlərinə uyğunlaşır. Səfər olmadan jurnal qaralama qalır.',@@ -909,5 +912,21 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich cavab vermədi: {reason} TREK-in artıq bildiyi dayanacaqlar göstərilir.','journey.dayImport.truncated': 'Dawarich bu günün yalnız bir hissəsini göndərdi. Bəzi dayanacaqlar çatışmaya bilər.','journey.dayImport.empty': 'Dawarich bu gün heç bir dayanacaq tapmadı.',+ 'journey.prep.lastSuccess': 'Son yükləmə: {time}.',+ 'journey.prep.never': 'Hələ yüklənməyib. Növbəti fon sinxronizasiyası bunu başladacaq.',+ 'journey.prep.failed': 'Son yeniləmə alınmadı: {reason} {time} yüklənən vəziyyət göstərilir.',+ 'journey.prep.failedNever': 'İlk yükləmə alınmadı: {reason}',+ 'journey.prep.notConnected': 'Günlərinin hazırlanması üçün ayarlarda Dawarich-i qoş.',+ 'journey.prep.noPeriods': 'Tarixli səyahət bağla: yalnız onun günləri hazırlanır.',+ 'journey.prep.syncOff': 'Dawarich ayarlarında fon sinxronizasiyası söndürülüb, günlər yalnız sən istədikdə yüklənir.',+ 'journey.prep.fetchNow': 'İndi yüklə',+ 'journey.prep.fetching': 'Yüklənir…',+ 'journey.prep.fetchFailed': 'Hazırda Dawarich-ə müraciət etmək mümkün olmadı.',+ 'journey.prep.dayRunning': 'Gün hələ davam edir, başqa dayanacaqlar da gələ bilər.',+ 'journey.prep.dayPending': 'Hələ yüklənməyib.',+ 'journey.prep.dayProvisional': '{time} yükləndi, gün bitməmiş, dayanacaqlar çatışmaya bilər.',+ 'journey.prep.dayFailed': 'Son yeniləmə alınmadı, bu köhnə vəziyyətdir.',+ 'journey.dayImport.running':+ 'Bu gün hələ davam edir. Sonra qeydə alınan dayanacaqlar Dawarich-də olan kimi görünəcək.',};export default journey;diff --git a/shared/src/i18n/br/journey.ts b/shared/src/i18n/br/journey.tsindex 730a4329d..42a8fa407 100644--- a/shared/src/i18n/br/journey.ts+++ b/shared/src/i18n/br/journey.ts@@ -204,6 +204,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'Trilhas GPX','journey.settings.showTripTracks': 'Mostrar todas as trilhas GPX das viagens','journey.settings.showTripTracksHint': 'Desenha no mapa as rotas gravadas das viagens vinculadas.',+ 'journey.settings.autoPrepare': 'Preparar dias gravados automaticamente',+ 'journey.settings.autoPrepareHint':+ 'Enquanto uma viagem vinculada está em andamento, as paradas do seu Dawarich esperam no dia delas pela sua revisão. Editores com conexão própria recebem as deles. Nada é escrito no diário sozinho.','journey.settings.status': 'Status','journey.settings.statusAuto': 'Automático','journey.settings.statusAutoHint':@@ -836,5 +839,22 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'O Dawarich não respondeu: {reason} Mostrando as paradas que o TREK já conhece.','journey.dayImport.truncated': 'O Dawarich enviou só parte deste dia. Podem faltar paradas.','journey.dayImport.empty': 'O Dawarich não encontrou paradas neste dia.',+ 'journey.prep.lastSuccess': 'Última busca {time}.',+ 'journey.prep.never': 'Ainda não buscado. A próxima sincronização em segundo plano começa.',+ 'journey.prep.failed': 'A última atualização falhou: {reason} Mostrando o que foi buscado {time}.',+ 'journey.prep.failedNever': 'A primeira busca falhou: {reason}',+ 'journey.prep.notConnected': 'Conecte o Dawarich nas suas configurações para que seus dias sejam preparados.',+ 'journey.prep.noPeriods': 'Vincule uma viagem com datas: só os dias dela são preparados.',+ 'journey.prep.syncOff':+ 'A sincronização em segundo plano está desligada nas suas configurações do Dawarich, os dias só são buscados quando você pede.',+ 'journey.prep.fetchNow': 'Buscar agora',+ 'journey.prep.fetching': 'Buscando…',+ 'journey.prep.fetchFailed': 'Não foi possível consultar o Dawarich agora.',+ 'journey.prep.dayRunning': 'O dia ainda está em andamento, mais paradas podem vir.',+ 'journey.prep.dayPending': 'Ainda não buscado.',+ 'journey.prep.dayProvisional': 'Buscado {time}, antes do fim do dia, podem faltar paradas.',+ 'journey.prep.dayFailed': 'A última atualização falhou, este é o estado anterior.',+ 'journey.dayImport.running':+ 'Este dia ainda está em andamento. Paradas gravadas depois aparecem assim que o Dawarich as tiver.',};export default journey;diff --git a/shared/src/i18n/ca/journey.ts b/shared/src/i18n/ca/journey.tsindex 98ea68c84..dc2078fbf 100644--- a/shared/src/i18n/ca/journey.ts+++ b/shared/src/i18n/ca/journey.ts@@ -204,6 +204,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'Traces GPX','journey.settings.showTripTracks': 'Mostra totes les traces GPX dels viatges','journey.settings.showTripTracksHint': 'Dibuixa al mapa les rutes enregistrades dels viatges enllaçats.',+ 'journey.settings.autoPrepare': 'Prepara automàticament els dies enregistrats',+ 'journey.settings.autoPrepareHint':+ "Mentre un viatge enllaçat està en curs, les estades del teu Dawarich esperen al seu dia que les revisis. Els editors amb connexió pròpia reben les seves. No s'escriu res al diari sol.",'journey.settings.status': 'Estat','journey.settings.statusAuto': 'Automàtic','journey.settings.statusAutoHint':@@ -840,5 +843,22 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich no ha respost: {reason} Es mostren les estades que TREK ja coneix.','journey.dayImport.truncated': 'Dawarich només ha enviat una part d’aquest dia. Pot ser que faltin estades.','journey.dayImport.empty': 'Dawarich no ha trobat estades en aquest dia.',+ 'journey.prep.lastSuccess': 'Última consulta {time}.',+ 'journey.prep.never': 'Encara no consultat. La propera sincronització en segon pla ho inicia.',+ 'journey.prep.failed': "L'última actualització ha fallat: {reason} Es mostra el que es va consultar {time}.",+ 'journey.prep.failedNever': 'La primera consulta ha fallat: {reason}',+ 'journey.prep.notConnected': 'Connecta Dawarich a la configuració perquè es preparin els teus dies.',+ 'journey.prep.noPeriods': 'Enllaça un viatge amb dates: només es preparen els seus dies.',+ 'journey.prep.syncOff':+ 'La sincronització en segon pla està desactivada a la configuració de Dawarich, els dies només es consulten quan ho demanes.',+ 'journey.prep.fetchNow': 'Consulta ara',+ 'journey.prep.fetching': 'Consultant…',+ 'journey.prep.fetchFailed': "Ara mateix no s'ha pogut consultar Dawarich.",+ 'journey.prep.dayRunning': 'El dia encara no ha acabat, poden arribar més estades.',+ 'journey.prep.dayPending': 'Encara no consultat.',+ 'journey.prep.dayProvisional': 'Consultat {time}, abans que acabés el dia, poden faltar estades.',+ 'journey.prep.dayFailed': "L'última actualització ha fallat, aquest és l'estat anterior.",+ 'journey.dayImport.running':+ 'Aquest dia encara no ha acabat. Les estades enregistrades més tard apareixen tan bon punt Dawarich les tingui.',};export default journey;diff --git a/shared/src/i18n/cs/journey.ts b/shared/src/i18n/cs/journey.tsindex 9ca5376e1..c3903d6c5 100644--- a/shared/src/i18n/cs/journey.ts+++ b/shared/src/i18n/cs/journey.ts@@ -209,6 +209,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'Stopy GPX','journey.settings.showTripTracks': 'Zobrazit všechny GPX stopy z cest','journey.settings.showTripTracksHint': 'Vykreslí na mapě zaznamenané trasy z propojených cest.',+ 'journey.settings.autoPrepare': 'Automaticky připravovat zaznamenané dny',+ 'journey.settings.autoPrepareHint':+ 'Dokud propojená cesta probíhá, čekají pobyty z tvého Dawarich u svého dne na kontrolu. Editoři s vlastním připojením dostanou své. Do deníku se nic nezapíše samo.','journey.settings.status': 'Stav','journey.settings.statusAuto': 'Automaticky','journey.settings.statusAutoHint': 'Řídí se daty propojených výletů. Bez výletu zůstane deník konceptem.',@@ -849,5 +852,22 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich neodpověděl: {reason} Zobrazují se pobyty, které TREK už zná.','journey.dayImport.truncated': 'Dawarich poslal jen část tohoto dne. Některé pobyty mohou chybět.','journey.dayImport.empty': 'Dawarich v tento den nenašel žádné pobyty.',+ 'journey.prep.lastSuccess': 'Naposledy načteno {time}.',+ 'journey.prep.never': 'Zatím nenačteno. Spustí to příští synchronizace na pozadí.',+ 'journey.prep.failed': 'Poslední obnovení selhalo: {reason} Zobrazuje se stav načtený {time}.',+ 'journey.prep.failedNever': 'První načtení selhalo: {reason}',+ 'journey.prep.notConnected': 'Připoj Dawarich v nastavení, aby se tvé dny mohly připravit.',+ 'journey.prep.noPeriods': 'Propoj cestu s daty: připravují se jen její dny.',+ 'journey.prep.syncOff':+ 'Synchronizace na pozadí je v nastavení Dawarich vypnutá, dny se načítají jen na tvou žádost.',+ 'journey.prep.fetchNow': 'Načíst teď',+ 'journey.prep.fetching': 'Načítá se…',+ 'journey.prep.fetchFailed': 'Dawarich se teď nepodařilo kontaktovat.',+ 'journey.prep.dayRunning': 'Den ještě probíhá, mohou přibýt další pobyty.',+ 'journey.prep.dayPending': 'Zatím nenačteno.',+ 'journey.prep.dayProvisional': 'Načteno {time}, před koncem dne, některé pobyty mohou chybět.',+ 'journey.prep.dayFailed': 'Poslední obnovení selhalo, toto je starší stav.',+ 'journey.dayImport.running':+ 'Tento den ještě probíhá. Později zaznamenané pobyty se objeví, jakmile je Dawarich bude mít.',};export default journey;diff --git a/shared/src/i18n/de/journey.ts b/shared/src/i18n/de/journey.tsindex ae6ebebf7..07215d8e3 100644--- a/shared/src/i18n/de/journey.ts+++ b/shared/src/i18n/de/journey.ts@@ -212,6 +212,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX-Tracks','journey.settings.showTripTracks': 'Alle GPX-Tracks der Reisen anzeigen','journey.settings.showTripTracksHint': 'Zeichnet die aufgezeichneten Routen der verknüpften Reisen auf die Karte.',+ 'journey.settings.autoPrepare': 'Aufgezeichnete Tage automatisch vorbereiten',+ 'journey.settings.autoPrepareHint':+ 'Solange eine verknüpfte Reise läuft, warten die Aufenthalte aus deinem Dawarich an ihrem Tag auf deine Prüfung. Mitschreibende mit eigener Verbindung bekommen ihre eigenen. Ins Journal wird nichts von selbst geschrieben.','journey.settings.status': 'Status','journey.settings.statusAuto': 'Automatisch','journey.settings.statusAutoHint':@@ -844,5 +847,22 @@ const journey: TranslationStrings = {'Dawarich hat nicht geantwortet: {reason} Gezeigt werden die Aufenthalte, die TREK schon kennt.','journey.dayImport.truncated': 'Dawarich hat nur einen Teil dieses Tages geliefert. Es können Aufenthalte fehlen.','journey.dayImport.empty': 'Dawarich hat an diesem Tag keine Aufenthalte erkannt.',+ 'journey.prep.lastSuccess': 'Zuletzt abgerufen {time}.',+ 'journey.prep.never': 'Noch nicht abgerufen. Der nächste Hintergrundabgleich startet es.',+ 'journey.prep.failed': 'Die letzte Aktualisierung ist fehlgeschlagen: {reason} Angezeigt wird der Stand von {time}.',+ 'journey.prep.failedNever': 'Der erste Abruf ist fehlgeschlagen: {reason}',+ 'journey.prep.notConnected': 'Verbinde Dawarich in deinen Einstellungen, damit deine Tage vorbereitet werden.',+ 'journey.prep.noPeriods': 'Verknüpfe eine Reise mit Datum: Nur ihre Tage werden vorbereitet.',+ 'journey.prep.syncOff':+ 'Der Hintergrundabgleich ist in deinen Dawarich-Einstellungen aus, Tage werden nur auf deinen Wunsch abgerufen.',+ 'journey.prep.fetchNow': 'Jetzt abrufen',+ 'journey.prep.fetching': 'Wird abgerufen…',+ 'journey.prep.fetchFailed': 'Dawarich konnte gerade nicht gefragt werden.',+ 'journey.prep.dayRunning': 'Der Tag läuft noch, es können weitere Aufenthalte folgen.',+ 'journey.prep.dayPending': 'Noch nicht abgerufen.',+ 'journey.prep.dayProvisional': 'Abgerufen {time}, vor Tagesende, es können Aufenthalte fehlen.',+ 'journey.prep.dayFailed': 'Die letzte Aktualisierung ist fehlgeschlagen, das ist der ältere Stand.',+ 'journey.dayImport.running':+ 'Dieser Tag läuft noch. Später aufgezeichnete Aufenthalte erscheinen, sobald Dawarich sie hat.',};export default journey;diff --git a/shared/src/i18n/en/journey.ts b/shared/src/i18n/en/journey.tsindex 30597f451..589fdc24e 100644--- a/shared/src/i18n/en/journey.ts+++ b/shared/src/i18n/en/journey.ts@@ -220,6 +220,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX Tracks','journey.settings.showTripTracks': 'Show all trip GPX tracks','journey.settings.showTripTracksHint': 'Draws the recorded routes from the linked trips on the map.',+ 'journey.settings.autoPrepare': 'Prepare recorded days automatically',+ 'journey.settings.autoPrepareHint':+ 'While a linked trip runs, the stays from your Dawarich wait at their day for review. Editors with their own connection get theirs. Nothing is written to the journal on its own.','journey.settings.status': 'Status','journey.settings.statusAuto': 'Automatic','journey.settings.statusAutoHint': 'Follows the dates of the linked trips. Without a trip the journey stays a draft.',@@ -829,5 +832,20 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich did not answer: {reason} Showing the stays TREK knows already.','journey.dayImport.truncated': 'Dawarich sent only part of this day. Some stays may be missing.','journey.dayImport.empty': 'Dawarich found no stays on this day.',+ 'journey.prep.lastSuccess': 'Last fetched {time}.',+ 'journey.prep.never': 'Not fetched yet. The next background sync starts it.',+ 'journey.prep.failed': 'The last refresh failed: {reason} Showing what was fetched {time}.',+ 'journey.prep.failedNever': 'The first fetch failed: {reason}',+ 'journey.prep.notConnected': 'Connect Dawarich in your settings so your days can be prepared.',+ 'journey.prep.noPeriods': 'Link a trip with dates: only its days are prepared.',+ 'journey.prep.syncOff': 'Background sync is off in your Dawarich settings, so days are only fetched when you ask.',+ 'journey.prep.fetchNow': 'Fetch now',+ 'journey.prep.fetching': 'Fetching…',+ 'journey.prep.fetchFailed': 'Dawarich could not be asked right now.',+ 'journey.prep.dayRunning': 'The day is still running, more stays may follow.',+ 'journey.prep.dayPending': 'Not fetched yet.',+ 'journey.prep.dayProvisional': 'Fetched {time}, before the day ended, so stays may be missing.',+ 'journey.prep.dayFailed': 'The last refresh failed, this is the older state.',+ 'journey.dayImport.running': 'This day is still running. Stays recorded later show up once Dawarich has them.',};export default journey;diff --git a/shared/src/i18n/es/journey.ts b/shared/src/i18n/es/journey.tsindex 371c7ee5f..2dd899106 100644--- a/shared/src/i18n/es/journey.ts+++ b/shared/src/i18n/es/journey.ts@@ -204,6 +204,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'Rutas GPX','journey.settings.showTripTracks': 'Mostrar todas las rutas GPX de los viajes','journey.settings.showTripTracksHint': 'Dibuja en el mapa las rutas grabadas de los viajes vinculados.',+ 'journey.settings.autoPrepare': 'Preparar automáticamente los días grabados',+ 'journey.settings.autoPrepareHint':+ 'Mientras un viaje vinculado está en curso, las estancias de tu Dawarich esperan en su día para que las revises. Los editores con su propia conexión reciben las suyas. Nada se escribe en el diario por sí solo.','journey.settings.status': 'Estado','journey.settings.statusAuto': 'Automático','journey.settings.statusAutoHint':@@ -838,5 +841,22 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich no respondió: {reason} Se muestran las estancias que TREK ya conoce.','journey.dayImport.truncated': 'Dawarich solo envió una parte de este día. Puede que falten estancias.','journey.dayImport.empty': 'Dawarich no encontró estancias en este día.',+ 'journey.prep.lastSuccess': 'Última consulta {time}.',+ 'journey.prep.never': 'Aún sin consultar. La próxima sincronización en segundo plano lo inicia.',+ 'journey.prep.failed': 'La última actualización falló: {reason} Se muestra lo consultado {time}.',+ 'journey.prep.failedNever': 'La primera consulta falló: {reason}',+ 'journey.prep.notConnected': 'Conecta Dawarich en tus ajustes para que tus días se preparen.',+ 'journey.prep.noPeriods': 'Vincula un viaje con fechas: solo se preparan sus días.',+ 'journey.prep.syncOff':+ 'La sincronización en segundo plano está desactivada en tus ajustes de Dawarich, los días solo se consultan cuando lo pides.',+ 'journey.prep.fetchNow': 'Consultar ahora',+ 'journey.prep.fetching': 'Consultando…',+ 'journey.prep.fetchFailed': 'No se pudo consultar Dawarich en este momento.',+ 'journey.prep.dayRunning': 'El día aún no ha terminado, pueden llegar más estancias.',+ 'journey.prep.dayPending': 'Aún sin consultar.',+ 'journey.prep.dayProvisional': 'Consultado {time}, antes de que terminara el día, pueden faltar estancias.',+ 'journey.prep.dayFailed': 'La última actualización falló, este es el estado anterior.',+ 'journey.dayImport.running':+ 'Este día aún no ha terminado. Las estancias grabadas más tarde aparecen en cuanto Dawarich las tenga.',};export default journey;diff --git a/shared/src/i18n/et/journey.ts b/shared/src/i18n/et/journey.tsindex ca5fda6fc..a97fdad1d 100644--- a/shared/src/i18n/et/journey.ts+++ b/shared/src/i18n/et/journey.ts@@ -222,6 +222,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX-rajad','journey.settings.showTripTracks': 'Näita kõiki reiside GPX-radu','journey.settings.showTripTracksHint': 'Kuvab kaardil seotud reiside salvestatud teekonnad.',+ 'journey.settings.autoPrepare': 'Valmista salvestatud päevad automaatselt ette',+ 'journey.settings.autoPrepareHint':+ 'Kuni lingitud reis kestab, ootavad sinu Dawarichi peatused oma päeva juures ülevaatamist. Oma ühendusega toimetajad saavad enda omad. Päevikusse ei kirjutata midagi iseenesest.','journey.settings.status': 'Olek','journey.settings.statusAuto': 'Automaatne','journey.settings.statusAutoHint': 'Järgib seotud reiside kuupäevi. Ilma reisita jääb teekond mustandiks.',@@ -832,5 +835,21 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich ei vastanud: {reason} Näidatakse peatusi, mida TREK juba teab.','journey.dayImport.truncated': 'Dawarich saatis sellest päevast ainult osa. Mõni peatus võib puududa.','journey.dayImport.empty': 'Dawarich ei leidnud sel päeval ühtegi peatust.',+ 'journey.prep.lastSuccess': 'Viimati laaditud {time}.',+ 'journey.prep.never': 'Veel laadimata. Järgmine taustsünkroonimine alustab seda.',+ 'journey.prep.failed': 'Viimane värskendus ebaõnnestus: {reason} Näidatakse seisu, mis laaditi {time}.',+ 'journey.prep.failedNever': 'Esimene laadimine ebaõnnestus: {reason}',+ 'journey.prep.notConnected': 'Ühenda Dawarich seadetes, et sinu päevi saaks ette valmistada.',+ 'journey.prep.noPeriods': 'Lingi kuupäevadega reis: ette valmistatakse ainult selle päevad.',+ 'journey.prep.syncOff': 'Taustsünkroonimine on sinu Dawarichi seadetes väljas, päevi laaditakse ainult sinu soovil.',+ 'journey.prep.fetchNow': 'Laadi kohe',+ 'journey.prep.fetching': 'Laaditakse…',+ 'journey.prep.fetchFailed': 'Dawarichilt ei õnnestunud praegu küsida.',+ 'journey.prep.dayRunning': 'Päev alles kestab, võib lisanduda peatusi.',+ 'journey.prep.dayPending': 'Veel laadimata.',+ 'journey.prep.dayProvisional': 'Laaditud {time}, enne päeva lõppu, peatusi võib puududa.',+ 'journey.prep.dayFailed': 'Viimane värskendus ebaõnnestus, see on vanem seis.',+ 'journey.dayImport.running':+ 'See päev alles kestab. Hiljem salvestatud peatused ilmuvad kohe, kui Dawarichil need on.',};export default journey;diff --git a/shared/src/i18n/fr/journey.ts b/shared/src/i18n/fr/journey.tsindex 50cdc147b..3ebf30fcb 100644--- a/shared/src/i18n/fr/journey.ts+++ b/shared/src/i18n/fr/journey.ts@@ -205,6 +205,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'Traces GPX','journey.settings.showTripTracks': 'Afficher toutes les traces GPX des voyages','journey.settings.showTripTracksHint': 'Trace sur la carte les itinéraires enregistrés des voyages liés.',+ 'journey.settings.autoPrepare': 'Préparer automatiquement les jours enregistrés',+ 'journey.settings.autoPrepareHint':+ "Tant qu'un voyage lié est en cours, les séjours de votre Dawarich attendent votre vérification à leur jour. Les éditeurs ayant leur propre connexion reçoivent les leurs. Rien n'est écrit dans le journal tout seul.",'journey.settings.status': 'Statut','journey.settings.statusAuto': 'Automatique','journey.settings.statusAutoHint': 'Suit les dates des voyages liés. Sans voyage, le carnet reste un brouillon.',@@ -837,5 +840,22 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': "Dawarich n'a pas répondu : {reason} Affichage des séjours que TREK connaît déjà.",'journey.dayImport.truncated': "Dawarich n'a envoyé qu'une partie de cette journée. Des séjours peuvent manquer.",'journey.dayImport.empty': "Dawarich n'a trouvé aucun séjour ce jour-là.",+ 'journey.prep.lastSuccess': 'Dernière récupération {time}.',+ 'journey.prep.never': "Pas encore récupéré. La prochaine synchronisation en arrière-plan s'en charge.",+ 'journey.prep.failed': "La dernière actualisation a échoué : {reason} Affichage de l'état récupéré {time}.",+ 'journey.prep.failedNever': 'La première récupération a échoué : {reason}',+ 'journey.prep.notConnected': 'Connectez Dawarich dans vos paramètres pour que vos jours soient préparés.',+ 'journey.prep.noPeriods': 'Liez un voyage avec des dates : seuls ses jours sont préparés.',+ 'journey.prep.syncOff':+ "La synchronisation en arrière-plan est désactivée dans vos paramètres Dawarich, les jours ne sont récupérés qu'à votre demande.",+ 'journey.prep.fetchNow': 'Récupérer maintenant',+ 'journey.prep.fetching': 'Récupération…',+ 'journey.prep.fetchFailed': "Impossible d'interroger Dawarich pour le moment.",+ 'journey.prep.dayRunning': "La journée n'est pas terminée, d'autres séjours peuvent suivre.",+ 'journey.prep.dayPending': 'Pas encore récupéré.',+ 'journey.prep.dayProvisional': 'Récupéré {time}, avant la fin de la journée, des séjours peuvent manquer.',+ 'journey.prep.dayFailed': "La dernière actualisation a échoué, ceci est l'état précédent.",+ 'journey.dayImport.running':+ "Cette journée n'est pas terminée. Les séjours enregistrés plus tard apparaissent dès que Dawarich les a.",};export default journey;diff --git a/shared/src/i18n/gr/journey.ts b/shared/src/i18n/gr/journey.tsindex 99256da93..12b136390 100644--- a/shared/src/i18n/gr/journey.ts+++ b/shared/src/i18n/gr/journey.ts@@ -216,6 +216,9 @@ const journey: TranslationStrings = {'journey.settings.showTripTracks': 'Εμφάνιση όλων των διαδρομών GPX των ταξιδιών','journey.settings.showTripTracksHint':'Σχεδιάζει στον χάρτη τις καταγεγραμμένες διαδρομές από τα συνδεδεμένα ταξίδια.',+ 'journey.settings.autoPrepare': 'Αυτόματη προετοιμασία καταγεγραμμένων ημερών',+ 'journey.settings.autoPrepareHint':+ 'Όσο ένα συνδεδεμένο ταξίδι βρίσκεται σε εξέλιξη, οι στάσεις από το Dawarich σου περιμένουν στη μέρα τους για έλεγχο. Οι συντάκτες με δική τους σύνδεση παίρνουν τις δικές τους. Τίποτα δεν γράφεται μόνο του στο ημερολόγιο.','journey.settings.status': 'Κατάσταση','journey.settings.statusAuto': 'Αυτόματα','journey.settings.statusAutoHint':@@ -848,5 +851,22 @@ const journey: TranslationStrings = {'Το Dawarich δεν απάντησε: {reason} Εμφανίζονται οι στάσεις που ήδη γνωρίζει το TREK.','journey.dayImport.truncated': 'Το Dawarich έστειλε μόνο μέρος αυτής της ημέρας. Μπορεί να λείπουν στάσεις.','journey.dayImport.empty': 'Το Dawarich δεν βρήκε στάσεις αυτή την ημέρα.',+ 'journey.prep.lastSuccess': 'Τελευταία λήψη {time}.',+ 'journey.prep.never': 'Δεν έχει γίνει λήψη ακόμη. Ο επόμενος συγχρονισμός στο παρασκήνιο την ξεκινά.',+ 'journey.prep.failed': 'Η τελευταία ανανέωση απέτυχε: {reason} Εμφανίζεται ό,τι λήφθηκε {time}.',+ 'journey.prep.failedNever': 'Η πρώτη λήψη απέτυχε: {reason}',+ 'journey.prep.notConnected': 'Σύνδεσε το Dawarich στις ρυθμίσεις σου ώστε να προετοιμάζονται οι μέρες σου.',+ 'journey.prep.noPeriods': 'Σύνδεσε ένα ταξίδι με ημερομηνίες: προετοιμάζονται μόνο οι μέρες του.',+ 'journey.prep.syncOff':+ 'Ο συγχρονισμός στο παρασκήνιο είναι απενεργοποιημένος στις ρυθμίσεις Dawarich, οι μέρες λαμβάνονται μόνο όταν το ζητάς.',+ 'journey.prep.fetchNow': 'Λήψη τώρα',+ 'journey.prep.fetching': 'Λήψη…',+ 'journey.prep.fetchFailed': 'Δεν ήταν δυνατή η επικοινωνία με το Dawarich αυτή τη στιγμή.',+ 'journey.prep.dayRunning': 'Η μέρα δεν έχει τελειώσει, μπορεί να ακολουθήσουν κι άλλες στάσεις.',+ 'journey.prep.dayPending': 'Δεν έχει γίνει λήψη ακόμη.',+ 'journey.prep.dayProvisional': 'Λήφθηκε {time}, πριν τελειώσει η μέρα, μπορεί να λείπουν στάσεις.',+ 'journey.prep.dayFailed': 'Η τελευταία ανανέωση απέτυχε, αυτή είναι η παλαιότερη κατάσταση.',+ 'journey.dayImport.running':+ 'Αυτή η μέρα δεν έχει τελειώσει. Στάσεις που καταγράφονται αργότερα εμφανίζονται μόλις τις έχει το Dawarich.',};export default journey;diff --git a/shared/src/i18n/hu/journey.ts b/shared/src/i18n/hu/journey.tsindex 5b6ff30f9..ad4f6717e 100644--- a/shared/src/i18n/hu/journey.ts+++ b/shared/src/i18n/hu/journey.ts@@ -204,6 +204,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX-nyomvonalak','journey.settings.showTripTracks': 'Az utazások összes GPX-nyomvonalának megjelenítése','journey.settings.showTripTracksHint': 'A kapcsolt utazások rögzített útvonalait rajzolja a térképre.',+ 'journey.settings.autoPrepare': 'Rögzített napok automatikus előkészítése',+ 'journey.settings.autoPrepareHint':+ 'Amíg egy kapcsolt utazás tart, a Dawarich tartózkodásaid a napjuknál várnak ellenőrzésre. A saját kapcsolattal rendelkező szerkesztők a sajátjukat kapják. A naplóba semmi nem kerül magától.','journey.settings.status': 'Állapot','journey.settings.statusAuto': 'Automatikus','journey.settings.statusAutoHint': 'A kapcsolt utak dátumait követi. Út nélkül a napló piszkozat marad.',@@ -835,5 +838,22 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'A Dawarich nem válaszolt: {reason} A TREK által már ismert tartózkodások látszanak.','journey.dayImport.truncated': 'A Dawarich csak a nap egy részét küldte el. Hiányozhatnak tartózkodások.','journey.dayImport.empty': 'A Dawarich nem talált tartózkodást ezen a napon.',+ 'journey.prep.lastSuccess': 'Utoljára lekérve: {time}.',+ 'journey.prep.never': 'Még nincs lekérve. A következő háttérszinkronizálás elindítja.',+ 'journey.prep.failed': 'A legutóbbi frissítés nem sikerült: {reason} A {time} lekért állapot látható.',+ 'journey.prep.failedNever': 'Az első lekérés nem sikerült: {reason}',+ 'journey.prep.notConnected': 'Kapcsold össze a Dawarichot a beállításokban, hogy a napjaid előkészíthetők legyenek.',+ 'journey.prep.noPeriods': 'Kapcsolj hozzá egy dátumos utazást: csak annak napjai készülnek elő.',+ 'journey.prep.syncOff':+ 'A háttérszinkronizálás ki van kapcsolva a Dawarich-beállításaidban, a napok csak kérésre töltődnek le.',+ 'journey.prep.fetchNow': 'Lekérés most',+ 'journey.prep.fetching': 'Lekérés folyamatban…',+ 'journey.prep.fetchFailed': 'A Dawarich most nem volt elérhető.',+ 'journey.prep.dayRunning': 'A nap még tart, további tartózkodások jöhetnek.',+ 'journey.prep.dayPending': 'Még nincs lekérve.',+ 'journey.prep.dayProvisional': 'Lekérve {time}, a nap vége előtt, hiányozhatnak tartózkodások.',+ 'journey.prep.dayFailed': 'A legutóbbi frissítés nem sikerült, ez a régebbi állapot.',+ 'journey.dayImport.running':+ 'Ez a nap még tart. A később rögzített tartózkodások megjelennek, amint a Dawarich megkapja őket.',};export default journey;diff --git a/shared/src/i18n/id/journey.ts b/shared/src/i18n/id/journey.tsindex 62a450581..3d304b231 100644--- a/shared/src/i18n/id/journey.ts+++ b/shared/src/i18n/id/journey.ts@@ -198,6 +198,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'Jalur GPX','journey.settings.showTripTracks': 'Tampilkan semua jalur GPX perjalanan','journey.settings.showTripTracksHint': 'Menggambar rute terekam dari perjalanan yang tertaut pada peta.',+ 'journey.settings.autoPrepare': 'Siapkan hari yang terekam secara otomatis',+ 'journey.settings.autoPrepareHint':+ 'Selama perjalanan yang ditautkan berlangsung, persinggahan dari Dawarich-mu menunggu di harinya untuk ditinjau. Editor dengan koneksi sendiri mendapatkan miliknya. Tidak ada yang ditulis ke jurnal dengan sendirinya.','journey.settings.status': 'Status','journey.settings.statusAuto': 'Otomatis','journey.settings.statusAutoHint':@@ -815,5 +818,21 @@ const journey: TranslationStrings = {'Dawarich tidak menjawab: {reason} Menampilkan persinggahan yang sudah diketahui TREK.','journey.dayImport.truncated': 'Dawarich hanya mengirim sebagian hari ini. Beberapa persinggahan mungkin hilang.','journey.dayImport.empty': 'Dawarich tidak menemukan persinggahan pada hari ini.',+ 'journey.prep.lastSuccess': 'Terakhir diambil {time}.',+ 'journey.prep.never': 'Belum diambil. Sinkronisasi latar berikutnya akan memulainya.',+ 'journey.prep.failed': 'Penyegaran terakhir gagal: {reason} Menampilkan yang diambil {time}.',+ 'journey.prep.failedNever': 'Pengambilan pertama gagal: {reason}',+ 'journey.prep.notConnected': 'Hubungkan Dawarich di pengaturan agar harimu bisa disiapkan.',+ 'journey.prep.noPeriods': 'Tautkan perjalanan bertanggal: hanya harinya yang disiapkan.',+ 'journey.prep.syncOff': 'Sinkronisasi latar mati di pengaturan Dawarich-mu, hari hanya diambil saat kamu memintanya.',+ 'journey.prep.fetchNow': 'Ambil sekarang',+ 'journey.prep.fetching': 'Mengambil…',+ 'journey.prep.fetchFailed': 'Dawarich tidak bisa ditanya saat ini.',+ 'journey.prep.dayRunning': 'Hari ini masih berlangsung, persinggahan lain mungkin menyusul.',+ 'journey.prep.dayPending': 'Belum diambil.',+ 'journey.prep.dayProvisional': 'Diambil {time}, sebelum hari berakhir, beberapa persinggahan mungkin belum ada.',+ 'journey.prep.dayFailed': 'Penyegaran terakhir gagal, ini keadaan yang lebih lama.',+ 'journey.dayImport.running':+ 'Hari ini masih berlangsung. Persinggahan yang terekam kemudian muncul begitu Dawarich memilikinya.',};export default journey;diff --git a/shared/src/i18n/it/journey.ts b/shared/src/i18n/it/journey.tsindex 817bd9b03..f292dc383 100644--- a/shared/src/i18n/it/journey.ts+++ b/shared/src/i18n/it/journey.ts@@ -204,6 +204,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'Tracce GPX','journey.settings.showTripTracks': 'Mostra tutte le tracce GPX dei viaggi','journey.settings.showTripTracksHint': 'Disegna sulla mappa i percorsi registrati dei viaggi collegati.',+ 'journey.settings.autoPrepare': 'Prepara automaticamente i giorni registrati',+ 'journey.settings.autoPrepareHint':+ 'Finché un viaggio collegato è in corso, le soste del tuo Dawarich aspettano al loro giorno di essere controllate. Gli editor con una connessione propria ricevono le loro. Nel diario non viene scritto nulla da solo.','journey.settings.status': 'Stato','journey.settings.statusAuto': 'Automatico','journey.settings.statusAutoHint': 'Segue le date dei viaggi collegati. Senza viaggio il diario resta una bozza.',@@ -839,5 +842,22 @@ const journey: TranslationStrings = {'journey.dayImport.truncated':'Dawarich ha inviato solo una parte di questa giornata. Alcune soste potrebbero mancare.','journey.dayImport.empty': 'Dawarich non ha trovato soste in questa giornata.',+ 'journey.prep.lastSuccess': 'Ultimo recupero {time}.',+ 'journey.prep.never': 'Non ancora recuperato. Lo avvia la prossima sincronizzazione in background.',+ 'journey.prep.failed': "L'ultimo aggiornamento non è riuscito: {reason} Viene mostrato quanto recuperato {time}.",+ 'journey.prep.failedNever': 'Il primo recupero non è riuscito: {reason}',+ 'journey.prep.notConnected': 'Collega Dawarich nelle impostazioni perché i tuoi giorni vengano preparati.',+ 'journey.prep.noPeriods': 'Collega un viaggio con date: vengono preparati solo i suoi giorni.',+ 'journey.prep.syncOff':+ 'La sincronizzazione in background è disattivata nelle impostazioni di Dawarich, i giorni vengono recuperati solo su tua richiesta.',+ 'journey.prep.fetchNow': 'Recupera ora',+ 'journey.prep.fetching': 'Recupero in corso…',+ 'journey.prep.fetchFailed': 'Al momento non è stato possibile interrogare Dawarich.',+ 'journey.prep.dayRunning': 'La giornata è ancora in corso, possono seguire altre soste.',+ 'journey.prep.dayPending': 'Non ancora recuperato.',+ 'journey.prep.dayProvisional': 'Recuperato {time}, prima della fine della giornata, possono mancare soste.',+ 'journey.prep.dayFailed': "L'ultimo aggiornamento non è riuscito, questo è lo stato precedente.",+ 'journey.dayImport.running':+ 'Questa giornata è ancora in corso. Le soste registrate dopo compaiono appena Dawarich le ha.',};export default journey;diff --git a/shared/src/i18n/ja/journey.ts b/shared/src/i18n/ja/journey.tsindex f4b2671c7..42918421b 100644--- a/shared/src/i18n/ja/journey.ts+++ b/shared/src/i18n/ja/journey.ts@@ -204,6 +204,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPXトラック','journey.settings.showTripTracks': '旅行のGPXトラックをすべて表示','journey.settings.showTripTracksHint': 'リンクされた旅行の記録済みルートを地図に描画します。',+ 'journey.settings.autoPrepare': '記録された日を自動で準備する',+ 'journey.settings.autoPrepareHint':+ 'リンクした旅行の期間中、Dawarich の滞在先はその日のところで確認を待ちます。自分の接続を持つ編集者には各自の滞在先が届きます。ジャーナルに勝手に書き込まれることはありません。','journey.settings.status': 'ステータス','journey.settings.statusAuto': '自動','journey.settings.statusAutoHint': 'リンクした旅行の日付に従います。旅行がない場合は下書きのままです。',@@ -802,5 +805,20 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarichが応答しませんでした: {reason} TREKが把握している滞在先を表示しています。','journey.dayImport.truncated': 'Dawarichはこの日の一部しか送ってきませんでした。滞在先が欠けている可能性があります。','journey.dayImport.empty': 'Dawarichはこの日の滞在先を見つけられませんでした。',+ 'journey.prep.lastSuccess': '最終取得: {time}',+ 'journey.prep.never': 'まだ取得していません。次のバックグラウンド同期で開始します。',+ 'journey.prep.failed': '前回の更新に失敗しました: {reason} {time} に取得した内容を表示しています。',+ 'journey.prep.failedNever': '最初の取得に失敗しました: {reason}',+ 'journey.prep.notConnected': '日を準備できるよう、設定で Dawarich を接続してください。',+ 'journey.prep.noPeriods': '日付のある旅行をリンクしてください。その旅行の日だけが準備されます。',+ 'journey.prep.syncOff': 'Dawarich の設定でバックグラウンド同期がオフのため、日は手動で取得したときだけ取得されます。',+ 'journey.prep.fetchNow': '今すぐ取得',+ 'journey.prep.fetching': '取得中…',+ 'journey.prep.fetchFailed': '今は Dawarich に問い合わせできませんでした。',+ 'journey.prep.dayRunning': 'この日はまだ続いています。滞在先が増える可能性があります。',+ 'journey.prep.dayPending': 'まだ取得していません。',+ 'journey.prep.dayProvisional': '{time} に取得、一日が終わる前なので滞在先が欠けている可能性があります。',+ 'journey.prep.dayFailed': '前回の更新に失敗しました。これは古い状態です。',+ 'journey.dayImport.running': 'この日はまだ続いています。後から記録された滞在先は Dawarich に届き次第表示されます。',};export default journey;diff --git a/shared/src/i18n/ko/journey.ts b/shared/src/i18n/ko/journey.tsindex daed4b6e1..f6d120d0a 100644--- a/shared/src/i18n/ko/journey.ts+++ b/shared/src/i18n/ko/journey.ts@@ -203,6 +203,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX 트랙','journey.settings.showTripTracks': '여행의 모든 GPX 트랙 표시','journey.settings.showTripTracksHint': '연결된 여행의 기록된 경로를 지도에 그립니다.',+ 'journey.settings.autoPrepare': '기록된 날을 자동으로 준비',+ 'journey.settings.autoPrepareHint':+ '연결된 여행이 진행되는 동안 Dawarich의 머문 곳이 해당 날짜에서 확인을 기다립니다. 자기 연결이 있는 편집자는 각자의 머문 곳을 받습니다. 일지에는 아무것도 저절로 기록되지 않습니다.','journey.settings.status': '상태','journey.settings.statusAuto': '자동','journey.settings.statusAutoHint': '연결된 여행의 날짜를 따릅니다. 여행이 없으면 초안으로 남습니다.',@@ -799,5 +802,20 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich가 응답하지 않았습니다: {reason} TREK가 이미 아는 머문 곳을 보여 줍니다.','journey.dayImport.truncated': 'Dawarich가 이 날의 일부만 보냈습니다. 빠진 머문 곳이 있을 수 있습니다.','journey.dayImport.empty': 'Dawarich가 이 날 머문 곳을 찾지 못했습니다.',+ 'journey.prep.lastSuccess': '마지막으로 가져온 시각: {time}',+ 'journey.prep.never': '아직 가져오지 않았습니다. 다음 백그라운드 동기화에서 시작합니다.',+ 'journey.prep.failed': '마지막 새로 고침에 실패했습니다: {reason} {time}에 가져온 내용을 표시합니다.',+ 'journey.prep.failedNever': '첫 가져오기에 실패했습니다: {reason}',+ 'journey.prep.notConnected': '날짜를 준비할 수 있도록 설정에서 Dawarich를 연결하세요.',+ 'journey.prep.noPeriods': '날짜가 있는 여행을 연결하세요. 그 여행의 날짜만 준비됩니다.',+ 'journey.prep.syncOff': 'Dawarich 설정에서 백그라운드 동기화가 꺼져 있어 요청할 때만 가져옵니다.',+ 'journey.prep.fetchNow': '지금 가져오기',+ 'journey.prep.fetching': '가져오는 중…',+ 'journey.prep.fetchFailed': '지금은 Dawarich에 요청할 수 없습니다.',+ 'journey.prep.dayRunning': '아직 진행 중인 날입니다. 머문 곳이 더 생길 수 있습니다.',+ 'journey.prep.dayPending': '아직 가져오지 않았습니다.',+ 'journey.prep.dayProvisional': '{time}에 가져옴, 하루가 끝나기 전이라 머문 곳이 빠졌을 수 있습니다.',+ 'journey.prep.dayFailed': '마지막 새로 고침에 실패했습니다. 이전 상태입니다.',+ 'journey.dayImport.running': '아직 진행 중인 날입니다. 나중에 기록된 머문 곳은 Dawarich에 들어오는 대로 표시됩니다.',};export default journey;diff --git a/shared/src/i18n/nl/journey.ts b/shared/src/i18n/nl/journey.tsindex 5264cbe38..5926a0fc5 100644--- a/shared/src/i18n/nl/journey.ts+++ b/shared/src/i18n/nl/journey.ts@@ -205,6 +205,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX-tracks','journey.settings.showTripTracks': 'Alle GPX-tracks van reizen tonen','journey.settings.showTripTracksHint': 'Tekent de opgenomen routes van de gekoppelde reizen op de kaart.',+ 'journey.settings.autoPrepare': 'Opgenomen dagen automatisch voorbereiden',+ 'journey.settings.autoPrepareHint':+ 'Zolang een gekoppelde reis loopt, wachten de verblijven uit je Dawarich bij hun dag op je controle. Bewerkers met een eigen verbinding krijgen die van hen. Er wordt niets vanzelf in het dagboek geschreven.','journey.settings.status': 'Status','journey.settings.statusAuto': 'Automatisch','journey.settings.statusAutoHint':@@ -840,5 +843,21 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich antwoordde niet: {reason} Je ziet de verblijven die TREK al kent.','journey.dayImport.truncated': 'Dawarich stuurde maar een deel van deze dag. Er kunnen verblijven ontbreken.','journey.dayImport.empty': 'Dawarich vond op deze dag geen verblijven.',+ 'journey.prep.lastSuccess': 'Laatst opgehaald {time}.',+ 'journey.prep.never': 'Nog niet opgehaald. De volgende synchronisatie op de achtergrond start het.',+ 'journey.prep.failed': 'De laatste verversing is mislukt: {reason} Getoond wordt wat {time} is opgehaald.',+ 'journey.prep.failedNever': 'Het eerste ophalen is mislukt: {reason}',+ 'journey.prep.notConnected': 'Koppel Dawarich in je instellingen zodat je dagen worden voorbereid.',+ 'journey.prep.noPeriods': 'Koppel een reis met datums: alleen de dagen daarvan worden voorbereid.',+ 'journey.prep.syncOff':+ 'Synchronisatie op de achtergrond staat uit in je Dawarich-instellingen, dagen worden alleen opgehaald als je erom vraagt.',+ 'journey.prep.fetchNow': 'Nu ophalen',+ 'journey.prep.fetching': 'Bezig met ophalen…',+ 'journey.prep.fetchFailed': 'Dawarich kon nu niet worden bevraagd.',+ 'journey.prep.dayRunning': 'De dag loopt nog, er kunnen meer verblijven volgen.',+ 'journey.prep.dayPending': 'Nog niet opgehaald.',+ 'journey.prep.dayProvisional': 'Opgehaald {time}, voor het einde van de dag, er kunnen verblijven ontbreken.',+ 'journey.prep.dayFailed': 'De laatste verversing is mislukt, dit is de oudere stand.',+ 'journey.dayImport.running': 'Deze dag loopt nog. Later opgenomen verblijven verschijnen zodra Dawarich ze heeft.',};export default journey;diff --git a/shared/src/i18n/pl/journey.ts b/shared/src/i18n/pl/journey.tsindex 8aad9fc48..ba50945b7 100644--- a/shared/src/i18n/pl/journey.ts+++ b/shared/src/i18n/pl/journey.ts@@ -214,6 +214,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'Ślady GPX','journey.settings.showTripTracks': 'Pokaż wszystkie ślady GPX z podróży','journey.settings.showTripTracksHint': 'Rysuje na mapie zapisane trasy z powiązanych podróży.',+ 'journey.settings.autoPrepare': 'Automatycznie przygotowuj zarejestrowane dni',+ 'journey.settings.autoPrepareHint':+ 'Dopóki powiązana podróż trwa, postoje z twojego Dawarich czekają przy swoim dniu na przejrzenie. Edytorzy z własnym połączeniem dostają swoje. Nic nie trafia do dziennika samo.','journey.settings.status': 'Status','journey.settings.statusAuto': 'Automatycznie','journey.settings.statusAutoHint': 'Zależy od dat powiązanych podróży. Bez podróży dziennik pozostaje szkicem.',@@ -878,5 +881,22 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich nie odpowiedział: {reason} Widać postoje, które TREK już zna.','journey.dayImport.truncated': 'Dawarich przesłał tylko część tego dnia. Może brakować postojów.','journey.dayImport.empty': 'Dawarich nie znalazł tego dnia żadnych postojów.',+ 'journey.prep.lastSuccess': 'Ostatnio pobrano {time}.',+ 'journey.prep.never': 'Jeszcze nie pobrano. Uruchomi to następna synchronizacja w tle.',+ 'journey.prep.failed': 'Ostatnie odświeżenie nie powiodło się: {reason} Widać stan pobrany {time}.',+ 'journey.prep.failedNever': 'Pierwsze pobranie nie powiodło się: {reason}',+ 'journey.prep.notConnected': 'Połącz Dawarich w ustawieniach, aby twoje dni mogły zostać przygotowane.',+ 'journey.prep.noPeriods': 'Powiąż podróż z datami: przygotowywane są tylko jej dni.',+ 'journey.prep.syncOff':+ 'Synchronizacja w tle jest wyłączona w ustawieniach Dawarich, dni są pobierane tylko na twoją prośbę.',+ 'journey.prep.fetchNow': 'Pobierz teraz',+ 'journey.prep.fetching': 'Pobieranie…',+ 'journey.prep.fetchFailed': 'Nie udało się teraz zapytać Dawarich.',+ 'journey.prep.dayRunning': 'Dzień jeszcze trwa, mogą dojść kolejne postoje.',+ 'journey.prep.dayPending': 'Jeszcze nie pobrano.',+ 'journey.prep.dayProvisional': 'Pobrano {time}, przed końcem dnia, może brakować postojów.',+ 'journey.prep.dayFailed': 'Ostatnie odświeżenie nie powiodło się, to starszy stan.',+ 'journey.dayImport.running':+ 'Ten dzień jeszcze trwa. Postoje zarejestrowane później pojawią się, gdy tylko Dawarich je będzie mieć.',};export default journey;diff --git a/shared/src/i18n/ru/journey.ts b/shared/src/i18n/ru/journey.tsindex cead10305..1497d044f 100644--- a/shared/src/i18n/ru/journey.ts+++ b/shared/src/i18n/ru/journey.ts@@ -214,6 +214,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX-треки','journey.settings.showTripTracks': 'Показывать все GPX-треки поездок','journey.settings.showTripTracksHint': 'Рисует на карте записанные маршруты из связанных поездок.',+ 'journey.settings.autoPrepare': 'Автоматически готовить записанные дни',+ 'journey.settings.autoPrepareHint':+ 'Пока связанная поездка идёт, остановки из твоего Dawarich ждут проверки у своего дня. Редакторы со своим подключением получают свои. В журнал ничего не пишется само.','journey.settings.status': 'Статус','journey.settings.statusAuto': 'Автоматически','journey.settings.statusAutoHint': 'Следует датам связанных поездок. Без поездки журнал остаётся черновиком.',@@ -877,5 +880,22 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich не ответил: {reason} Показаны остановки, которые TREK уже знает.','journey.dayImport.truncated': 'Dawarich прислал только часть этого дня. Некоторых остановок может не хватать.','journey.dayImport.empty': 'Dawarich не нашёл остановок в этот день.',+ 'journey.prep.lastSuccess': 'Последняя загрузка {time}.',+ 'journey.prep.never': 'Ещё не загружено. Следующая фоновая синхронизация запустит загрузку.',+ 'journey.prep.failed': 'Последнее обновление не удалось: {reason} Показано то, что загружено {time}.',+ 'journey.prep.failedNever': 'Первая загрузка не удалась: {reason}',+ 'journey.prep.notConnected': 'Подключи Dawarich в настройках, чтобы твои дни готовились.',+ 'journey.prep.noPeriods': 'Свяжи поездку с датами: готовятся только её дни.',+ 'journey.prep.syncOff':+ 'Фоновая синхронизация выключена в настройках Dawarich, дни загружаются только по твоему запросу.',+ 'journey.prep.fetchNow': 'Загрузить сейчас',+ 'journey.prep.fetching': 'Загрузка…',+ 'journey.prep.fetchFailed': 'Сейчас не удалось обратиться к Dawarich.',+ 'journey.prep.dayRunning': 'День ещё идёт, могут появиться новые остановки.',+ 'journey.prep.dayPending': 'Ещё не загружено.',+ 'journey.prep.dayProvisional': 'Загружено {time}, до конца дня, часть остановок может отсутствовать.',+ 'journey.prep.dayFailed': 'Последнее обновление не удалось, это более старое состояние.',+ 'journey.dayImport.running':+ 'Этот день ещё идёт. Остановки, записанные позже, появятся, как только они будут у Dawarich.',};export default journey;diff --git a/shared/src/i18n/sk/journey.ts b/shared/src/i18n/sk/journey.tsindex 244a444bd..801f57f5c 100644--- a/shared/src/i18n/sk/journey.ts+++ b/shared/src/i18n/sk/journey.ts@@ -225,6 +225,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'Stopy GPX','journey.settings.showTripTracks': 'Zobraziť všetky GPX stopy z ciest','journey.settings.showTripTracksHint': 'Vykreslí na mape zaznamenané trasy z prepojených ciest.',+ 'journey.settings.autoPrepare': 'Automaticky pripravovať zaznamenané dni',+ 'journey.settings.autoPrepareHint':+ 'Kým prepojená cesta prebieha, čakajú pobyty z tvojho Dawarich pri svojom dni na kontrolu. Editori s vlastným pripojením dostanú svoje. Do denníka sa nič nezapíše samo.','journey.settings.status': 'Stav','journey.settings.statusAuto': 'Automaticky','journey.settings.statusAutoHint': 'Riadi sa dátumami prepojených výletov. Bez výletu zostane denník konceptom.',@@ -855,5 +858,22 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich neodpovedal: {reason} Zobrazujú sa pobyty, ktoré TREK už pozná.','journey.dayImport.truncated': 'Dawarich poslal len časť tohto dňa. Niektoré pobyty môžu chýbať.','journey.dayImport.empty': 'Dawarich v tento deň nenašiel žiadne pobyty.',+ 'journey.prep.lastSuccess': 'Naposledy načítané {time}.',+ 'journey.prep.never': 'Zatiaľ nenačítané. Spustí to ďalšia synchronizácia na pozadí.',+ 'journey.prep.failed': 'Posledná aktualizácia zlyhala: {reason} Zobrazuje sa stav načítaný {time}.',+ 'journey.prep.failedNever': 'Prvé načítanie zlyhalo: {reason}',+ 'journey.prep.notConnected': 'Pripoj Dawarich v nastaveniach, aby sa tvoje dni mohli pripraviť.',+ 'journey.prep.noPeriods': 'Prepoj cestu s dátumami: pripravujú sa len jej dni.',+ 'journey.prep.syncOff':+ 'Synchronizácia na pozadí je v nastaveniach Dawarich vypnutá, dni sa načítajú len na tvoju žiadosť.',+ 'journey.prep.fetchNow': 'Načítať teraz',+ 'journey.prep.fetching': 'Načítava sa…',+ 'journey.prep.fetchFailed': 'Dawarich sa teraz nepodarilo kontaktovať.',+ 'journey.prep.dayRunning': 'Deň ešte prebieha, môžu pribudnúť ďalšie pobyty.',+ 'journey.prep.dayPending': 'Zatiaľ nenačítané.',+ 'journey.prep.dayProvisional': 'Načítané {time}, pred koncom dňa, niektoré pobyty môžu chýbať.',+ 'journey.prep.dayFailed': 'Posledná aktualizácia zlyhala, toto je starší stav.',+ 'journey.dayImport.running':+ 'Tento deň ešte prebieha. Neskôr zaznamenané pobyty sa objavia, hneď ako ich Dawarich bude mať.',};export default journey;diff --git a/shared/src/i18n/sv/journey.ts b/shared/src/i18n/sv/journey.tsindex c9e89d4fe..24b9c1585 100644--- a/shared/src/i18n/sv/journey.ts+++ b/shared/src/i18n/sv/journey.ts@@ -213,6 +213,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX-spår','journey.settings.showTripTracks': 'Visa alla GPX-spår från resor','journey.settings.showTripTracksHint': 'Ritar de inspelade rutterna från de länkade resorna på kartan.',+ 'journey.settings.autoPrepare': 'Förbered inspelade dagar automatiskt',+ 'journey.settings.autoPrepareHint':+ 'Medan en länkad resa pågår väntar vistelserna från din Dawarich vid sin dag på att granskas. Redigerare med egen anslutning får sina. Inget skrivs i dagboken av sig självt.','journey.settings.status': 'Status','journey.settings.statusAuto': 'Automatiskt','journey.settings.statusAutoHint':@@ -831,5 +834,22 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich svarade inte: {reason} Vistelserna som TREK redan känner till visas.','journey.dayImport.truncated': 'Dawarich skickade bara en del av den här dagen. Vistelser kan saknas.','journey.dayImport.empty': 'Dawarich hittade inga vistelser den här dagen.',+ 'journey.prep.lastSuccess': 'Senast hämtat {time}.',+ 'journey.prep.never': 'Inte hämtat än. Nästa bakgrundssynk startar det.',+ 'journey.prep.failed': 'Senaste uppdateringen misslyckades: {reason} Visar det som hämtades {time}.',+ 'journey.prep.failedNever': 'Första hämtningen misslyckades: {reason}',+ 'journey.prep.notConnected': 'Anslut Dawarich i dina inställningar så att dina dagar kan förberedas.',+ 'journey.prep.noPeriods': 'Länka en resa med datum: bara dess dagar förbereds.',+ 'journey.prep.syncOff':+ 'Bakgrundssynken är avstängd i dina Dawarich-inställningar, dagar hämtas bara när du ber om det.',+ 'journey.prep.fetchNow': 'Hämta nu',+ 'journey.prep.fetching': 'Hämtar…',+ 'journey.prep.fetchFailed': 'Dawarich kunde inte tillfrågas just nu.',+ 'journey.prep.dayRunning': 'Dagen pågår fortfarande, fler vistelser kan komma.',+ 'journey.prep.dayPending': 'Inte hämtat än.',+ 'journey.prep.dayProvisional': 'Hämtat {time}, innan dagen var slut, vistelser kan saknas.',+ 'journey.prep.dayFailed': 'Senaste uppdateringen misslyckades, detta är det äldre läget.',+ 'journey.dayImport.running':+ 'Den här dagen pågår fortfarande. Vistelser som spelas in senare visas så snart Dawarich har dem.',};export default journey;diff --git a/shared/src/i18n/th/journey.ts b/shared/src/i18n/th/journey.tsindex 42fb15a4e..d4417e6f8 100644--- a/shared/src/i18n/th/journey.ts+++ b/shared/src/i18n/th/journey.ts@@ -214,6 +214,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'เส้นทาง GPX','journey.settings.showTripTracks': 'แสดงเส้นทาง GPX ของการเดินทางทั้งหมด','journey.settings.showTripTracksHint': 'วาดเส้นทางที่บันทึกไว้จากการเดินทางที่เชื่อมโยงบนแผนที่',+ 'journey.settings.autoPrepare': 'เตรียมวันที่บันทึกไว้โดยอัตโนมัติ',+ 'journey.settings.autoPrepareHint':+ 'ระหว่างที่ทริปที่เชื่อมโยงยังดำเนินอยู่ จุดแวะพักจาก Dawarich ของคุณจะรอตรวจอยู่ที่วันของมัน ผู้แก้ไขที่มีการเชื่อมต่อของตนเองจะได้ของตัวเอง ไม่มีอะไรถูกเขียนลงบันทึกเอง','journey.settings.status': 'สถานะ','journey.settings.statusAuto': 'อัตโนมัติ','journey.settings.statusAutoHint': 'ตามวันที่ของทริปที่เชื่อมไว้ หากไม่มีทริป บันทึกจะเป็นฉบับร่าง',@@ -792,5 +795,20 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich ไม่ตอบกลับ: {reason} กำลังแสดงจุดแวะพักที่ TREK รู้อยู่แล้ว','journey.dayImport.truncated': 'Dawarich ส่งมาเพียงบางส่วนของวันนี้ อาจมีจุดแวะพักขาดหายไป','journey.dayImport.empty': 'Dawarich ไม่พบจุดแวะพักในวันนี้',+ 'journey.prep.lastSuccess': 'ดึงข้อมูลล่าสุด {time}',+ 'journey.prep.never': 'ยังไม่ได้ดึงข้อมูล การซิงก์เบื้องหลังครั้งถัดไปจะเริ่มให้',+ 'journey.prep.failed': 'การรีเฟรชล่าสุดล้มเหลว: {reason} กำลังแสดงข้อมูลที่ดึงเมื่อ {time}',+ 'journey.prep.failedNever': 'การดึงข้อมูลครั้งแรกล้มเหลว: {reason}',+ 'journey.prep.notConnected': 'เชื่อมต่อ Dawarich ในการตั้งค่า เพื่อให้เตรียมวันของคุณได้',+ 'journey.prep.noPeriods': 'เชื่อมโยงทริปที่มีวันที่: จะเตรียมเฉพาะวันของทริปนั้น',+ 'journey.prep.syncOff': 'การซิงก์เบื้องหลังปิดอยู่ในการตั้งค่า Dawarich ของคุณ วันจะถูกดึงเมื่อคุณขอเท่านั้น',+ 'journey.prep.fetchNow': 'ดึงตอนนี้',+ 'journey.prep.fetching': 'กำลังดึง…',+ 'journey.prep.fetchFailed': 'ไม่สามารถสอบถาม Dawarich ได้ในขณะนี้',+ 'journey.prep.dayRunning': 'วันนี้ยังไม่จบ อาจมีจุดแวะพักเพิ่มอีก',+ 'journey.prep.dayPending': 'ยังไม่ได้ดึงข้อมูล',+ 'journey.prep.dayProvisional': 'ดึงเมื่อ {time} ก่อนสิ้นวัน อาจมีจุดแวะพักขาดหาย',+ 'journey.prep.dayFailed': 'การรีเฟรชล่าสุดล้มเหลว นี่คือสถานะเก่ากว่า',+ 'journey.dayImport.running': 'วันนี้ยังไม่จบ จุดแวะพักที่บันทึกภายหลังจะปรากฏเมื่อ Dawarich ได้รับแล้ว',};export default journey;diff --git a/shared/src/i18n/tr/journey.ts b/shared/src/i18n/tr/journey.tsindex 01df41b13..47cd44de2 100644--- a/shared/src/i18n/tr/journey.ts+++ b/shared/src/i18n/tr/journey.ts@@ -210,6 +210,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX İzleri','journey.settings.showTripTracks': 'Tüm gezi GPX izlerini göster','journey.settings.showTripTracksHint': 'Bağlı gezilerdeki kayıtlı rotaları haritaya çizer.',+ 'journey.settings.autoPrepare': 'Kaydedilen günleri otomatik hazırla',+ 'journey.settings.autoPrepareHint':+ "Bağlı bir gezi sürerken Dawarich'teki durakların kendi gününde incelemeni bekler. Kendi bağlantısı olan düzenleyiciler kendi duraklarını alır. Günlüğe kendiliğinden hiçbir şey yazılmaz.",'journey.settings.status': 'Durum','journey.settings.statusAuto': 'Otomatik','journey.settings.statusAutoHint': 'Bağlı gezilerin tarihlerini izler. Gezi olmadan günlük taslak kalır.',@@ -831,5 +834,20 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich yanıt vermedi: {reason} TREK’in zaten bildiği duraklar gösteriliyor.','journey.dayImport.truncated': 'Dawarich bu günün yalnızca bir kısmını gönderdi. Bazı duraklar eksik olabilir.','journey.dayImport.empty': 'Dawarich bu gün hiç durak bulmadı.',+ 'journey.prep.lastSuccess': 'Son alma: {time}.',+ 'journey.prep.never': 'Henüz alınmadı. Bir sonraki arka plan eşitlemesi başlatır.',+ 'journey.prep.failed': 'Son yenileme başarısız oldu: {reason} {time} alınan durum gösteriliyor.',+ 'journey.prep.failedNever': 'İlk alma başarısız oldu: {reason}',+ 'journey.prep.notConnected': "Günlerinin hazırlanması için ayarlarda Dawarich'i bağla.",+ 'journey.prep.noPeriods': 'Tarihli bir gezi bağla: yalnızca onun günleri hazırlanır.',+ 'journey.prep.syncOff': 'Arka plan eşitlemesi Dawarich ayarlarında kapalı, günler yalnızca sen istediğinde alınır.',+ 'journey.prep.fetchNow': 'Şimdi al',+ 'journey.prep.fetching': 'Alınıyor…',+ 'journey.prep.fetchFailed': "Dawarich'e şu anda sorulamadı.",+ 'journey.prep.dayRunning': 'Gün hâlâ sürüyor, başka duraklar da gelebilir.',+ 'journey.prep.dayPending': 'Henüz alınmadı.',+ 'journey.prep.dayProvisional': '{time} alındı, gün bitmeden, eksik duraklar olabilir.',+ 'journey.prep.dayFailed': 'Son yenileme başarısız oldu, bu daha eski durum.',+ 'journey.dayImport.running': 'Bu gün hâlâ sürüyor. Daha sonra kaydedilen duraklar Dawarich onları aldığında görünür.',};export default journey;diff --git a/shared/src/i18n/uk/journey.ts b/shared/src/i18n/uk/journey.tsindex b24123c4a..8c62d0268 100644--- a/shared/src/i18n/uk/journey.ts+++ b/shared/src/i18n/uk/journey.ts@@ -220,6 +220,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX-треки','journey.settings.showTripTracks': 'Показувати всі GPX-треки подорожей','journey.settings.showTripTracksHint': 'Малює на карті записані маршрути зі зв’язаних подорожей.',+ 'journey.settings.autoPrepare': 'Автоматично готувати записані дні',+ 'journey.settings.autoPrepareHint':+ "Поки пов'язана подорож триває, зупинки з твого Dawarich чекають на перевірку біля свого дня. Редактори з власним підключенням отримують свої. До журналу нічого не записується саме.",'journey.settings.status': 'Статус','journey.settings.statusAuto': 'Автоматично','journey.settings.statusAutoHint': "Залежить від дат пов'язаних поїздок. Без поїздки журнал лишається чернеткою.",@@ -884,5 +887,22 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich не відповів: {reason} Показано зупинки, які TREK уже знає.','journey.dayImport.truncated': 'Dawarich надіслав лише частину цього дня. Деяких зупинок може бракувати.','journey.dayImport.empty': 'Dawarich не знайшов зупинок цього дня.',+ 'journey.prep.lastSuccess': 'Востаннє завантажено {time}.',+ 'journey.prep.never': 'Ще не завантажено. Наступна фонова синхронізація запустить завантаження.',+ 'journey.prep.failed': 'Останнє оновлення не вдалося: {reason} Показано те, що завантажено {time}.',+ 'journey.prep.failedNever': 'Перше завантаження не вдалося: {reason}',+ 'journey.prep.notConnected': 'Підключи Dawarich у налаштуваннях, щоб твої дні готувалися.',+ 'journey.prep.noPeriods': "Пов'яжи подорож із датами: готуються лише її дні.",+ 'journey.prep.syncOff':+ 'Фонова синхронізація вимкнена в налаштуваннях Dawarich, дні завантажуються лише на твій запит.',+ 'journey.prep.fetchNow': 'Завантажити зараз',+ 'journey.prep.fetching': 'Завантаження…',+ 'journey.prep.fetchFailed': 'Зараз не вдалося звернутися до Dawarich.',+ 'journey.prep.dayRunning': "День ще триває, можуть з'явитися нові зупинки.",+ 'journey.prep.dayPending': 'Ще не завантажено.',+ 'journey.prep.dayProvisional': 'Завантажено {time}, до кінця дня, частини зупинок може бракувати.',+ 'journey.prep.dayFailed': 'Останнє оновлення не вдалося, це старіший стан.',+ 'journey.dayImport.running':+ "Цей день ще триває. Зупинки, записані пізніше, з'являться, щойно вони будуть у Dawarich.",};export default journey;diff --git a/shared/src/i18n/vi/journey.ts b/shared/src/i18n/vi/journey.tsindex 44f3386f7..97008f6ce 100644--- a/shared/src/i18n/vi/journey.ts+++ b/shared/src/i18n/vi/journey.ts@@ -208,6 +208,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'Tuyến GPX','journey.settings.showTripTracks': 'Hiện tất cả tuyến GPX của chuyến đi','journey.settings.showTripTracksHint': 'Vẽ lên bản đồ các tuyến đường đã ghi từ những chuyến đi được liên kết.',+ 'journey.settings.autoPrepare': 'Tự động chuẩn bị các ngày đã ghi',+ 'journey.settings.autoPrepareHint':+ 'Khi một chuyến đi được liên kết đang diễn ra, các điểm dừng từ Dawarich của bạn chờ ở ngày của chúng để bạn xem. Người chỉnh sửa có kết nối riêng nhận phần của họ. Không có gì tự ghi vào nhật ký.','journey.settings.status': 'Trạng thái','journey.settings.statusAuto': 'Tự động','journey.settings.statusAutoHint':@@ -811,5 +814,20 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich không phản hồi: {reason} Đang hiển thị các điểm dừng TREK đã biết.','journey.dayImport.truncated': 'Dawarich chỉ gửi một phần của ngày này. Có thể thiếu điểm dừng.','journey.dayImport.empty': 'Dawarich không tìm thấy điểm dừng nào trong ngày này.',+ 'journey.prep.lastSuccess': 'Lần lấy gần nhất {time}.',+ 'journey.prep.never': 'Chưa lấy. Lần đồng bộ nền tiếp theo sẽ bắt đầu.',+ 'journey.prep.failed': 'Lần làm mới gần nhất thất bại: {reason} Đang hiện dữ liệu lấy {time}.',+ 'journey.prep.failedNever': 'Lần lấy đầu tiên thất bại: {reason}',+ 'journey.prep.notConnected': 'Kết nối Dawarich trong cài đặt để các ngày của bạn được chuẩn bị.',+ 'journey.prep.noPeriods': 'Liên kết một chuyến đi có ngày: chỉ các ngày của nó được chuẩn bị.',+ 'journey.prep.syncOff': 'Đồng bộ nền đang tắt trong cài đặt Dawarich, các ngày chỉ được lấy khi bạn yêu cầu.',+ 'journey.prep.fetchNow': 'Lấy ngay',+ 'journey.prep.fetching': 'Đang lấy…',+ 'journey.prep.fetchFailed': 'Hiện không thể hỏi Dawarich.',+ 'journey.prep.dayRunning': 'Ngày này vẫn đang diễn ra, có thể có thêm điểm dừng.',+ 'journey.prep.dayPending': 'Chưa lấy.',+ 'journey.prep.dayProvisional': 'Đã lấy {time}, trước khi ngày kết thúc, có thể thiếu điểm dừng.',+ 'journey.prep.dayFailed': 'Lần làm mới gần nhất thất bại, đây là trạng thái cũ hơn.',+ 'journey.dayImport.running': 'Ngày này vẫn đang diễn ra. Các điểm dừng ghi sau sẽ hiện khi Dawarich có chúng.',};export default journey;diff --git a/shared/src/i18n/zh-TW/journey.ts b/shared/src/i18n/zh-TW/journey.tsindex 30d5a2c3c..30294782e 100644--- a/shared/src/i18n/zh-TW/journey.ts+++ b/shared/src/i18n/zh-TW/journey.ts@@ -197,6 +197,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX 軌跡','journey.settings.showTripTracks': '顯示所有行程的 GPX 軌跡','journey.settings.showTripTracksHint': '在地圖上繪製關聯行程中的已記錄路線。',+ 'journey.settings.autoPrepare': '自動準備記錄的日子',+ 'journey.settings.autoPrepareHint':+ '連結的行程進行期間,你 Dawarich 中的停留點會在對應的日子等待查看。有自己連線的編輯者會收到各自的停留點。不會自動寫入日誌。','journey.settings.status': '狀態','journey.settings.statusAuto': '自動','journey.settings.statusAutoHint': '跟隨連結行程的日期。沒有行程時,旅記維持為草稿。',@@ -782,5 +785,20 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich 沒有回應:{reason} 顯示的是 TREK 已知的停留點。','journey.dayImport.truncated': 'Dawarich 只傳送了這一天的一部分,可能缺少停留點。','journey.dayImport.empty': 'Dawarich 在這一天沒有找到停留點。',+ 'journey.prep.lastSuccess': '上次取得:{time}。',+ 'journey.prep.never': '尚未取得。下一次背景同步會開始取得。',+ 'journey.prep.failed': '上次重新整理失敗:{reason} 正在顯示 {time} 取得的內容。',+ 'journey.prep.failedNever': '首次取得失敗:{reason}',+ 'journey.prep.notConnected': '請在設定中連結 Dawarich,以便準備你的日子。',+ 'journey.prep.noPeriods': '請連結一個有日期的行程:只會準備它的日子。',+ 'journey.prep.syncOff': '你的 Dawarich 設定中關閉了背景同步,只有在你要求時才會取得。',+ 'journey.prep.fetchNow': '立即取得',+ 'journey.prep.fetching': '正在取得…',+ 'journey.prep.fetchFailed': '目前無法向 Dawarich 查詢。',+ 'journey.prep.dayRunning': '這一天還沒結束,可能還會有更多停留點。',+ 'journey.prep.dayPending': '尚未取得。',+ 'journey.prep.dayProvisional': '於 {time} 取得,當時這一天還沒結束,可能缺少停留點。',+ 'journey.prep.dayFailed': '上次重新整理失敗,這是較早的狀態。',+ 'journey.dayImport.running': '這一天還沒結束。之後記錄的停留點會在 Dawarich 收到後顯示。',};export default journey;diff --git a/shared/src/i18n/zh/journey.ts b/shared/src/i18n/zh/journey.tsindex 3d2221381..d704982a5 100644--- a/shared/src/i18n/zh/journey.ts+++ b/shared/src/i18n/zh/journey.ts@@ -197,6 +197,9 @@ const journey: TranslationStrings = {'journey.settings.tracks': 'GPX 轨迹','journey.settings.showTripTracks': '显示所有行程的 GPX 轨迹','journey.settings.showTripTracksHint': '在地图上绘制关联行程中的已记录路线。',+ 'journey.settings.autoPrepare': '自动准备记录的日子',+ 'journey.settings.autoPrepareHint':+ '关联的行程进行期间,你 Dawarich 中的停留点会在对应的日子等待查看。有自己连接的编辑者会收到各自的停留点。不会自动写入日志。','journey.settings.status': '状态','journey.settings.statusAuto': '自动','journey.settings.statusAutoHint': '跟随关联行程的日期。没有行程时,旅记保持为草稿。',@@ -782,5 +785,20 @@ const journey: TranslationStrings = {'journey.dayImport.staleNever': 'Dawarich 没有响应:{reason} 显示的是 TREK 已知的停留点。','journey.dayImport.truncated': 'Dawarich 只发送了这一天的一部分,可能缺少停留点。','journey.dayImport.empty': 'Dawarich 在这一天没有找到停留点。',+ 'journey.prep.lastSuccess': '上次获取:{time}。',+ 'journey.prep.never': '尚未获取。下一次后台同步会开始获取。',+ 'journey.prep.failed': '上次刷新失败:{reason} 正在显示 {time} 获取的内容。',+ 'journey.prep.failedNever': '首次获取失败:{reason}',+ 'journey.prep.notConnected': '请在设置中连接 Dawarich,以便准备你的日子。',+ 'journey.prep.noPeriods': '请关联一个有日期的行程:只会准备它的日子。',+ 'journey.prep.syncOff': '你的 Dawarich 设置中关闭了后台同步,只有在你要求时才会获取。',+ 'journey.prep.fetchNow': '立即获取',+ 'journey.prep.fetching': '正在获取…',+ 'journey.prep.fetchFailed': '目前无法向 Dawarich 查询。',+ 'journey.prep.dayRunning': '这一天还没结束,可能还会有更多停留点。',+ 'journey.prep.dayPending': '尚未获取。',+ 'journey.prep.dayProvisional': '于 {time} 获取,当时这一天还没结束,可能缺少停留点。',+ 'journey.prep.dayFailed': '上次刷新失败,这是较早的状态。',+ 'journey.dayImport.running': '这一天还没结束。之后记录的停留点会在 Dawarich 收到后显示。',};export default journey;diff --git a/shared/src/index.ts b/shared/src/index.tsindex 1a40f3d2a..d08dda99f 100644--- a/shared/src/index.ts+++ b/shared/src/index.ts@@ -102,6 +102,7 @@ export * from './file/file.schema';export * from './journey/journey.schema';export * from './journey/journey-recordings.schema';export * from './journey/journey-day-import.schema';+export * from './journey/journey-recording-prep.schema';export * from './journey/trip-journal-link.schema';export * from './book/book.schema';export * from './book/journey-stats.schema';diff --git a/shared/src/journey/journey-recording-prep.schema.spec.ts b/shared/src/journey/journey-recording-prep.schema.spec.tsnew file mode 100644index 000000000..7c5d05b95--- /dev/null+++ b/shared/src/journey/journey-recording-prep.schema.spec.ts@@ -0,0 +1,66 @@+import { journeyRecordingPrepSchema } from './journey-recording-prep.schema';+import { journeySchema, journeyUpdateRequestSchema } from './journey.schema';++import { describe, expect, it } from 'vitest';++const PREP = {+ enabled: true,+ connection: 'ready',+ lastAttemptAt: '2026-05-14T09:00:00.000Z',+ lastSuccessAt: '2026-05-14T08:00:00.000Z',+ lastError: 'unreachable',+};++describe('journeyRecordingPrepSchema', () => {+ it('JRNPREP-SCHEMA-001: a failed run beside the last success, and a person who never ran it', () => {+ expect(journeyRecordingPrepSchema.safeParse(PREP).success).toBe(true);+ expect(+ journeyRecordingPrepSchema.safeParse({+ ...PREP,+ enabled: false,+ connection: 'not_connected',+ lastAttemptAt: null,+ lastSuccessAt: null,+ lastError: null,+ }).success,+ ).toBe(true);+ });++ it('JRNPREP-SCHEMA-002: refuses a connection state it does not know and a missing time', () => {+ expect(journeyRecordingPrepSchema.safeParse({ ...PREP, connection: 'paused' }).success).toBe(false);+ const { lastSuccessAt: _dropped, ...withoutSuccess } = PREP;+ expect(journeyRecordingPrepSchema.safeParse(withoutSuccess).success).toBe(false);+ });+});++describe('the journey switch', () => {+ it('JRNPREP-SCHEMA-003: the update takes a boolean and keeps the rest of the body open', () => {+ expect(journeyUpdateRequestSchema.parse({ auto_prepare_recordings: true, title: 'Venice' })).toEqual({+ auto_prepare_recordings: true,+ title: 'Venice',+ });+ expect(journeyUpdateRequestSchema.safeParse({ auto_prepare_recordings: 1 }).success).toBe(false);+ });++ it('JRNPREP-SCHEMA-004: a journey row reads with and without the flag', () => {+ const row = {+ id: 1,+ user_id: 1,+ title: 'Venice',+ subtitle: null,+ cover_gradient: null,+ status: 'active',+ created_at: 0,+ updated_at: 0,+ cover_image: null,+ show_trip_tracks: 0,+ show_verdict: 1,+ show_mood: 1,+ show_weather: 1,+ status_override: null,+ photo_location: 0,+ };+ expect(journeySchema.safeParse(row).success).toBe(true);+ expect(journeySchema.safeParse({ ...row, auto_prepare_recordings: 1 }).success).toBe(true);+ });+});diff --git a/shared/src/journey/journey-recording-prep.schema.ts b/shared/src/journey/journey-recording-prep.schema.tsnew file mode 100644index 000000000..a171b7a94--- /dev/null+++ b/shared/src/journey/journey-recording-prep.schema.ts@@ -0,0 +1,28 @@+import { z } from 'zod';++/**+ * JRN-03: a journey preparing its recorded days, as one person sees it.+ *+ * The switch is the journey's (its owner sets it); the preparation runs on+ * each person's own Dawarich sync, so what it reached and when it last went+ * through is the caller's alone. A failed run keeps the stays of the last+ * good one, which is why the time of the last success and the reason of the+ * last failure are kept apart.+ */++/** Whether the caller's own Dawarich can prepare anything: connected with its background sync on, with it off, or not connected. */+export const JOURNEY_RECORDING_PREP_CONNECTIONS = ['ready', 'sync_off', 'not_connected'] as const;++/** GET /api/journeys/:id/recordings/prep */+export const journeyRecordingPrepSchema = z.object({+ /** The journey's switch, `auto_prepare_recordings`. */+ enabled: z.boolean(),+ connection: z.enum(JOURNEY_RECORDING_PREP_CONNECTIONS),+ /** ISO-8601 of the caller's last run over the journey, successful or not; null before the first. */+ lastAttemptAt: z.string().nullable(),+ /** ISO-8601 of the caller's last run that came through; the stays shown are as new as this. */+ lastSuccessAt: z.string().nullable(),+ /** Dawarich's reason (a DAWARICH_ERROR_CODES code) when the last run failed; null when it came through. */+ lastError: z.string().nullable(),+});+export type JourneyRecordingPrep = z.infer<typeof journeyRecordingPrepSchema>;diff --git a/shared/src/journey/journey.schema.ts b/shared/src/journey/journey.schema.tsindex 9ac625a86..82c9ef61a 100644--- a/shared/src/journey/journey.schema.ts+++ b/shared/src/journey/journey.schema.ts@@ -36,8 +36,15 @@ export const journeyCreateRequestSchema = z.looseObject({});export type JourneyCreateRequest = z.infer<typeof journeyCreateRequestSchema>;-/** Free-form: forwarded to the service as-is. */-export const journeyUpdateRequestSchema = z.looseObject({});+/** Free-form: forwarded to the service as-is, apart from the fields typed here. */+export const journeyUpdateRequestSchema = z.looseObject({+ auto_prepare_recordings: z+ .boolean()+ .optional()+ .describe(+ "Whether the Dawarich sync prepares the recorded days of the linked trips' periods for the owner and every editor with a connection of their own (JRN-03). Off by default; switching it off stops it, and nothing taken over is touched",+ ),+});export type JourneyUpdateRequest = z.infer<typeof journeyUpdateRequestSchema>;export const journeyAddTripRequestSchema = z.looseObject({@@ -218,6 +225,8 @@ export const journeySchema = z.object({show_weather: z.number(),status_override: z.string().nullable(),photo_location: z.number(),+ /** JRN-03, 0/1. Optional so a row built without it still answers inside the contract. */+ auto_prepare_recordings: z.number().optional(),});export type JourneyRecord = z.infer<typeof journeySchema>;diff --git a/wiki/Dawarich.md b/wiki/Dawarich.mdindex 5b0fb43e8..0d062d338 100644--- a/wiki/Dawarich.md+++ b/wiki/Dawarich.md@@ -55,6 +55,7 @@ A check covers the dates of your trips, not your whole history:- every trip you own or are a member of that has a start date, is not archived, has begun (or begins tomorrow) and ended no more than 400 days ago- for each of them, from three days before the start to one day after the end, but never past the present moment+- the trips linked to a journal that prepares its recorded days (see [Journey-Journal](Journey-Journal)), when you own that journal or write in it, also when you are not on the trip yourself; their stays are fetched within the same limits and wait at their day in that journalStays outside those windows are never fetched. Dawarich's confirmed and unconfirmed visits both come in, because since Dawarich 1.12 an unconfirmed visit is the normal state of one.@@ -180,6 +181,7 @@ With the [MCP](MCP-Overview) addon on as well, an assistant can review your stay| `save_journey_recorded_day` | Keeps that day in a journal after you confirmed the preview, or replaces a different version when asked. Needs the Journey addon too. | `journey:write` || `review_journey_day_stays` | Reads the stays of one day from your Dawarich and says which a journal holds already. Needs the Journey addon too. | `journey:read` || `take_over_journey_day_stays` | Takes the stays you chose into a journal as drafts: one by one, joined per place or as one day report. Needs the Journey addon too. | `journey:write` |+| `get_journey_recording_prep` | Says whether a journal prepares its recorded days and how your own last checks over it went. Needs the Journey addon too. | `journey:read` |The same rules apply as in the browser: nothing is added until a tool is called, and the permissions for adding a place are checked the same way. See [MCP-Addon-Tools](MCP-Addon-Tools) and [MCP-Scopes](MCP-Scopes).diff --git a/wiki/Journey-Journal.md b/wiki/Journey-Journal.mdindex 2a106b9aa..7d5baee38 100644--- a/wiki/Journey-Journal.md+++ b/wiki/Journey-Journal.md@@ -143,6 +143,16 @@ What you should know:- **Drafts never appear on shared links.** Everyone on the journey sees them; the dialog says how many people that is.- **When Dawarich does not answer**, the dialog says why and shows the stays of the last sync instead, so you can still take them over.+### Preparing recorded days automatically++While you travel, the stays of each day can be ready for review without you starting anything. In **Journey Settings**, under **GPX Tracks**, the owner switches on **Prepare recorded days automatically**. It is off by default.++- The background check of [Dawarich](Dawarich) then also reads the days of the trips linked to the journal, for the owner and for every editor with a Dawarich connection of their own. Everyone gets only their own stays; nobody else's recording is read.+- In the timeline, a day with stays waiting shows their number on its list button, and a click opens the review of that day. A small dot marks a day that is not final yet: it is still running, its stays were fetched before it ended, nothing was fetched yet, or the last refresh failed and the day shows an older state. The tooltip says which.+- Under the switch you see when your stays were last fetched, or why it did not work (no connection, no linked trip with dates, background check switched off, or the reason of the last failure, with the state still shown). **Fetch now** asks Dawarich at once; switching the preparation on does that by itself.+- Stays recorded later and stays Dawarich changed come in with the next check. Stays you took over or left out are not offered again, and nothing in the journal is ever written or changed on its own: taking a day over stays your decision.+- Switching it off stops the preparation. Everything you took over stays as it is.+**Geotagged photos are drawn too.** A photo of the journey that knows where it was taken appears on the map as a thumbnail, and photos taken close together collapse into one thumbnail with a count. Click one to open those photos in the viewer.**Place entries from their photos**, a switch under **Photos** in **Journey Settings**, goes one step further: an entry without a place takes the spot where its first photo with GPS was taken. Places you set yourself are never moved. It is off by default.diff --git a/wiki/MCP-Addon-Tools.md b/wiki/MCP-Addon-Tools.mdindex ab0dcce31..0617bbc6d 100644--- a/wiki/MCP-Addon-Tools.md+++ b/wiki/MCP-Addon-Tools.md@@ -185,7 +185,7 @@ Requires `journey:read` or `journey:write` scope.| `get_journey` | Get a full snapshot of a journey — metadata, entries, contributors, and linked trips. || `get_journey_stats` | What a journey adds up to: distance travelled in metres, calendar days spanned, countries in visit order, the furthest point reached, and entry, photo and place counts. Entries switched off with `stats_excluded` count towards none of those and are listed under `excluded`. Pass `include_route` for the route itself, up to 400 stops with coordinates. || `create_journey` | Create a new journey with title, optional subtitle, and an initial list of trip IDs. |-| `update_journey` | Update a journey's title, subtitle, cover or status, and whether its entries offer a pros/cons list, a mood and a weather note (`show_verdict`, `show_mood`, `show_weather`). `status_override` sets the shown status by hand (`draft`, `live` or `completed`), `null` goes back to following the trip dates. `photo_location` lets an entry without a place take the position of its first geotagged photo. Owner only. |+| `update_journey` | Update a journey's title, subtitle, cover or status, and whether its entries offer a pros/cons list, a mood and a weather note (`show_verdict`, `show_mood`, `show_weather`). `status_override` sets the shown status by hand (`draft`, `live` or `completed`), `null` goes back to following the trip dates. `photo_location` lets an entry without a place take the position of its first geotagged photo. `auto_prepare_recordings` switches the preparation of its recorded days from Dawarich on or off. Owner only. || `restore_journey_suggestions` | Bring back every trip-derived suggestion that was dismissed from a journey. Answers with how many came back. || `delete_journey` | Delete a journey. || `add_journey_trip` | Link an existing trip to a journey. |@@ -226,6 +226,7 @@ Each tool asks for the scope of what it writes, so the scopes differ per tool. T| `save_journey_recorded_day` | Keep that day in the journey after the traveller confirmed the preview. Send its `utcOffsetMinutes` and `contentHash` as `expectedHash`; a recording that changed since is not kept. A different version is replaced only with `replace: true`; entries and texts are never touched. Needs the Journey addon too | `journey:write` || `review_journey_day_stays` | The caller's stays of one local day, read from Dawarich again, as a journey would take them over: name, place, arrival and departure, whether Dawarich only guessed it, and whether the journey holds it already, left it out before or it went elsewhere, plus the entries the journey has on that day. When Dawarich does not answer, the stays of the last sync with the reason. Needs the Journey addon too and edit access to the journey | `journey:read` || `take_over_journey_day_stays` | Take chosen stays of that day into the journey as draft entries: one per stay, several stays of one place as one entry, or a day report listing them with their times, at a chosen stay or without a map position. Corrected names, stays left out on purpose (dismissed, restorable), every stay kept with its own place and times on its entry; stays the journey holds already are reported, never written twice. Needs the Journey addon too | `journey:write` |+| `get_journey_recording_prep` | Whether a journey prepares its recorded days in the background and how the caller's own last runs over its linked trip periods went: when one was last tried, when one last came through (the stays waiting at its days are as new as that), why the last one failed, and whether the caller's connection can prepare anything (`ready`, `sync_off`, `not_connected`). Nothing is ever written into the journey on its own. Needs the Journey addon too and edit access to the journey | `journey:read` |### Document sync _(Documents addon required)_