import type { Template } from '@/app/admin/components/TemplatePicker'; import { prisma } from '@/lib/db'; /** * The saved phrases, in the order the picker should offer them. * * Loaded by every page that composes a message, which is the point: a phrase * written once should be reachable everywhere without being retyped. */ export async function loadTemplates(): Promise { const rows = await prisma.messageTemplate.findMany({ orderBy: [{ sortOrder: 'asc' }, { createdAt: 'asc' }], select: { id: true, textFr: true }, }); return rows; }