fix(journey): take a day over from the phone stay sheet, keep a picked position inside its group and send stays without a place unpinned

A journey on a phone with stays on days that hold no entry offers each waiting day in the Dawarich stay sheet, so a day can be built from its stays alone; desktop and phone read the same days through openStayDatesWithin. A position picked for a group falls back to the longest stay with a place once that stay is unchosen or split off, a merged entry of stays without a position goes out unpinned instead of being refused, and a stay taken over meanwhile is never joined across. review_journey_day_stays is no longer marked read-only, since it refreshes the caller's stored stays. The already-taken notice no longer claims the stays were in this journal. An e2e case checks the drafts stay off the public share.
This commit is contained in:
Maurice
2026-10-21 16:49:47 +02:00
parent 7c1de6ed82
commit 3f1d1a57cc
39 changed files with 265 additions and 104 deletions
@@ -156,7 +156,6 @@ export class DawarichVisitSuggestionsRepository extends TrekRepository<DawarichV
return Number(result.numUpdatedRows ?? 0);
}
/** DWS3 — `getOne`: single-row variant of {@link list}'s join. */
/** One person's stays of one local day, in the order they were lived (JRN-02's day review). */
async listForDay(userId: number, localDate: string): Promise<SuggestionJoinRow[]> {
const rows = await this.joinedQuery()
@@ -168,6 +167,7 @@ export class DawarichVisitSuggestionsRepository extends TrekRepository<DawarichV
return rows as SuggestionJoinRow[];
}
/** DWS3 — `getOne`: single-row variant of {@link list}'s join. */
async getOne(userId: number, id: number): Promise<SuggestionJoinRow | null> {
const row = await this.joinedQuery().where('s.id', '=', id).where('s.user_id', '=', userId).executeTakeFirst();
return (row as SuggestionJoinRow) ?? null;
@@ -1,12 +1,5 @@
import { ADDON_IDS } from '../../addons';
import {
McpController,
TOOL_ANNOTATIONS_READONLY,
TOOL_ANNOTATIONS_WRITE,
Tool,
ok,
type McpContext,
} from '../../nest-mcp';
import { McpController, TOOL_ANNOTATIONS_WRITE, Tool, ok, type McpContext } from '../../nest-mcp';
import { addonGate, type HasAddons } from '../addons/addon-gate';
import { AddonsService } from '../addons/addons.service';
import { JourneyDayImportService } from './journey-day-import.service';
@@ -38,10 +31,11 @@ export class JourneyDayImportMcp {
@Tool({
name: 'review_journey_day_stays',
description:
"The stays Dawarich found on one local day, from the caller's own connection, as a journey would take them over: each with its suggestionId, name, place, arrival and departure, whether Dawarich only guessed it, and its status for this journey (open, skipped before, here with the entry holding it, or taken over elsewhere), plus the entries the journey has on the day. When Dawarich does not answer, the stays of the last sync are shown with fresh: false and the reason. Needs edit access to the journey.",
"The stays Dawarich found on one local day, from the caller's own connection, as a journey would take them over: each with its suggestionId, name, place, arrival and departure, whether Dawarich only guessed it, and its status for this journey (open, skipped before, here with the entry holding it, or taken over elsewhere), plus the entries the journey has on the day. When Dawarich does not answer, the stays of the last sync are shown with fresh: false and the reason. Reading the day again refreshes the caller's own stored stays of it, nothing in the journey. Needs edit access to the journey.",
inputSchema: { journeyId: idSchema, date: journeyRecordingDateSchema },
// Reaches the caller's own Dawarich instance and refreshes their stays of the day.
annotations: { ...TOOL_ANNOTATIONS_READONLY, openWorldHint: true },
// Reaches the caller's own Dawarich instance and refreshes their stored stays of the day; the journey
// scope's read access covers that, since only the caller's own stay list changes.
annotations: { ...TOOL_ANNOTATIONS_WRITE, openWorldHint: true },
when: bothAddonsOn,
access: { group: 'journey', mode: 'read' },
})