mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 00:20:07 +00:00
feat(mail-ingest): read forwarded booking mails and add what passes the checks to its trip
Addresses per person and per trip (random base32 token, stored hashed and encrypted), an intake every transport shares, and a job that reads each mail once under a lease: filters without AI, machine-readable data always, one AI request with the person's trips, the server's checks G1 to G9, then one transaction per mail that adds what passed, keeps the rest in the inbox with a reason, and notifies the forwarder and co-travellers. Undo within 7 days, manual apply, filing as documents, a prefilled form and a nightly retention complete it; on a managed install the operator's switch decides.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { logError } from '../audit/audit-log.logger';
|
||||
import type { KiReservation } from '../booking-import/kitinerary.types';
|
||||
import { capImage, renderPdfPages } from './image-input';
|
||||
import { createLlmClient } from './llm-client.factory';
|
||||
@@ -96,7 +97,7 @@ export class MailReadService {
|
||||
} catch (err) {
|
||||
// The provider and the error only: the mail's content stays out of the log.
|
||||
const reason = err instanceof Error ? err.message : String(err);
|
||||
console.error(`[llm-parse] Mail read failed (provider=${config.provider}): ${reason}`);
|
||||
logError(`[llm-parse] Mail read failed (provider=${config.provider}): ${reason}`);
|
||||
return nothing(failureOutcome(err));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,10 @@ export function normalizeNode(node: Record<string, unknown>): Record<string, unk
|
||||
* is dropped: an empty currency lets the cost form pick one, a made up one
|
||||
* (`EURials`, #2477) is saved and cannot be converted.
|
||||
*/
|
||||
export function normalizeCurrency(node: Record<string, unknown>, documentText: string | undefined): Record<string, unknown> {
|
||||
export function normalizeCurrency(
|
||||
node: Record<string, unknown>,
|
||||
documentText: string | undefined,
|
||||
): Record<string, unknown> {
|
||||
const hasPrice = node.price != null && node.price !== '';
|
||||
if (node.priceCurrency == null && !hasPrice) return node;
|
||||
const code =
|
||||
|
||||
Reference in New Issue
Block a user