teqo-backup/src/lib/activityDescription.ts
Francisco Solla 70070db8dc feat(C114): agenda da campanha espelhada no Google Calendar com notificação (push Teqo → Google)
Espelho oficial da agenda em calendário Google compartilhado via API
(service account, jose + fetch): reconciliação por passada com id
determinístico teqo+base32hex (upsert idempotente, sem estado por evento),
hooks afterChange/afterDelete na activity (só campos espelhados, nunca
lança), auto-resync quando calendarId muda, retry na view da agenda,
pill de estado no header + FAB + diálogo (4 estados). Cancelado no Teqo
deleta o evento no Google. Sem participantes no v1 (decisão de produto).
Sem migration nova de tabela (hand-written). Closes #635
2026-08-11 13:53:51 -03:00

21 lines
871 B
TypeScript

/**
* Shared description parts for campaign activities — the iCal feed and the
* C114 Google mirror render the same facts (municipality, locality, tags,
* deputy flag) with their own consumers' separators/escapes. No PII: no
* leadership names, phones or emails.
*/
import type { Activity } from '@/payload-types'
export type ActivityDescriptionSource = Pick<Activity, 'locality' | 'tags' | 'deputyPresent'>
export const buildActivityDescriptionParts = (
activity: ActivityDescriptionSource,
municipalityName?: string,
): string[] => {
const parts: string[] = []
if (municipalityName) parts.push(`Município: ${municipalityName}`)
if (activity.locality) parts.push(`Local: ${activity.locality}`)
if (activity.tags?.length) parts.push(`Tags: ${activity.tags.join(', ')}`)
if (activity.deputyPresent) parts.push('Deputado presente')
return parts
}