Files
TREK/client/src/repo/placeContribRepo.ts
T
Maurice 013aa3954d admin: ask once, then show and steer what is shared of place details
The first time an admin opens the settings on an installation that can share,
a dialog asks for the whole installation, with every field switched on and a
plain list of what never goes along. Nothing is sent before Agree; Not now
asks again in 14 days, No keeps the question away until the terms change, and
closing it decides nothing.

Inside the TREK Places API card, Share place details then holds the switch for
the installation and one per field, the figures of the last 30 days, the
transmission log and the way to withdraw everything sent. The place form
reports for each field whether the user typed it or a provider filled it.
2026-10-31 03:25:55 +00:00

40 lines
1.4 KiB
TypeScript

import {
placeContribLogResponseSchema,
placeContribStateSchema,
placeContribWithdrawResponseSchema,
type PlaceContribDecisionRequest,
type PlaceContribLogQuery,
type PlaceContribLogResponse,
type PlaceContribState,
type PlaceContribWithdrawResponse,
} from '@trek/shared';
import { placeContribApi } from '../api/placeContrib';
import { requireOnline } from './onlineOnly';
/**
* The installation's decision on sharing place details, and what it sent.
* **Online-only, no Dexie table**, like the service identity beside it: a
* consent read from a stale copy would be worse than no answer.
*/
export const placeContribRepo = {
async state(signal?: AbortSignal): Promise<PlaceContribState> {
requireOnline();
return placeContribStateSchema.parse(await placeContribApi.state(signal));
},
async decide(body: PlaceContribDecisionRequest): Promise<PlaceContribState> {
requireOnline();
return placeContribStateSchema.parse(await placeContribApi.decide(body));
},
async log(query: Partial<PlaceContribLogQuery>, signal?: AbortSignal): Promise<PlaceContribLogResponse> {
requireOnline();
return placeContribLogResponseSchema.parse(await placeContribApi.log(query, signal));
},
async withdraw(): Promise<PlaceContribWithdrawResponse> {
requireOnline();
return placeContribWithdrawResponseSchema.parse(await placeContribApi.withdraw());
},
};