diff --git a/.peppa/memory.md b/.peppa/memory.md
index 2a44244..26b97ab 100644
--- a/.peppa/memory.md
+++ b/.peppa/memory.md
@@ -22,3 +22,4 @@
- QLFW-8: страница /[locale]/projects/ermek-serkebayev использует общий словарь book и фото владельца public/books/serkebayev; translationReview у kk/en до проверки владельцем. Организатор — Qazaq Legacy Foundation.
- QLFW-23: главная без пометок «Нужно уточнить» и пустых блоков книги; Tbc остался только на юридических страницах. Общая рабочая копия может переключаться параллельными сессиями — работать через git worktree.
+- Форма обращения: серверное действие src/app/actions/inquiry.ts → коллекция Payload inquiries + письмо через nodemailer (SMTP_HOST/PORT/USER/PASS/FROM, INQUIRY_TO; без SMTP_HOST — mockMailer, только сохранение). Спам: ловушка website, <2,5 с, 3 обращения/10 мин на IP (src/lib/inquiry.ts). Страница /{locale}/contacts.
diff --git a/docs/glossary.md b/docs/glossary.md
index 610dc16..3157c56 100644
--- a/docs/glossary.md
+++ b/docs/glossary.md
@@ -43,7 +43,6 @@
| Сотрудничество | сотрудничество, партнёрство | спонсорство | Приглашение связаться с фондом |
| Документ о данных | политика конфиденциальности / құпиялылық саясаты / Privacy Policy | политика приватности, privacy, GDPR | Страница `/…/privacy`, текст только от фонда |
| Правила сайта | условия использования сайта / сайтты пайдалану шарттары / Terms of Use | пользовательское соглашение, оферта, ToS | Страница `/…/terms`, текст только от фонда |
-| Согласие у формы | «Отправляя обращение, вы соглашаетесь с политикой конфиденциальности» | согласие на обработку ПДн, чекбокс | Подпись со ссылкой только у формы отправки; у блока с почтой — обычная ссылка на политику |
Юридические документы фонда публикуются дословно из предоставленного источника; термины «персональные данные», «cookie-файлы», «БИН» сохраняются. Незаполненная дата — «Нужно уточнить».
@@ -57,3 +56,7 @@
| Место получения книги | Книга доступна на Flip / Кітап Flip сайтында қолжетімді / The book is available on Flip | купить у фонда | По ссылке открывается страница книги на Flip, без обещания наличия или доставки |
| Организатор книги | Организатор проекта / Жоба ұйымдастырушысы / Project organiser | — | Qazaq Legacy Foundation, подтверждено владельцем QLFW-8 |
| Проверка перевода | Перевод требует проверки / Аударманы тексеру қажет / Translation awaiting review | — | Только для kk и en до проверки владельцем |
+| Согласие у формы | «Отправляя обращение, вы соглашаетесь с политикой конфиденциальности» | ПДн, чекбокс | Подпись со ссылкой у каждой формы и у блока связи |
+| Отметка согласия в форме | Я согласен(на) на обработку персональных данных в соответствии с политикой конфиденциальности | ПДн, чекбокс, галочка | Без отметки обращение отправить нельзя |
+| Форма обращения | обращение, форма обращения, Написать нам | тикет, заявка, фидбэк | Посетитель пишет фонду прямо с сайта |
+| Страница контактов | Контакты / Байланыс / Contacts | контакт-центр | Страница `/…/contacts` с формой и почтой |
diff --git a/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/design.md b/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/design.md
new file mode 100644
index 0000000..de9dca5
--- /dev/null
+++ b/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/design.md
@@ -0,0 +1,7 @@
+## Решения
+- **Отправка**: серверное действие Next (без отдельного API). Обращение сначала сохраняется в коллекции Payload `inquiries` (не теряется, если почта недоступна), затем уходит письмом через SMTP (nodemailer; `SMTP_HOST/PORT/USER/PASS/FROM`, получатель `INQUIRY_TO`, по умолчанию qazaqlegacy@gmail.com).
+- **Мок**: пока `SMTP_HOST` не задан, письмо не отправляется (`mockMailer`), обращение остаётся в админ-панели. Владельцу заведён запрос на SMTP-доступ (declare_needs).
+- **Спам без капчи**: скрытое поле-ловушка, отправка быстрее 2,5 с после первого фокуса — тихо «принимается» и отбрасывается; не более 3 обращений за 10 минут с одного IP (память процесса).
+- **Ошибки**: сервер возвращает коды, тексты берутся из словаря на трёх языках.
+- Согласие: чекбокс обязателен (на сервере тоже), в подписи ссылка на политику; прежняя подпись `PrivacyNote` в блоке заменена чекбоксом.
+- Почта на сайте: `contactEmail` из админ-панели, иначе qazaqlegacy@gmail.com.
diff --git a/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/proposal.md b/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/proposal.md
new file mode 100644
index 0000000..d0c8609
--- /dev/null
+++ b/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/proposal.md
@@ -0,0 +1,11 @@
+## Why
+Посетитель сайта не может написать фонду: в блоке «Сотрудничество» стоит пометка «Нужно уточнить: Контакты для связи». Нужна форма обращения, письмо фонду и запасная почта на сайте.
+
+## What Changes
+- Форма обращения (имя, почта, организация, текст, отметка согласия) в блоке «Сотрудничество» и на новой странице «Контакты».
+- Обращение сохраняется в админ-панели и уходит на qazaqlegacy@gmail.com.
+- Защита от спама без капчи.
+- Почта показана на сайте как запасной способ связи; пометка «Нужно уточнить» убрана.
+
+## Impact
+Новая коллекция `inquiries` (миграция), страница `/{locale}/contacts`, спека `contact-form`.
diff --git a/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/specs/contact-form/spec.md b/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/specs/contact-form/spec.md
new file mode 100644
index 0000000..30ca370
--- /dev/null
+++ b/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/specs/contact-form/spec.md
@@ -0,0 +1,47 @@
+## ADDED Requirements
+
+### Requirement: Форма обращения
+Сайт SHALL давать посетителю написать фонду: в блоке «Сотрудничество» и на странице «Контакты» есть форма с полями «имя», «электронная почта», «организация» (необязательно), «текст обращения» и обязательной отметкой согласия со ссылкой на политику конфиденциальности. Тексты формы SHALL быть на русском, казахском и английском.
+
+#### Scenario: Успешная отправка
+- **GIVEN** посетитель открыл страницу «Контакты» на русском
+- **WHEN** он заполняет имя «Анна», почту «anna@example.com», текст «Здравствуйте», ставит отметку согласия и нажимает «Отправить обращение»
+- **THEN** он видит сообщение «Обращение принято»
+- **AND** обращение сохранено и отправлено на qazaqlegacy@gmail.com
+
+#### Scenario: Нет согласия
+- **GIVEN** все обязательные поля заполнены
+- **WHEN** посетитель отправляет форму без отметки согласия
+- **THEN** обращение не принимается
+- **AND** под отметкой видна подсказка «Отметьте согласие на обработку персональных данных.»
+
+#### Scenario: Пустые поля
+- **GIVEN** форма пуста
+- **WHEN** посетитель отправляет её
+- **THEN** у имени, почты и текста видны подсказки
+
+#### Scenario: Сбой отправки
+- **GIVEN** обращение нельзя ни сохранить, ни отправить
+- **WHEN** посетитель отправляет корректную форму
+- **THEN** он видит две фразы: что случилось и что сделать, с адресом почты
+
+### Requirement: Защита от спама без капчи
+Форма SHALL отбрасывать обращения роботов (заполненная скрытая ловушка, отправка быстрее 2,5 секунд) и ограничивать частоту: не более 3 обращений за 10 минут с одного адреса.
+
+#### Scenario: Робот заполнил ловушку
+- **GIVEN** скрытое поле формы заполнено
+- **WHEN** форма отправляется
+- **THEN** обращение не сохраняется и не отправляется
+
+#### Scenario: Слишком частые обращения
+- **GIVEN** с одного адреса за 10 минут уже отправлено 3 обращения
+- **WHEN** отправляется четвёртое
+- **THEN** посетитель видит просьбу попробовать позже
+
+### Requirement: Запасная почта
+Сайт SHALL показывать почту фонда (qazaqlegacy@gmail.com или почту из админ-панели) рядом с формой, а пометка «Нужно уточнить: Контакты для связи» SHALL отсутствовать.
+
+#### Scenario: Почта видна
+- **GIVEN** посетитель открыл блок «Сотрудничество»
+- **WHEN** он смотрит под формой
+- **THEN** он видит ссылку-почту qazaqlegacy@gmail.com
diff --git a/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/tasks.md b/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/tasks.md
new file mode 100644
index 0000000..0d5884c
--- /dev/null
+++ b/openspec/changes/archive/2026-11-17-qlfw-15-contact-form/tasks.md
@@ -0,0 +1,10 @@
+## 1. Данные и логика
+- [x] 1.1 Коллекция `inquiries` и миграция
+- [x] 1.2 Проверка полей, защита от спама, ограничение частоты, тесты
+- [x] 1.3 Отправка письма (SMTP, mock без настроек)
+## 2. Сайт
+- [x] 2.1 Форма, серверное действие, тексты ru/kk/en
+- [x] 2.2 Блок «Сотрудничество» и страница «Контакты», ссылка в подвале
+- [x] 2.3 Словарь docs/glossary.md
+## 3. Завершение
+- [x] 3.1 Проверки lint/typecheck/test/build, память, архив, PR
diff --git a/openspec/specs/contact-form/spec.md b/openspec/specs/contact-form/spec.md
new file mode 100644
index 0000000..08023a8
--- /dev/null
+++ b/openspec/specs/contact-form/spec.md
@@ -0,0 +1,52 @@
+# contact-form Specification
+
+## Purpose
+TBD - created by archiving change qlfw-15-contact-form. Update Purpose after archive.
+
+## Requirements
+
+### Requirement: Форма обращения
+Сайт SHALL давать посетителю написать фонду: в блоке «Сотрудничество» и на странице «Контакты» есть форма с полями «имя», «электронная почта», «организация» (необязательно), «текст обращения» и обязательной отметкой согласия со ссылкой на политику конфиденциальности. Тексты формы SHALL быть на русском, казахском и английском.
+
+#### Scenario: Успешная отправка
+- **GIVEN** посетитель открыл страницу «Контакты» на русском
+- **WHEN** он заполняет имя «Анна», почту «anna@example.com», текст «Здравствуйте», ставит отметку согласия и нажимает «Отправить обращение»
+- **THEN** он видит сообщение «Обращение принято»
+- **AND** обращение сохранено и отправлено на qazaqlegacy@gmail.com
+
+#### Scenario: Нет согласия
+- **GIVEN** все обязательные поля заполнены
+- **WHEN** посетитель отправляет форму без отметки согласия
+- **THEN** обращение не принимается
+- **AND** под отметкой видна подсказка «Отметьте согласие на обработку персональных данных.»
+
+#### Scenario: Пустые поля
+- **GIVEN** форма пуста
+- **WHEN** посетитель отправляет её
+- **THEN** у имени, почты и текста видны подсказки
+
+#### Scenario: Сбой отправки
+- **GIVEN** обращение нельзя ни сохранить, ни отправить
+- **WHEN** посетитель отправляет корректную форму
+- **THEN** он видит две фразы: что случилось и что сделать, с адресом почты
+
+### Requirement: Защита от спама без капчи
+Форма SHALL отбрасывать обращения роботов (заполненная скрытая ловушка, отправка быстрее 2,5 секунд) и ограничивать частоту: не более 3 обращений за 10 минут с одного адреса.
+
+#### Scenario: Робот заполнил ловушку
+- **GIVEN** скрытое поле формы заполнено
+- **WHEN** форма отправляется
+- **THEN** обращение не сохраняется и не отправляется
+
+#### Scenario: Слишком частые обращения
+- **GIVEN** с одного адреса за 10 минут уже отправлено 3 обращения
+- **WHEN** отправляется четвёртое
+- **THEN** посетитель видит просьбу попробовать позже
+
+### Requirement: Запасная почта
+Сайт SHALL показывать почту фонда (qazaqlegacy@gmail.com или почту из админ-панели) рядом с формой, а пометка «Нужно уточнить: Контакты для связи» SHALL отсутствовать.
+
+#### Scenario: Почта видна
+- **GIVEN** посетитель открыл блок «Сотрудничество»
+- **WHEN** он смотрит под формой
+- **THEN** он видит ссылку-почту qazaqlegacy@gmail.com
diff --git a/package.json b/package.json
index b955b72..0a8ee1e 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
"@payloadcms/richtext-lexical": "^3.93.0",
"graphql": "^16.15.0",
"next": "^15.5.29",
+ "nodemailer": "^10.6.0",
"payload": "^3.93.0",
"react": "^19.3.1",
"react-dom": "^19.3.1",
@@ -30,6 +31,7 @@
"@eslint/eslintrc": "^3.3.7",
"@tailwindcss/postcss": "^4.3.5",
"@types/node": "^22.20.5",
+ "@types/nodemailer": "^8.0.2",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"eslint": "^9.39.5",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9a00eb5..4630c8c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -181,6 +181,9 @@ importers:
next:
specifier: ^15.5.29
version: 15.5.29(@types/node@22.20.5)(babel-plugin-macros@3.1.0)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(sass@1.77.4)
+ nodemailer:
+ specifier: ^10.6.0
+ version: 10.6.0
payload:
specifier: ^3.93.0
version: 3.93.0(graphql@16.15.0)(supports-color@7.2.0)(typescript@5.9.3)
@@ -203,6 +206,9 @@ importers:
'@types/node':
specifier: ^22.20.5
version: 22.20.5
+ '@types/nodemailer':
+ specifier: ^8.0.2
+ version: 8.0.2
'@types/react':
specifier: ^19.3.0
version: 19.3.0
@@ -1784,6 +1790,9 @@ packages:
'@types/node@26.6.6':
resolution: {integrity: sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==}
+ '@types/nodemailer@8.0.2':
+ resolution: {integrity: sha512-c7M5ox8p0nEOfbJ2E9Qcmt8/QCu/VzsiAhzBiZbvky2PhKZDHpKB3sQHBM5MEZNkCfBOaS6S9//AGPRTNB7IaA==}
+
'@types/parse-json@4.0.2':
resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==}
@@ -3425,6 +3434,10 @@ packages:
resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
+ nodemailer@10.6.0:
+ resolution: {integrity: sha512-jWanL7D9GD3jvUDYKmoC5rWTiG8MnBgnN2yV68bgMKip1zUJhiSTyz7Eg+18y8sk5OvdVDzws5nZK5arSI4f5Q==}
+ engines: {node: '>=20.0.0'}
+
normalize-path@3.0.0:
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
engines: {node: '>=0.10.0'}
@@ -5656,6 +5669,10 @@ snapshots:
dependencies:
undici-types: 8.9.0
+ '@types/nodemailer@8.0.2':
+ dependencies:
+ '@types/node': 22.20.5
+
'@types/parse-json@4.0.2': {}
'@types/react-dom@19.3.0(@types/react@19.3.0)':
@@ -7547,6 +7564,8 @@ snapshots:
fetch-blob: 3.2.0
formdata-polyfill: 4.0.10
+ nodemailer@10.6.0: {}
+
normalize-path@3.0.0: {}
object-assign@4.1.1: {}
diff --git a/src/app/(site)/[locale]/contacts/page.tsx b/src/app/(site)/[locale]/contacts/page.tsx
new file mode 100644
index 0000000..f48849f
--- /dev/null
+++ b/src/app/(site)/[locale]/contacts/page.tsx
@@ -0,0 +1,52 @@
+import type { Metadata } from 'next'
+import Link from 'next/link'
+import { notFound } from 'next/navigation'
+import { ContactForm } from '@/components/ContactForm'
+import { Footer } from '@/components/Footer'
+import { Header } from '@/components/Header'
+import { getDict, isLocale, locales } from '@/i18n'
+import { loadContent } from '@/lib/content'
+import { FALLBACK_EMAIL } from '@/lib/inquiry'
+
+export const dynamic = 'force-dynamic'
+
+type Props = { params: Promise<{ locale: string }> }
+
+export async function generateMetadata({ params }: Props): Promise {
+ const { locale } = await params
+ if (!isLocale(locale)) return {}
+ const t = getDict(locale)
+ const title = `${t.contacts.title} — ${t.siteName}`
+ return {
+ title,
+ description: t.contacts.description,
+ alternates: { languages: Object.fromEntries(locales.map((l) => [l, `/${l}/contacts`])) },
+ openGraph: { title, description: t.contacts.description, type: 'website', locale },
+ }
+}
+
+export default async function ContactsPage({ params }: Props) {
+ const { locale } = await params
+ if (!isLocale(locale)) notFound()
+ const t = getDict(locale)
+ const { home } = await loadContent(locale)
+ const email = home?.contactEmail?.trim() || FALLBACK_EMAIL
+ return (
+ <>
+
+
+ ← {t.legal.back}
+ {t.contacts.title}
+
+ {t.contacts.lead}
+
+ {t.contacts.emailLabel}: {email}
+
+
+
+
+
+
+ >
+ )
+}
diff --git a/src/app/(site)/[locale]/page.tsx b/src/app/(site)/[locale]/page.tsx
index 4ea64cf..13c89af 100644
--- a/src/app/(site)/[locale]/page.tsx
+++ b/src/app/(site)/[locale]/page.tsx
@@ -1,12 +1,14 @@
import Image from 'next/image'
import { notFound } from 'next/navigation'
import { BookLink } from '@/components/BookLink'
+import { ContactForm } from '@/components/ContactForm'
import { Footer } from '@/components/Footer'
import { Header } from '@/components/Header'
import Link from 'next/link'
import { getDict, isLocale } from '@/i18n'
import { loadContent } from '@/lib/content'
-import { buildHomeModel, bookUrl, emailLinkHtml, type Card } from '@/lib/home-model'
+import { buildHomeModel, bookUrl, type Card } from '@/lib/home-model'
+import { FALLBACK_EMAIL } from '@/lib/inquiry'
export const dynamic = 'force-dynamic'
@@ -36,6 +38,7 @@ export default async function Home({ params }: { params: Promise<{ locale: strin
const t = getDict(locale)
const { home, news } = await loadContent(locale)
const m = buildHomeModel(home, news, t)
+ const email = m.collaboration.email ?? FALLBACK_EMAIL
const fmt = new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'long', year: 'numeric' })
return (
@@ -113,11 +116,9 @@ export default async function Home({ params }: { params: Promise<{ locale: strin
diff --git a/src/app/actions/inquiry.ts b/src/app/actions/inquiry.ts
new file mode 100644
index 0000000..24d387d
--- /dev/null
+++ b/src/app/actions/inquiry.ts
@@ -0,0 +1,46 @@
+'use server'
+
+import config from '@payload-config'
+import { headers } from 'next/headers'
+import { getPayload } from 'payload'
+import { rateLimited, validateInquiry, type InquiryError } from '@/lib/inquiry'
+import { sendInquiryMail } from '@/lib/mailer'
+
+export type InquiryState = { status: 'idle' } | { status: 'sent' } | { status: 'error'; errors: InquiryError[] }
+
+export async function submitInquiry(_prev: InquiryState, form: FormData): Promise {
+ const v = validateInquiry(Object.fromEntries(form))
+ // Спам тихо «принимаем»: боту не нужно знать, что его распознали.
+ if (!v.ok && v.spam) return { status: 'sent' }
+ if (!v.ok) return { status: 'error', errors: v.errors }
+
+ const h = await headers()
+ const ip = h.get('x-forwarded-for')?.split(',')[0]?.trim() || h.get('x-real-ip') || 'unknown'
+ if (rateLimited(ip)) return { status: 'error', errors: ['tooMany'] }
+
+ const locale = String(form.get('locale') ?? '').slice(0, 5)
+ let saved = false
+ let emailed = false
+ try {
+ const payload = await getPayload({ config })
+ const doc = await payload.create({ collection: 'inquiries', data: { ...v.data, locale }, overrideAccess: true })
+ saved = true
+ try {
+ emailed = await sendInquiryMail(v.data)
+ if (emailed) await payload.update({ collection: 'inquiries', id: doc.id, data: { emailed: true }, overrideAccess: true })
+ } catch (e) {
+ console.error('inquiry mail failed', e)
+ }
+ } catch (e) {
+ console.error('inquiry save failed', e)
+ }
+ // Обращение принято, если оно сохранено или ушло письмом.
+ if (!saved && !emailed) {
+ try {
+ emailed = await sendInquiryMail(v.data)
+ } catch (e) {
+ console.error('inquiry mail failed', e)
+ }
+ }
+ return saved || emailed ? { status: 'sent' } : { status: 'error', errors: ['failed'] }
+}
diff --git a/src/collections/Inquiries.ts b/src/collections/Inquiries.ts
new file mode 100644
index 0000000..154cc41
--- /dev/null
+++ b/src/collections/Inquiries.ts
@@ -0,0 +1,17 @@
+import type { CollectionConfig } from 'payload'
+
+/** Обращения с сайта. Создаются только сервером сайта; читать и править — только вошедшим сотрудникам фонда. */
+export const Inquiries: CollectionConfig = {
+ slug: 'inquiries',
+ labels: { singular: 'Обращение', plural: 'Обращения' },
+ admin: { useAsTitle: 'name', defaultColumns: ['name', 'email', 'organization', 'createdAt', 'emailed'] },
+ access: { create: () => false, read: ({ req }) => Boolean(req.user), update: ({ req }) => Boolean(req.user), delete: ({ req }) => Boolean(req.user) },
+ fields: [
+ { name: 'name', label: 'Имя', type: 'text', required: true },
+ { name: 'email', label: 'Почта', type: 'email', required: true },
+ { name: 'organization', label: 'Организация', type: 'text' },
+ { name: 'message', label: 'Текст обращения', type: 'textarea', required: true },
+ { name: 'locale', label: 'Язык сайта', type: 'text' },
+ { name: 'emailed', label: 'Письмо фонду отправлено', type: 'checkbox', defaultValue: false },
+ ],
+}
diff --git a/src/components/ContactForm.tsx b/src/components/ContactForm.tsx
new file mode 100644
index 0000000..61b87f5
--- /dev/null
+++ b/src/components/ContactForm.tsx
@@ -0,0 +1,76 @@
+'use client'
+
+import Link from 'next/link'
+import { useActionState, useRef } from 'react'
+import { submitInquiry, type InquiryState } from '@/app/actions/inquiry'
+import type { Dict, Locale } from '@/i18n'
+
+/** Форма обращения. dark — на тёмном фоне блока «Сотрудничество». Тексты — из словаря, ошибки по полям. */
+export function ContactForm({ t, locale, email, dark = false }: { t: Dict; locale: Locale; email: string; dark?: boolean }) {
+ const [state, action, pending] = useActionState(submitInquiry, { status: 'idle' })
+ const openedAt = useRef(0)
+ const errors = state.status === 'error' ? state.errors : []
+ const f = t.form
+ const field = `mt-2 block w-full border bg-transparent px-4 py-3 outline-none focus:border-burgundy ${dark ? 'border-paper/40 focus:border-paper' : 'border-line'}`
+ const hint = dark ? 'text-sm text-paper/60' : 'text-sm text-muted'
+ const err = (k: 'name' | 'email' | 'message' | 'consent') =>
+ errors.includes(k) ? {f.errors[k]}
: null
+ const bad = (k: 'name' | 'email' | 'message' | 'consent') => (errors.includes(k) ? { 'aria-invalid': true, 'aria-describedby': `err-${k}` } : {})
+
+ if (state.status === 'sent') {
+ return (
+
+
{f.successTitle}
+
{f.successText}
+
window.location.reload()} className="mt-5 underline underline-offset-4 hover:no-underline">{f.again}
+
+ )
+ }
+
+ return (
+
+ )
+}
diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx
index 2f88d9c..e496809 100644
--- a/src/components/Footer.tsx
+++ b/src/components/Footer.tsx
@@ -9,6 +9,7 @@ export function Footer({ t, locale }: { t: Dict; locale: Locale }) {
© {new Date().getFullYear()} {t.siteName}. {t.footer}
+ {t.contacts.title}
{t.legal.privacy.title}
{t.legal.termsShort}
diff --git a/src/i18n/en.ts b/src/i18n/en.ts
index cfacb84..ee125b7 100644
--- a/src/i18n/en.ts
+++ b/src/i18n/en.ts
@@ -54,7 +54,21 @@ export const en: Dict = {
title: 'Let’s work together',
text: 'If our goal is close to yours, we would be glad to discuss joint projects, partnerships and ideas.',
write: 'Write to us',
- contactMissing: 'Contact details',
+ },
+ contacts: { title: 'Contacts', description: 'Get in touch with Qazaq Legacy Foundation: a message form and an email address.', lead: 'Write to us — we will read your message and reply to the email you give.', emailLabel: 'Email' },
+ form: {
+ name: 'Your name', email: 'Email', organization: 'Organization', optional: 'optional', message: 'Your message',
+ consent: 'I agree to the processing of my personal data in accordance with the ', consentNeed: 'To send the message, please tick the consent box.',
+ submit: 'Send message', sending: 'Sending…',
+ successTitle: 'Message received', successText: 'Thank you! We will read it and reply to the email you gave.', again: 'Write another',
+ fallback: 'If the form does not work, write to us by email: ',
+ errors: {
+ name: 'Please tell us how to address you.', email: 'Please check your email address: we need it to reply.',
+ message: 'Please write your message.', consent: 'Please tick the box to agree to the processing of personal data.',
+ tooLong: 'The text is too long. Please shorten it and try again.',
+ tooMany: 'You have sent too many messages. Please try again a little later.',
+ failed: 'We could not send your message. Please try again or write to us by email.',
+ },
},
book: {
organiser: "Project organiser: Qazaq Legacy Foundation",
diff --git a/src/i18n/kk.ts b/src/i18n/kk.ts
index ce2ded7..da91b13 100644
--- a/src/i18n/kk.ts
+++ b/src/i18n/kk.ts
@@ -54,7 +54,21 @@ export const kk: Dict = {
title: 'Ынтымақтастыққа шақырамыз',
text: 'Біздің мақсат сізге жақын болса, бірлескен жобаларды, серіктестікті және идеяларды талқылауға қуанамыз.',
write: 'Бізге жазыңыз',
- contactMissing: 'Байланыс деректері',
+ },
+ contacts: { title: 'Байланыс', description: 'Qazaq Legacy Foundation қорымен байланысыңыз: өтініш формасы және электрондық пошта.', lead: 'Бізге жазыңыз — өтінішті оқып, көрсеткен поштаңызға жауап береміз.', emailLabel: 'Электрондық пошта' },
+ form: {
+ name: 'Атыңыз', email: 'Электрондық пошта', organization: 'Ұйым', optional: 'міндетті емес', message: 'Өтінішіңіз',
+ consent: 'Жеке деректерімді өңдеуге келісемін: ', consentNeed: 'Өтінішті жіберу үшін келісім белгісі қажет.',
+ submit: 'Өтінішті жіберу', sending: 'Жіберілуде…',
+ successTitle: 'Өтініш қабылданды', successText: 'Рақмет! Біз оны оқып, көрсеткен поштаңызға жауап береміз.', again: 'Тағы жазу',
+ fallback: 'Егер форма жұмыс істемесе, бізге поштаға жазыңыз: ',
+ errors: {
+ name: 'Сізге қалай жүгінуге болатынын көрсетіңіз.', email: 'Электрондық пошта мекенжайын тексеріңіз: біз жауап беру үшін ол қажет.',
+ message: 'Өтініш мәтінін жазыңыз.', consent: 'Жеке деректерді өңдеуге келісім белгісін қойыңыз.',
+ tooLong: 'Мәтін тым ұзын. Қысқартып, қайта көріңіз.',
+ tooMany: 'Сіз тым көп өтініш жібердіңіз. Сәл кейінірек көріңіз.',
+ failed: 'Өтінішті жіберу мүмкін болмады. Қайта көріңіз немесе бізге поштаға жазыңыз.',
+ },
},
book: {
organiser: "Жоба ұйымдастырушысы: Qazaq Legacy Foundation",
diff --git a/src/i18n/ru.ts b/src/i18n/ru.ts
index 80a00ee..94d3d57 100644
--- a/src/i18n/ru.ts
+++ b/src/i18n/ru.ts
@@ -54,7 +54,21 @@ export const ru: Dict = {
title: 'Приглашаем к сотрудничеству',
text: 'Если вам близка наша цель, мы будем рады обсудить совместные проекты, партнёрства и идеи.',
write: 'Написать нам',
- contactMissing: 'Контакты для связи',
+ },
+ contacts: { title: 'Контакты', description: 'Свяжитесь с Qazaq Legacy Foundation: форма обращения и электронная почта.', lead: 'Напишите нам — мы прочитаем обращение и ответим на указанную почту.', emailLabel: 'Электронная почта' },
+ form: {
+ name: 'Ваше имя', email: 'Электронная почта', organization: 'Организация', optional: 'необязательно', message: 'Ваше обращение',
+ consent: 'Я согласен(на) на обработку персональных данных в соответствии с ', consentNeed: 'Чтобы отправить обращение, нужна отметка о согласии.',
+ submit: 'Отправить обращение', sending: 'Отправляем…',
+ successTitle: 'Обращение принято', successText: 'Спасибо! Мы прочитаем его и ответим на указанную вами почту.', again: 'Написать ещё',
+ fallback: 'Если форма не работает, напишите нам на почту: ',
+ errors: {
+ name: 'Укажите, как к вам обращаться.', email: 'Проверьте адрес электронной почты: он нужен, чтобы мы могли ответить.',
+ message: 'Напишите, пожалуйста, текст обращения.', consent: 'Отметьте согласие на обработку персональных данных.',
+ tooLong: 'Текст слишком длинный. Сократите его и попробуйте снова.',
+ tooMany: 'Вы отправили слишком много обращений. Попробуйте чуть позже.',
+ failed: 'Не удалось отправить обращение. Попробуйте ещё раз или напишите нам на почту.',
+ },
},
book: {
organiser: "Организатор проекта: Qazaq Legacy Foundation",
diff --git a/src/i18n/types.ts b/src/i18n/types.ts
index 5f91b75..89c66ce 100644
--- a/src/i18n/types.ts
+++ b/src/i18n/types.ts
@@ -14,7 +14,32 @@ export type Dict = {
projects: { title: string; more: string }
book: { title: string; author: string; paragraphs: string[]; get: string; getNote: string; cover: string; photo: string; role: string; organiser: string; translationReview: string; gallery: string; additions: string[] }
news: { title: string; news: string; event: string }
- collaboration: { title: string; text: string; write: string; contactMissing: string; instagram: string }
+ collaboration: { title: string; text: string; write: string; instagram: string }
+ contacts: { title: string; description: string; lead: string; emailLabel: string }
+ form: {
+ name: string
+ email: string
+ organization: string
+ optional: string
+ message: string
+ consent: string
+ consentNeed: string
+ submit: string
+ sending: string
+ successTitle: string
+ successText: string
+ again: string
+ fallback: string
+ errors: {
+ name: string
+ email: string
+ message: string
+ consent: string
+ tooLong: string
+ tooMany: string
+ failed: string
+ }
+ }
footer: string
legal: {
privacy: { title: string; description: string }
diff --git a/src/lib/inquiry.test.ts b/src/lib/inquiry.test.ts
new file mode 100644
index 0000000..b7c8c98
--- /dev/null
+++ b/src/lib/inquiry.test.ts
@@ -0,0 +1,40 @@
+import { beforeEach, describe, expect, it } from 'vitest'
+import { rateLimited, resetRateLimit, validateInquiry } from './inquiry'
+
+const good = { name: 'Анна', email: 'anna@example.com', organization: '', message: 'Здравствуйте', consent: 'on', website: '', openedAt: 1000 }
+const later = 1000 + 10_000
+
+describe('Сценарий: проверка обращения', () => {
+ it('принимает заполненную форму с согласием; организация необязательна', () => {
+ const r = validateInquiry(good, later)
+ expect(r).toEqual({ ok: true, data: { name: 'Анна', email: 'anna@example.com', organization: '', message: 'Здравствуйте' } })
+ })
+ it('без согласия отправить нельзя', () => {
+ const r = validateInquiry({ ...good, consent: undefined }, later)
+ expect(r).toEqual({ ok: false, errors: ['consent'] })
+ })
+ it('пустые обязательные поля и плохая почта дают подсказки по каждому полю', () => {
+ const r = validateInquiry({ ...good, name: ' ', email: 'нет', message: '' }, later)
+ expect(r).toEqual({ ok: false, errors: ['name', 'email', 'message'] })
+ })
+ it('слишком длинный текст отклоняется', () => {
+ const r = validateInquiry({ ...good, message: 'а'.repeat(5001) }, later)
+ expect(r).toEqual({ ok: false, errors: ['tooLong'] })
+ })
+ it('заполненная скрытая ловушка — спам', () => {
+ expect(validateInquiry({ ...good, website: 'http://spam' }, later)).toEqual({ ok: false, spam: true })
+ })
+ it('отправка быстрее 2,5 секунд — спам', () => {
+ expect(validateInquiry(good, 1500)).toEqual({ ok: false, spam: true })
+ })
+})
+
+describe('Сценарий: ограничение частоты', () => {
+ beforeEach(resetRateLimit)
+ it('четвёртое обращение за 10 минут с одного адреса блокируется, потом снова можно', () => {
+ expect([1, 2, 3].map((i) => rateLimited('a', i))).toEqual([false, false, false])
+ expect(rateLimited('a', 4)).toBe(true)
+ expect(rateLimited('b', 4)).toBe(false)
+ expect(rateLimited('a', 11 * 60 * 1000)).toBe(false)
+ })
+})
diff --git a/src/lib/inquiry.ts b/src/lib/inquiry.ts
new file mode 100644
index 0000000..91e8528
--- /dev/null
+++ b/src/lib/inquiry.ts
@@ -0,0 +1,54 @@
+/** Обращение с сайта: проверка полей и защита от спама. Без капчи: скрытое поле-ловушка, минимальное время заполнения, ограничение частоты. */
+
+export const FALLBACK_EMAIL = 'qazaqlegacy@gmail.com'
+
+export type InquiryInput = { name?: unknown; email?: unknown; organization?: unknown; message?: unknown; consent?: unknown; website?: unknown; openedAt?: unknown }
+export type InquiryField = 'name' | 'email' | 'message' | 'consent'
+export type InquiryError = InquiryField | 'tooLong' | 'tooMany' | 'failed'
+export type Inquiry = { name: string; email: string; organization: string; message: string }
+
+export const LIMITS = { name: 120, email: 200, organization: 200, message: 5000 }
+const MIN_FILL_MS = 2500
+const MAX_PER_WINDOW = 3
+const WINDOW_MS = 10 * 60 * 1000
+
+const str = (v: unknown) => (typeof v === 'string' ? v.trim() : '')
+const EMAIL_RE = /^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]{2,}$/
+
+export type Validation =
+ | { ok: true; data: Inquiry }
+ | { ok: false; spam: true }
+ | { ok: false; spam?: false; errors: InquiryError[] }
+
+/** Спам (ловушка заполнена или форма отправлена мгновенно) — тихо «принимаем» и выбрасываем, не подсказывая боту. */
+export function validateInquiry(input: InquiryInput, now = Date.now()): Validation {
+ if (str(input.website)) return { ok: false, spam: true }
+ const opened = Number(input.openedAt)
+ if (Number.isFinite(opened) && opened > 0 && now - opened < MIN_FILL_MS) return { ok: false, spam: true }
+
+ const data: Inquiry = { name: str(input.name), email: str(input.email), organization: str(input.organization), message: str(input.message) }
+ const errors: InquiryError[] = []
+ if (!data.name) errors.push('name')
+ if (!EMAIL_RE.test(data.email)) errors.push('email')
+ if (!data.message) errors.push('message')
+ if (input.consent !== 'on' && input.consent !== true && input.consent !== 'true') errors.push('consent')
+ if ((Object.keys(LIMITS) as (keyof Inquiry)[]).some((k) => data[k].length > LIMITS[k])) errors.push('tooLong')
+ return errors.length ? { ok: false, errors } : { ok: true, data }
+}
+
+const hits = new Map()
+
+/** Не больше 3 обращений с одного адреса за 10 минут. Память процесса: для защиты от потока мусора достаточно. */
+export function rateLimited(key: string, now = Date.now()): boolean {
+ const recent = (hits.get(key) ?? []).filter((t) => now - t < WINDOW_MS)
+ if (recent.length >= MAX_PER_WINDOW) {
+ hits.set(key, recent)
+ return true
+ }
+ recent.push(now)
+ hits.set(key, recent)
+ if (hits.size > 5000) for (const [k, v] of hits) if (v.every((t) => now - t >= WINDOW_MS)) hits.delete(k)
+ return false
+}
+
+export const resetRateLimit = () => hits.clear()
diff --git a/src/lib/mailer.ts b/src/lib/mailer.ts
new file mode 100644
index 0000000..0ef6940
--- /dev/null
+++ b/src/lib/mailer.ts
@@ -0,0 +1,35 @@
+import nodemailer from 'nodemailer'
+import { FALLBACK_EMAIL, type Inquiry } from './inquiry'
+
+/** Куда уходят обращения. Задаётся INQUIRY_TO, по умолчанию — почта фонда. */
+export const inquiryRecipient = () => process.env.INQUIRY_TO || FALLBACK_EMAIL
+
+const clean = (s: string) => s.replace(/[\r\n]+/g, ' ')
+
+/**
+ * Отправляет обращение фонду по SMTP (SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, SMTP_FROM).
+ * Пока SMTP_HOST не задан — mock: письмо не уходит, в журнал пишется только факт (без текста обращения).
+ * Возвращает true, если письмо реально отправлено.
+ */
+export async function sendInquiryMail(i: Inquiry): Promise {
+ const host = process.env.SMTP_HOST
+ if (!host) {
+ console.warn('mockMailer: SMTP_HOST не задан — письмо с обращением не отправлено, обращение сохранено в админ-панели')
+ return false
+ }
+ const port = Number(process.env.SMTP_PORT || 465)
+ const transport = nodemailer.createTransport({
+ host,
+ port,
+ secure: port === 465,
+ auth: process.env.SMTP_USER ? { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS } : undefined,
+ })
+ await transport.sendMail({
+ from: process.env.SMTP_FROM || process.env.SMTP_USER || inquiryRecipient(),
+ to: inquiryRecipient(),
+ replyTo: { name: clean(i.name), address: i.email },
+ subject: `Обращение с сайта: ${clean(i.name)}`,
+ text: `Имя: ${i.name}\nПочта: ${i.email}\nОрганизация: ${i.organization || '—'}\n\n${i.message}\n`,
+ })
+ return true
+}
diff --git a/src/migrations/20261117_052512_inquiries.json b/src/migrations/20261117_052512_inquiries.json
new file mode 100644
index 0000000..1e07ce4
--- /dev/null
+++ b/src/migrations/20261117_052512_inquiries.json
@@ -0,0 +1,1430 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "tables": {
+ "users_sessions": {
+ "name": "users_sessions",
+ "columns": {
+ "_order": {
+ "name": "_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_parent_id": {
+ "name": "_parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "users_sessions_order_idx": {
+ "name": "users_sessions_order_idx",
+ "columns": [
+ "_order"
+ ],
+ "isUnique": false
+ },
+ "users_sessions_parent_id_idx": {
+ "name": "users_sessions_parent_id_idx",
+ "columns": [
+ "_parent_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "users_sessions_parent_id_fk": {
+ "name": "users_sessions_parent_id_fk",
+ "tableFrom": "users_sessions",
+ "tableTo": "users",
+ "columnsFrom": [
+ "_parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "users": {
+ "name": "users",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "reset_password_token": {
+ "name": "reset_password_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "reset_password_expiration": {
+ "name": "reset_password_expiration",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "salt": {
+ "name": "salt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "hash": {
+ "name": "hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "reset_password_requested_at": {
+ "name": "reset_password_requested_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "login_attempts": {
+ "name": "login_attempts",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 0
+ },
+ "lock_until": {
+ "name": "lock_until",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "users_updated_at_idx": {
+ "name": "users_updated_at_idx",
+ "columns": [
+ "updated_at"
+ ],
+ "isUnique": false
+ },
+ "users_created_at_idx": {
+ "name": "users_created_at_idx",
+ "columns": [
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "users_email_idx": {
+ "name": "users_email_idx",
+ "columns": [
+ "email"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "news": {
+ "name": "news",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'news'"
+ },
+ "date": {
+ "name": "date",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "news_updated_at_idx": {
+ "name": "news_updated_at_idx",
+ "columns": [
+ "updated_at"
+ ],
+ "isUnique": false
+ },
+ "news_created_at_idx": {
+ "name": "news_created_at_idx",
+ "columns": [
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "news_locales": {
+ "name": "news_locales",
+ "columns": {
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "place": {
+ "name": "place",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_locale": {
+ "name": "_locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_parent_id": {
+ "name": "_parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "news_locales_locale_parent_id_unique": {
+ "name": "news_locales_locale_parent_id_unique",
+ "columns": [
+ "_locale",
+ "_parent_id"
+ ],
+ "isUnique": true
+ },
+ "news_locales_parent_id_idx": {
+ "name": "news_locales_parent_id_idx",
+ "columns": [
+ "_parent_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "news_locales_parent_id_fk": {
+ "name": "news_locales_parent_id_fk",
+ "tableFrom": "news_locales",
+ "tableTo": "news",
+ "columnsFrom": [
+ "_parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "inquiries": {
+ "name": "inquiries",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization": {
+ "name": "organization",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "locale": {
+ "name": "locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "emailed": {
+ "name": "emailed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "inquiries_updated_at_idx": {
+ "name": "inquiries_updated_at_idx",
+ "columns": [
+ "updated_at"
+ ],
+ "isUnique": false
+ },
+ "inquiries_created_at_idx": {
+ "name": "inquiries_created_at_idx",
+ "columns": [
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "payload_kv": {
+ "name": "payload_kv",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "data": {
+ "name": "data",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "payload_kv_key_idx": {
+ "name": "payload_kv_key_idx",
+ "columns": [
+ "key"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "payload_locked_documents": {
+ "name": "payload_locked_documents",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "global_slug": {
+ "name": "global_slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "payload_locked_documents_global_slug_idx": {
+ "name": "payload_locked_documents_global_slug_idx",
+ "columns": [
+ "global_slug"
+ ],
+ "isUnique": false
+ },
+ "payload_locked_documents_updated_at_idx": {
+ "name": "payload_locked_documents_updated_at_idx",
+ "columns": [
+ "updated_at"
+ ],
+ "isUnique": false
+ },
+ "payload_locked_documents_created_at_idx": {
+ "name": "payload_locked_documents_created_at_idx",
+ "columns": [
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "payload_locked_documents_rels": {
+ "name": "payload_locked_documents_rels",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "order": {
+ "name": "order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "users_id": {
+ "name": "users_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "news_id": {
+ "name": "news_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "inquiries_id": {
+ "name": "inquiries_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "payload_locked_documents_rels_order_idx": {
+ "name": "payload_locked_documents_rels_order_idx",
+ "columns": [
+ "order"
+ ],
+ "isUnique": false
+ },
+ "payload_locked_documents_rels_parent_idx": {
+ "name": "payload_locked_documents_rels_parent_idx",
+ "columns": [
+ "parent_id"
+ ],
+ "isUnique": false
+ },
+ "payload_locked_documents_rels_path_idx": {
+ "name": "payload_locked_documents_rels_path_idx",
+ "columns": [
+ "path"
+ ],
+ "isUnique": false
+ },
+ "payload_locked_documents_rels_users_id_idx": {
+ "name": "payload_locked_documents_rels_users_id_idx",
+ "columns": [
+ "users_id"
+ ],
+ "isUnique": false
+ },
+ "payload_locked_documents_rels_news_id_idx": {
+ "name": "payload_locked_documents_rels_news_id_idx",
+ "columns": [
+ "news_id"
+ ],
+ "isUnique": false
+ },
+ "payload_locked_documents_rels_inquiries_id_idx": {
+ "name": "payload_locked_documents_rels_inquiries_id_idx",
+ "columns": [
+ "inquiries_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "payload_locked_documents_rels_parent_fk": {
+ "name": "payload_locked_documents_rels_parent_fk",
+ "tableFrom": "payload_locked_documents_rels",
+ "tableTo": "payload_locked_documents",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "payload_locked_documents_rels_users_fk": {
+ "name": "payload_locked_documents_rels_users_fk",
+ "tableFrom": "payload_locked_documents_rels",
+ "tableTo": "users",
+ "columnsFrom": [
+ "users_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "payload_locked_documents_rels_news_fk": {
+ "name": "payload_locked_documents_rels_news_fk",
+ "tableFrom": "payload_locked_documents_rels",
+ "tableTo": "news",
+ "columnsFrom": [
+ "news_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "payload_locked_documents_rels_inquiries_fk": {
+ "name": "payload_locked_documents_rels_inquiries_fk",
+ "tableFrom": "payload_locked_documents_rels",
+ "tableTo": "inquiries",
+ "columnsFrom": [
+ "inquiries_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "payload_preferences": {
+ "name": "payload_preferences",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "payload_preferences_key_idx": {
+ "name": "payload_preferences_key_idx",
+ "columns": [
+ "key"
+ ],
+ "isUnique": false
+ },
+ "payload_preferences_updated_at_idx": {
+ "name": "payload_preferences_updated_at_idx",
+ "columns": [
+ "updated_at"
+ ],
+ "isUnique": false
+ },
+ "payload_preferences_created_at_idx": {
+ "name": "payload_preferences_created_at_idx",
+ "columns": [
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "payload_preferences_rels": {
+ "name": "payload_preferences_rels",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "order": {
+ "name": "order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "users_id": {
+ "name": "users_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "payload_preferences_rels_order_idx": {
+ "name": "payload_preferences_rels_order_idx",
+ "columns": [
+ "order"
+ ],
+ "isUnique": false
+ },
+ "payload_preferences_rels_parent_idx": {
+ "name": "payload_preferences_rels_parent_idx",
+ "columns": [
+ "parent_id"
+ ],
+ "isUnique": false
+ },
+ "payload_preferences_rels_path_idx": {
+ "name": "payload_preferences_rels_path_idx",
+ "columns": [
+ "path"
+ ],
+ "isUnique": false
+ },
+ "payload_preferences_rels_users_id_idx": {
+ "name": "payload_preferences_rels_users_id_idx",
+ "columns": [
+ "users_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "payload_preferences_rels_parent_fk": {
+ "name": "payload_preferences_rels_parent_fk",
+ "tableFrom": "payload_preferences_rels",
+ "tableTo": "payload_preferences",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "payload_preferences_rels_users_fk": {
+ "name": "payload_preferences_rels_users_fk",
+ "tableFrom": "payload_preferences_rels",
+ "tableTo": "users",
+ "columnsFrom": [
+ "users_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "payload_migrations": {
+ "name": "payload_migrations",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "batch": {
+ "name": "batch",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))"
+ }
+ },
+ "indexes": {
+ "payload_migrations_updated_at_idx": {
+ "name": "payload_migrations_updated_at_idx",
+ "columns": [
+ "updated_at"
+ ],
+ "isUnique": false
+ },
+ "payload_migrations_created_at_idx": {
+ "name": "payload_migrations_created_at_idx",
+ "columns": [
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "home_directions": {
+ "name": "home_directions",
+ "columns": {
+ "_order": {
+ "name": "_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_parent_id": {
+ "name": "_parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "home_directions_order_idx": {
+ "name": "home_directions_order_idx",
+ "columns": [
+ "_order"
+ ],
+ "isUnique": false
+ },
+ "home_directions_parent_id_idx": {
+ "name": "home_directions_parent_id_idx",
+ "columns": [
+ "_parent_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "home_directions_parent_id_fk": {
+ "name": "home_directions_parent_id_fk",
+ "tableFrom": "home_directions",
+ "tableTo": "home",
+ "columnsFrom": [
+ "_parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "home_directions_locales": {
+ "name": "home_directions_locales",
+ "columns": {
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_locale": {
+ "name": "_locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_parent_id": {
+ "name": "_parent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "home_directions_locales_locale_parent_id_unique": {
+ "name": "home_directions_locales_locale_parent_id_unique",
+ "columns": [
+ "_locale",
+ "_parent_id"
+ ],
+ "isUnique": true
+ },
+ "home_directions_locales_parent_id_idx": {
+ "name": "home_directions_locales_parent_id_idx",
+ "columns": [
+ "_parent_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "home_directions_locales_parent_id_fk": {
+ "name": "home_directions_locales_parent_id_fk",
+ "tableFrom": "home_directions_locales",
+ "tableTo": "home_directions",
+ "columnsFrom": [
+ "_parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "home_projects": {
+ "name": "home_projects",
+ "columns": {
+ "_order": {
+ "name": "_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_parent_id": {
+ "name": "_parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "home_projects_order_idx": {
+ "name": "home_projects_order_idx",
+ "columns": [
+ "_order"
+ ],
+ "isUnique": false
+ },
+ "home_projects_parent_id_idx": {
+ "name": "home_projects_parent_id_idx",
+ "columns": [
+ "_parent_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "home_projects_parent_id_fk": {
+ "name": "home_projects_parent_id_fk",
+ "tableFrom": "home_projects",
+ "tableTo": "home",
+ "columnsFrom": [
+ "_parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "home_projects_locales": {
+ "name": "home_projects_locales",
+ "columns": {
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_locale": {
+ "name": "_locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_parent_id": {
+ "name": "_parent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "home_projects_locales_locale_parent_id_unique": {
+ "name": "home_projects_locales_locale_parent_id_unique",
+ "columns": [
+ "_locale",
+ "_parent_id"
+ ],
+ "isUnique": true
+ },
+ "home_projects_locales_parent_id_idx": {
+ "name": "home_projects_locales_parent_id_idx",
+ "columns": [
+ "_parent_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "home_projects_locales_parent_id_fk": {
+ "name": "home_projects_locales_parent_id_fk",
+ "tableFrom": "home_projects_locales",
+ "tableTo": "home_projects",
+ "columnsFrom": [
+ "_parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "home": {
+ "name": "home",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "contact_email": {
+ "name": "contact_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "home_locales": {
+ "name": "home_locales",
+ "columns": {
+ "mission": {
+ "name": "mission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "collaboration": {
+ "name": "collaboration",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_locale": {
+ "name": "_locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_parent_id": {
+ "name": "_parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "home_locales_locale_parent_id_unique": {
+ "name": "home_locales_locale_parent_id_unique",
+ "columns": [
+ "_locale",
+ "_parent_id"
+ ],
+ "isUnique": true
+ },
+ "home_locales_parent_id_idx": {
+ "name": "home_locales_parent_id_idx",
+ "columns": [
+ "_parent_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "home_locales_parent_id_fk": {
+ "name": "home_locales_parent_id_fk",
+ "tableFrom": "home_locales",
+ "tableTo": "home",
+ "columnsFrom": [
+ "_parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "legal": {
+ "name": "legal",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "privacy_updated": {
+ "name": "privacy_updated",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "terms_updated": {
+ "name": "terms_updated",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "legal_locales": {
+ "name": "legal_locales",
+ "columns": {
+ "privacy_body": {
+ "name": "privacy_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "terms_body": {
+ "name": "terms_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_locale": {
+ "name": "_locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "_parent_id": {
+ "name": "_parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "legal_locales_locale_parent_id_unique": {
+ "name": "legal_locales_locale_parent_id_unique",
+ "columns": [
+ "_locale",
+ "_parent_id"
+ ],
+ "isUnique": true
+ },
+ "legal_locales_parent_id_idx": {
+ "name": "legal_locales_parent_id_idx",
+ "columns": [
+ "_parent_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "legal_locales_parent_id_fk": {
+ "name": "legal_locales_parent_id_fk",
+ "tableFrom": "legal_locales",
+ "tableTo": "legal",
+ "columnsFrom": [
+ "_parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ },
+ "id": "afc6a4ee-9355-42c6-bd6a-f946ed616f23",
+ "prevId": "00000000-0000-0000-0000-000000000000"
+}
\ No newline at end of file
diff --git a/src/migrations/20261117_052512_inquiries.ts b/src/migrations/20261117_052512_inquiries.ts
new file mode 100644
index 0000000..bc2ba66
--- /dev/null
+++ b/src/migrations/20261117_052512_inquiries.ts
@@ -0,0 +1,46 @@
+import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-sqlite'
+
+export async function up({ db, payload, req }: MigrateUpArgs): Promise {
+ await db.run(sql`CREATE TABLE \`inquiries\` (
+ \`id\` integer PRIMARY KEY NOT NULL,
+ \`name\` text NOT NULL,
+ \`email\` text NOT NULL,
+ \`organization\` text,
+ \`message\` text NOT NULL,
+ \`locale\` text,
+ \`emailed\` integer DEFAULT false,
+ \`updated_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
+ \`created_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL
+ );
+ `)
+ await db.run(sql`CREATE INDEX \`inquiries_updated_at_idx\` ON \`inquiries\` (\`updated_at\`);`)
+ await db.run(sql`CREATE INDEX \`inquiries_created_at_idx\` ON \`inquiries\` (\`created_at\`);`)
+ await db.run(sql`ALTER TABLE \`payload_locked_documents_rels\` ADD \`inquiries_id\` integer REFERENCES inquiries(id);`)
+ await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_inquiries_id_idx\` ON \`payload_locked_documents_rels\` (\`inquiries_id\`);`)
+}
+
+export async function down({ db, payload, req }: MigrateDownArgs): Promise {
+ await db.run(sql`DROP TABLE \`inquiries\`;`)
+ await db.run(sql`PRAGMA foreign_keys=OFF;`)
+ await db.run(sql`CREATE TABLE \`__new_payload_locked_documents_rels\` (
+ \`id\` integer PRIMARY KEY NOT NULL,
+ \`order\` integer,
+ \`parent_id\` integer NOT NULL,
+ \`path\` text NOT NULL,
+ \`users_id\` integer,
+ \`news_id\` integer,
+ FOREIGN KEY (\`parent_id\`) REFERENCES \`payload_locked_documents\`(\`id\`) ON UPDATE no action ON DELETE cascade,
+ FOREIGN KEY (\`users_id\`) REFERENCES \`users\`(\`id\`) ON UPDATE no action ON DELETE cascade,
+ FOREIGN KEY (\`news_id\`) REFERENCES \`news\`(\`id\`) ON UPDATE no action ON DELETE cascade
+ );
+ `)
+ await db.run(sql`INSERT INTO \`__new_payload_locked_documents_rels\`("id", "order", "parent_id", "path", "users_id", "news_id") SELECT "id", "order", "parent_id", "path", "users_id", "news_id" FROM \`payload_locked_documents_rels\`;`)
+ await db.run(sql`DROP TABLE \`payload_locked_documents_rels\`;`)
+ await db.run(sql`ALTER TABLE \`__new_payload_locked_documents_rels\` RENAME TO \`payload_locked_documents_rels\`;`)
+ await db.run(sql`PRAGMA foreign_keys=ON;`)
+ await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_order_idx\` ON \`payload_locked_documents_rels\` (\`order\`);`)
+ await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_parent_idx\` ON \`payload_locked_documents_rels\` (\`parent_id\`);`)
+ await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_path_idx\` ON \`payload_locked_documents_rels\` (\`path\`);`)
+ await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_users_id_idx\` ON \`payload_locked_documents_rels\` (\`users_id\`);`)
+ await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_news_id_idx\` ON \`payload_locked_documents_rels\` (\`news_id\`);`)
+}
diff --git a/src/migrations/index.ts b/src/migrations/index.ts
index 683012f..6286fce 100644
--- a/src/migrations/index.ts
+++ b/src/migrations/index.ts
@@ -1,6 +1,7 @@
import * as migration_20261117_120000_legal_texts from './20261117_120000_legal_texts';
import * as migration_20261116_103502_init from './20261116_103502_init';
import * as migration_20261117_045758_legal from './20261117_045758_legal';
+import * as migration_20261117_052512_inquiries from './20261117_052512_inquiries';
export const migrations = [
@@ -12,7 +13,12 @@ export const migrations = [
{
up: migration_20261117_045758_legal.up,
down: migration_20261117_045758_legal.down,
- name: '20261117_045758_legal'
+ name: '20261117_045758_legal',
+ },
+ {
+ up: migration_20261117_052512_inquiries.up,
+ down: migration_20261117_052512_inquiries.down,
+ name: '20261117_052512_inquiries'
},
{ up: migration_20261117_120000_legal_texts.up, down: migration_20261117_120000_legal_texts.down, name: '20261117_120000_legal_texts' },
];
diff --git a/src/payload-types.ts b/src/payload-types.ts
index 7efece0..2db0121 100644
--- a/src/payload-types.ts
+++ b/src/payload-types.ts
@@ -69,6 +69,7 @@ export interface Config {
collections: {
users: User;
news: News;
+ inquiries: Inquiry;
'payload-kv': PayloadKv;
'payload-locked-documents': PayloadLockedDocument;
'payload-preferences': PayloadPreference;
@@ -78,6 +79,7 @@ export interface Config {
collectionsSelect: {
users: UsersSelect | UsersSelect;
news: NewsSelect | NewsSelect;
+ inquiries: InquiriesSelect | InquiriesSelect;
'payload-kv': PayloadKvSelect | PayloadKvSelect;
'payload-locked-documents': PayloadLockedDocumentsSelect | PayloadLockedDocumentsSelect;
'payload-preferences': PayloadPreferencesSelect | PayloadPreferencesSelect;
@@ -163,6 +165,21 @@ export interface News {
updatedAt: string;
createdAt: string;
}
+/**
+ * This interface was referenced by `Config`'s JSON-Schema
+ * via the `definition` "inquiries".
+ */
+export interface Inquiry {
+ id: number;
+ name: string;
+ email: string;
+ organization?: string | null;
+ message: string;
+ locale?: string | null;
+ emailed?: boolean | null;
+ updatedAt: string;
+ createdAt: string;
+}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-kv".
@@ -194,6 +211,10 @@ export interface PayloadLockedDocument {
| ({
relationTo: 'news';
value: number | News;
+ } | null)
+ | ({
+ relationTo: 'inquiries';
+ value: number | Inquiry;
} | null);
globalSlug?: string | null;
user: {
@@ -273,6 +294,20 @@ export interface NewsSelect {
updatedAt?: T;
createdAt?: T;
}
+/**
+ * This interface was referenced by `Config`'s JSON-Schema
+ * via the `definition` "inquiries_select".
+ */
+export interface InquiriesSelect {
+ name?: T;
+ email?: T;
+ organization?: T;
+ message?: T;
+ locale?: T;
+ emailed?: T;
+ updatedAt?: T;
+ createdAt?: T;
+}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-kv_select".
diff --git a/src/payload.config.ts b/src/payload.config.ts
index 9211c4a..c82fc2d 100644
--- a/src/payload.config.ts
+++ b/src/payload.config.ts
@@ -4,6 +4,7 @@ import { buildConfig } from 'payload'
import { sqliteAdapter } from '@payloadcms/db-sqlite'
import { lexicalEditor } from '@payloadcms/richtext-lexical'
import { Users } from './collections/Users'
+import { Inquiries } from './collections/Inquiries'
import { News } from './collections/News'
import { Home } from './globals/Home'
import { Legal } from './globals/Legal'
@@ -13,7 +14,7 @@ const dirname = path.dirname(fileURLToPath(import.meta.url))
export default buildConfig({
admin: { user: Users.slug },
- collections: [Users, News],
+ collections: [Users, News, Inquiries],
globals: [Home, Legal],
editor: lexicalEditor(),
// mock-секрет только для запуска без настроек; на стенде задаётся PAYLOAD_SECRET.