Files
TREK/server/src/db/entities/PlaceContribLog.entity.ts
T
Maurice 182ed56fa4 places: let an admin share the details users typed with the TREK Places API
Every shareable field of a place now records where its value came from: typed
by a user, filled by a provider, written by the assistant, a plugin or an
import. Only values a user typed are ever sent, and only after an admin agreed
to the current terms for the whole installation, field by field.

The new place-contrib domain keeps the decision in app settings, queues values
in an outbox a cron job sends from, logs what the service made of each one and
can withdraw everything this installation sent. Development, test and demo
instances, an own TREK_PLACES_URL, TREK_SERVICES=off and
TREK_PLACES_CONTRIBUTE=off never send anything. Index results carry the
community version, so the details caches refresh when it changes.
2026-10-31 03:25:55 +00:00

30 lines
844 B
TypeScript

import { EntityRepositoryType, type Opt, defineEntity, p } from '@mikro-orm/core';
import { PlaceContribLogRepository } from '../repositories/PlaceContribLog.repository';
export class PlaceContribLog {
[EntityRepositoryType]?: PlaceContribLogRepository;
id!: number & Opt;
day!: string;
contrib_key!: string;
place_name!: string;
field!: string;
value_summary?: string | null;
result!: string;
reason?: string | null;
}
export const PlaceContribLogSchema = defineEntity({
class: PlaceContribLog,
repository: () => PlaceContribLogRepository,
properties: {
id: p.integer().primary(),
day: p.text().index('idx_place_contrib_log_day'),
contrib_key: p.text(),
place_name: p.text(),
field: p.text(),
value_summary: p.text().nullable(),
result: p.text(),
reason: p.text().nullable(),
},
});