This commit is contained in:
parent
e948cfe864
commit
dabdfbd2db
13 changed files with 28215 additions and 96 deletions
|
|
@ -3,7 +3,6 @@ import { Section } from '@/components/Section/Section'
|
||||||
import { Container } from '@/components/Container/Container'
|
import { Container } from '@/components/Container/Container'
|
||||||
import { Title } from '@/components/Title/Title'
|
import { Title } from '@/components/Title/Title'
|
||||||
import { P } from '@/components/Text/Paragraph'
|
import { P } from '@/components/Text/Paragraph'
|
||||||
import { DonationForm } from '@/components/DonationForm/DonationForm'
|
|
||||||
import { ClassifiedsFromApi } from '@/components/Classifieds/ClassifiedsFromApi'
|
import { ClassifiedsFromApi } from '@/components/Classifieds/ClassifiedsFromApi'
|
||||||
|
|
||||||
export const dynamic = 'force-dynamic'
|
export const dynamic = 'force-dynamic'
|
||||||
|
|
@ -44,7 +43,7 @@ export default function Page() {
|
||||||
</Container>
|
</Container>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<DonationForm />
|
{/* DonationForm used to be here */}
|
||||||
|
|
||||||
<Section padding={"small"} paddingBottom={"large"}>
|
<Section padding={"small"} paddingBottom={"large"}>
|
||||||
<Container>
|
<Container>
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,8 @@ import { PageHeader } from '@/compositions/PageHeader/PageHeader'
|
||||||
import { fetchDonationForm } from '@/fetch/donationform'
|
import { fetchDonationForm } from '@/fetch/donationform'
|
||||||
import { notFound } from 'next/navigation'
|
import { notFound } from 'next/navigation'
|
||||||
import { RichText } from '@/components/Text/RichText'
|
import { RichText } from '@/components/Text/RichText'
|
||||||
import { Container } from '@/components/Container/Container'
|
|
||||||
import { Section } from '@/components/Section/Section'
|
import { Section } from '@/components/Section/Section'
|
||||||
import styles from '@/components/DonationForm/styles.module.scss'
|
import { DonationForm } from '@/components/DonationForm/DonationForm'
|
||||||
import { Row } from '@/components/Flex/Row'
|
|
||||||
import { Col } from '@/components/Flex/Col'
|
|
||||||
import Image from 'next/image'
|
|
||||||
|
|
||||||
export default async function DonationPage({ params }: { params: Promise<{id: string}>}) {
|
export default async function DonationPage({ params }: { params: Promise<{id: string}>}) {
|
||||||
const id = (await params).id;
|
const id = (await params).id;
|
||||||
|
|
@ -26,29 +22,14 @@ export default async function DonationPage({ params }: { params: Promise<{id: st
|
||||||
description={'Wir freuen uns über jede Spende und wissen: „Wer gibt, empfängt!“ (Lk 6,38)'}
|
description={'Wir freuen uns über jede Spende und wissen: „Wer gibt, empfängt!“ (Lk 6,38)'}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Container>
|
|
||||||
<Section padding={"small"} paddingBottom={"medium"}>
|
|
||||||
<Row alignItems={"center"}>
|
|
||||||
<Col>
|
|
||||||
{ typeof image == "object" && image.url &&
|
|
||||||
<Image src={image.url} width={300} height={300} alt="" unoptimized={false}/>
|
|
||||||
}
|
|
||||||
</Col>
|
|
||||||
<Col>
|
|
||||||
<RichText data={data.text} />
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
</Section>
|
|
||||||
<Section padding={"small"} paddingBottom={"large"}>
|
<Section padding={"small"} paddingBottom={"large"}>
|
||||||
<iframe
|
<DonationForm
|
||||||
className={styles.iframe}
|
url={data.url}
|
||||||
scrolling="no"
|
photoUrl={typeof image == "object" && image?.url ? image.url : undefined}
|
||||||
src={data.url}
|
>
|
||||||
width="100%"
|
<RichText data={data.text} />
|
||||||
height="800px">
|
</DonationForm>
|
||||||
</iframe>
|
|
||||||
</Section>
|
</Section>
|
||||||
</Container>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -12,6 +12,14 @@ export const DonationForms: CollectionConfig = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fields: [
|
fields: [
|
||||||
|
{
|
||||||
|
name: 'title',
|
||||||
|
type: 'text',
|
||||||
|
label: {
|
||||||
|
de: 'Titel'
|
||||||
|
},
|
||||||
|
required: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'photo',
|
name: 'photo',
|
||||||
type: 'upload',
|
type: 'upload',
|
||||||
|
|
@ -19,7 +27,6 @@ export const DonationForms: CollectionConfig = {
|
||||||
label: {
|
label: {
|
||||||
de: 'Bild'
|
de: 'Bild'
|
||||||
},
|
},
|
||||||
required: true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'text',
|
name: 'text',
|
||||||
|
|
@ -36,6 +43,7 @@ export const DonationForms: CollectionConfig = {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
admin: {
|
admin: {
|
||||||
|
useAsTitle: 'title',
|
||||||
hidden: hide
|
hidden: hide
|
||||||
},
|
},
|
||||||
access: {
|
access: {
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,15 @@ export const DonationBlock: Block = {
|
||||||
de: 'Spendeformular'
|
de: 'Spendeformular'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fields: []
|
fields: [
|
||||||
|
{
|
||||||
|
name: 'form',
|
||||||
|
type: 'relationship',
|
||||||
|
relationTo: 'donation-form',
|
||||||
|
label: {
|
||||||
|
de: 'Spendenformular'
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -8,4 +8,29 @@ const meta: Meta<typeof DonationForm> = {
|
||||||
type Story = StoryObj<typeof DonationForm>
|
type Story = StoryObj<typeof DonationForm>
|
||||||
export default meta
|
export default meta
|
||||||
|
|
||||||
export const Default: Story = {}
|
export const Default: Story = {
|
||||||
|
args: {
|
||||||
|
title: 'Ihre Hilfe kommt an',
|
||||||
|
url: 'https://spenden.tools/37111/Formular/SpendenFormularId/318?KostenstelleId=0',
|
||||||
|
children: (
|
||||||
|
<>
|
||||||
|
<p>
|
||||||
|
Mit Ihrer Spende leisten Sie einen wertvollen Beitrag für unsere Arbeit. Ihr Engagement ermöglicht es uns,
|
||||||
|
Menschen in Not zu helfen und ihnen eine bessere Zukunft zu ermöglichen.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Konto:</strong> Pfarrei Heilige Drei Könige<br/>
|
||||||
|
<strong>IBAN:</strong> DE1237 0601 9360 0044 9006
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export const WithPhoto: Story = {
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
title: undefined,
|
||||||
|
photoUrl: 'https://picsum.photos/600/400',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,43 @@
|
||||||
|
import { ReactNode } from 'react'
|
||||||
|
import Image from 'next/image'
|
||||||
import { Container } from '@/components/Container/Container'
|
import { Container } from '@/components/Container/Container'
|
||||||
import { Title } from '@/components/Title/Title'
|
import { Title } from '@/components/Title/Title'
|
||||||
import { Row } from '@/components/Flex/Row'
|
import { RichText } from '@/components/Text/RichText'
|
||||||
|
import { DonationForm as DonationFormDoc } from '@/payload-types'
|
||||||
import styles from "./styles.module.scss"
|
import styles from "./styles.module.scss"
|
||||||
|
|
||||||
export const DonationForm = () => {
|
type DonationFormProps = {
|
||||||
|
title?: string
|
||||||
|
photoUrl?: string
|
||||||
|
url: string
|
||||||
|
children: ReactNode
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DonationForm = ({ title, photoUrl, url, children }: DonationFormProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{title &&
|
||||||
<Container>
|
<Container>
|
||||||
<Title
|
<Title
|
||||||
title={'Ihre Hilfe kommt an'}
|
title={title}
|
||||||
fontStyle={"sans-serif"}
|
fontStyle={"sans-serif"}
|
||||||
size={'md'}
|
size={'md'}
|
||||||
/>
|
/>
|
||||||
</Container>
|
</Container>
|
||||||
|
}
|
||||||
|
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={styles.col1}>
|
<div className={styles.col1}>
|
||||||
<p>
|
{photoUrl &&
|
||||||
Mit Ihrer Spende leisten Sie einen wertvollen Beitrag für unsere Arbeit. Ihr Engagement ermöglicht es uns,
|
<Image className={styles.photo} src={photoUrl} width={300} height={300} alt="" />
|
||||||
Menschen in Not zu helfen und ihnen eine bessere Zukunft zu ermöglichen.
|
}
|
||||||
</p>
|
{children}
|
||||||
|
|
||||||
<p>
|
|
||||||
Spenden Sie jetzt und unterstützen Sie unsere Mission! Nutzen Sie dazu einfach das Spendenformular nebenan oder überweisen Sie direkt auf unser Konto:<br/>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<strong>Konto:</strong> Pfarrei Heilige Drei Könige<br/>
|
|
||||||
<strong>IBAN:</strong> DE1237 0601 9360 0044 9006
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Jede Spende, egal ob groß oder klein, macht einen Unterschied. Von Herzen danken wir Ihnen für Ihre Unterstützung!
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.col2}>
|
<div className={styles.col2}>
|
||||||
<iframe
|
<iframe
|
||||||
className={styles.iframe}
|
className={styles.iframe}
|
||||||
scrolling="no"
|
scrolling="no"
|
||||||
src="https://spenden.tools/37111/Formular/SpendenFormularId/318?KostenstelleId=0"
|
src={url}
|
||||||
width="100%"
|
width="100%"
|
||||||
height="800px">
|
height="800px">
|
||||||
</iframe>
|
</iframe>
|
||||||
|
|
@ -46,3 +46,20 @@ export const DonationForm = () => {
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Renders a DonationForms document linked from a "donation" block.
|
||||||
|
export const DonationBlockForm = ({ form }: { form: string | DonationFormDoc }) => {
|
||||||
|
if (typeof form !== 'object') {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DonationForm
|
||||||
|
title={form.title}
|
||||||
|
url={form.url}
|
||||||
|
photoUrl={typeof form.photo === 'object' && form.photo?.url ? form.photo.url : undefined}
|
||||||
|
>
|
||||||
|
<RichText data={form.text} />
|
||||||
|
</DonationForm>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,14 @@
|
||||||
margin-block-start: 0;
|
margin-block-start: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.photo {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.col2 {
|
.col2 {
|
||||||
width: 600px;
|
width: 600px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { Button } from '@/components/Button/Button'
|
||||||
import { ContactSection } from '@/compositions/ContactSection/ContactSection'
|
import { ContactSection } from '@/compositions/ContactSection/ContactSection'
|
||||||
import { Gallery } from '@/components/Gallery/Gallery'
|
import { Gallery } from '@/components/Gallery/Gallery'
|
||||||
import { transformGallery } from '@/utils/dto/gallery'
|
import { transformGallery } from '@/utils/dto/gallery'
|
||||||
import { DonationForm } from '@/components/DonationForm/DonationForm'
|
import { DonationBlockForm } from '@/components/DonationForm/DonationForm'
|
||||||
import { YoutubePlayer } from '@/components/YoutubePlayer/YoutubePlayer'
|
import { YoutubePlayer } from '@/components/YoutubePlayer/YoutubePlayer'
|
||||||
import { PageHeader } from '@/compositions/PageHeader/PageHeader'
|
import { PageHeader } from '@/compositions/PageHeader/PageHeader'
|
||||||
import { Title } from '@/components/Title/Title'
|
import { Title } from '@/components/Title/Title'
|
||||||
|
|
@ -87,7 +87,7 @@ export function Blocks({ content }: BlocksProps) {
|
||||||
|
|
||||||
if (item.blockType === 'donation') {
|
if (item.blockType === 'donation') {
|
||||||
return <Section key={item.id} padding={'small'} paddingBottom={'large'}>
|
return <Section key={item.id} padding={'small'} paddingBottom={'large'}>
|
||||||
<DonationForm />
|
<DonationBlockForm form={item.form} />
|
||||||
</Section>
|
</Section>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { Container } from '@/components/Container/Container'
|
||||||
import { HTMLText } from '@/components/Text/HTMLText'
|
import { HTMLText } from '@/components/Text/HTMLText'
|
||||||
import { Section } from '@/components/Section/Section'
|
import { Section } from '@/components/Section/Section'
|
||||||
import { Button } from '@/components/Button/Button'
|
import { Button } from '@/components/Button/Button'
|
||||||
import { DonationForm } from '@/components/DonationForm/DonationForm'
|
import { DonationBlockForm } from '@/components/DonationForm/DonationForm'
|
||||||
import { YoutubePlayer } from '@/components/YoutubePlayer/YoutubePlayer'
|
import { YoutubePlayer } from '@/components/YoutubePlayer/YoutubePlayer'
|
||||||
import { DonationAppeal } from '@/components/DonationAppeal/DonationAppeal'
|
import { DonationAppeal } from '@/components/DonationAppeal/DonationAppeal'
|
||||||
import { ImageCardsBlock } from '@/compositions/Blocks/ImageCardsBlock'
|
import { ImageCardsBlock } from '@/compositions/Blocks/ImageCardsBlock'
|
||||||
|
|
@ -56,7 +56,7 @@ export function ParishBlocks({ content }: BlocksProps) {
|
||||||
|
|
||||||
if (item.blockType === "donation") {
|
if (item.blockType === "donation") {
|
||||||
return <Section key={item.id} padding={"small"} paddingBottom={"large"}>
|
return <Section key={item.id} padding={"small"} paddingBottom={"large"}>
|
||||||
<DonationForm />
|
<DonationBlockForm form={item.form} />
|
||||||
</Section>
|
</Section>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
27938
src/migrations/20261008_075404_donation_form_title_and_block_link.json
Normal file
27938
src/migrations/20261008_075404_donation_form_title_and_block_link.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,117 @@
|
||||||
|
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||||
|
|
||||||
|
// The "donation" block used to render a hardcoded form in DonationForm.tsx. Existing
|
||||||
|
// blocks now link to this standard donation-form document instead.
|
||||||
|
const STANDARD_TITLE = 'Ihre Hilfe kommt an'
|
||||||
|
const STANDARD_URL = 'https://spenden.tools/37111/Formular/SpendenFormularId/318?KostenstelleId=0'
|
||||||
|
|
||||||
|
// "text" is required, so the standard form starts with an empty rich text document.
|
||||||
|
const EMPTY_TEXT = {
|
||||||
|
root: { type: 'root', children: [], direction: null, format: '', indent: 0, version: 1 },
|
||||||
|
}
|
||||||
|
|
||||||
|
const DONATION_BLOCK_TABLES = [
|
||||||
|
'pages_blocks_donation',
|
||||||
|
'_pages_v_blocks_donation',
|
||||||
|
'blog_blocks_donation',
|
||||||
|
'_blog_v_blocks_donation',
|
||||||
|
'parish_blocks_donation',
|
||||||
|
'_parish_v_blocks_donation',
|
||||||
|
'group_blocks_donation',
|
||||||
|
'_group_v_blocks_donation',
|
||||||
|
]
|
||||||
|
|
||||||
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-10-11T07:54:03.780Z';
|
||||||
|
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-10-11T07:54:04.080Z';
|
||||||
|
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-11-07T08:54:04.107Z';
|
||||||
|
ALTER TABLE "donation_form" ALTER COLUMN "photo_id" DROP NOT NULL;
|
||||||
|
ALTER TABLE "parish_blocks_donation" ADD COLUMN "form_id" uuid;
|
||||||
|
ALTER TABLE "_parish_v_blocks_donation" ADD COLUMN "form_id" uuid;
|
||||||
|
ALTER TABLE "blog_blocks_donation" ADD COLUMN "form_id" uuid;
|
||||||
|
ALTER TABLE "_blog_v_blocks_donation" ADD COLUMN "form_id" uuid;
|
||||||
|
ALTER TABLE "group_blocks_donation" ADD COLUMN "form_id" uuid;
|
||||||
|
ALTER TABLE "_group_v_blocks_donation" ADD COLUMN "form_id" uuid;
|
||||||
|
ALTER TABLE "donation_form" ADD COLUMN "title" varchar;
|
||||||
|
ALTER TABLE "pages_blocks_donation" ADD COLUMN "form_id" uuid;
|
||||||
|
ALTER TABLE "_pages_v_blocks_donation" ADD COLUMN "form_id" uuid;
|
||||||
|
ALTER TABLE "parish_blocks_donation" ADD CONSTRAINT "parish_blocks_donation_form_id_donation_form_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."donation_form"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "_parish_v_blocks_donation" ADD CONSTRAINT "_parish_v_blocks_donation_form_id_donation_form_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."donation_form"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "blog_blocks_donation" ADD CONSTRAINT "blog_blocks_donation_form_id_donation_form_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."donation_form"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "_blog_v_blocks_donation" ADD CONSTRAINT "_blog_v_blocks_donation_form_id_donation_form_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."donation_form"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "group_blocks_donation" ADD CONSTRAINT "group_blocks_donation_form_id_donation_form_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."donation_form"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "_group_v_blocks_donation" ADD CONSTRAINT "_group_v_blocks_donation_form_id_donation_form_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."donation_form"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "pages_blocks_donation" ADD CONSTRAINT "pages_blocks_donation_form_id_donation_form_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."donation_form"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "_pages_v_blocks_donation" ADD CONSTRAINT "_pages_v_blocks_donation_form_id_donation_form_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."donation_form"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
CREATE INDEX "parish_blocks_donation_form_idx" ON "parish_blocks_donation" USING btree ("form_id");
|
||||||
|
CREATE INDEX "_parish_v_blocks_donation_form_idx" ON "_parish_v_blocks_donation" USING btree ("form_id");
|
||||||
|
CREATE INDEX "blog_blocks_donation_form_idx" ON "blog_blocks_donation" USING btree ("form_id");
|
||||||
|
CREATE INDEX "_blog_v_blocks_donation_form_idx" ON "_blog_v_blocks_donation" USING btree ("form_id");
|
||||||
|
CREATE INDEX "group_blocks_donation_form_idx" ON "group_blocks_donation" USING btree ("form_id");
|
||||||
|
CREATE INDEX "_group_v_blocks_donation_form_idx" ON "_group_v_blocks_donation" USING btree ("form_id");
|
||||||
|
CREATE INDEX "pages_blocks_donation_form_idx" ON "pages_blocks_donation" USING btree ("form_id");
|
||||||
|
CREATE INDEX "_pages_v_blocks_donation_form_idx" ON "_pages_v_blocks_donation" USING btree ("form_id");`)
|
||||||
|
|
||||||
|
// Existing forms predate the title field.
|
||||||
|
await db.execute(sql`UPDATE "donation_form" SET "title" = 'Spendenformular' WHERE "title" IS NULL;`)
|
||||||
|
await db.execute(sql`ALTER TABLE "donation_form" ALTER COLUMN "title" SET NOT NULL;`)
|
||||||
|
|
||||||
|
// Reuse the standard form if it already exists, otherwise create it.
|
||||||
|
const existing = await db.execute(sql`SELECT "id" FROM "donation_form" WHERE "url" = ${STANDARD_URL} LIMIT 1;`)
|
||||||
|
const standardId = (existing.rows[0]?.id ??
|
||||||
|
(
|
||||||
|
await db.execute(sql`
|
||||||
|
INSERT INTO "donation_form" ("title", "text", "url")
|
||||||
|
VALUES (${STANDARD_TITLE}, ${JSON.stringify(EMPTY_TEXT)}::jsonb, ${STANDARD_URL})
|
||||||
|
RETURNING "id";`)
|
||||||
|
).rows[0].id) as string
|
||||||
|
|
||||||
|
// Link every existing donation block (including saved versions) to it, since "form" is required.
|
||||||
|
for (const table of DONATION_BLOCK_TABLES) {
|
||||||
|
await db.execute(sql`UPDATE ${sql.identifier(table)} SET "form_id" = ${standardId} WHERE "form_id" IS NULL;`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
// Forms without a photo (such as the standard form created above) can't exist in the old schema.
|
||||||
|
await db.execute(sql`DELETE FROM "donation_form" WHERE "photo_id" IS NULL;`)
|
||||||
|
await db.execute(sql`
|
||||||
|
ALTER TABLE "parish_blocks_donation" DROP CONSTRAINT "parish_blocks_donation_form_id_donation_form_id_fk";
|
||||||
|
|
||||||
|
ALTER TABLE "_parish_v_blocks_donation" DROP CONSTRAINT "_parish_v_blocks_donation_form_id_donation_form_id_fk";
|
||||||
|
|
||||||
|
ALTER TABLE "blog_blocks_donation" DROP CONSTRAINT "blog_blocks_donation_form_id_donation_form_id_fk";
|
||||||
|
|
||||||
|
ALTER TABLE "_blog_v_blocks_donation" DROP CONSTRAINT "_blog_v_blocks_donation_form_id_donation_form_id_fk";
|
||||||
|
|
||||||
|
ALTER TABLE "group_blocks_donation" DROP CONSTRAINT "group_blocks_donation_form_id_donation_form_id_fk";
|
||||||
|
|
||||||
|
ALTER TABLE "_group_v_blocks_donation" DROP CONSTRAINT "_group_v_blocks_donation_form_id_donation_form_id_fk";
|
||||||
|
|
||||||
|
ALTER TABLE "pages_blocks_donation" DROP CONSTRAINT "pages_blocks_donation_form_id_donation_form_id_fk";
|
||||||
|
|
||||||
|
ALTER TABLE "_pages_v_blocks_donation" DROP CONSTRAINT "_pages_v_blocks_donation_form_id_donation_form_id_fk";
|
||||||
|
|
||||||
|
DROP INDEX "parish_blocks_donation_form_idx";
|
||||||
|
DROP INDEX "_parish_v_blocks_donation_form_idx";
|
||||||
|
DROP INDEX "blog_blocks_donation_form_idx";
|
||||||
|
DROP INDEX "_blog_v_blocks_donation_form_idx";
|
||||||
|
DROP INDEX "group_blocks_donation_form_idx";
|
||||||
|
DROP INDEX "_group_v_blocks_donation_form_idx";
|
||||||
|
DROP INDEX "pages_blocks_donation_form_idx";
|
||||||
|
DROP INDEX "_pages_v_blocks_donation_form_idx";
|
||||||
|
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-07-26T09:04:34.613Z';
|
||||||
|
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-07-26T09:04:34.950Z';
|
||||||
|
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-08-20T09:04:35.030Z';
|
||||||
|
ALTER TABLE "donation_form" ALTER COLUMN "photo_id" SET NOT NULL;
|
||||||
|
ALTER TABLE "parish_blocks_donation" DROP COLUMN "form_id";
|
||||||
|
ALTER TABLE "_parish_v_blocks_donation" DROP COLUMN "form_id";
|
||||||
|
ALTER TABLE "blog_blocks_donation" DROP COLUMN "form_id";
|
||||||
|
ALTER TABLE "_blog_v_blocks_donation" DROP COLUMN "form_id";
|
||||||
|
ALTER TABLE "group_blocks_donation" DROP COLUMN "form_id";
|
||||||
|
ALTER TABLE "_group_v_blocks_donation" DROP COLUMN "form_id";
|
||||||
|
ALTER TABLE "donation_form" DROP COLUMN "title";
|
||||||
|
ALTER TABLE "pages_blocks_donation" DROP COLUMN "form_id";
|
||||||
|
ALTER TABLE "_pages_v_blocks_donation" DROP COLUMN "form_id";`)
|
||||||
|
}
|
||||||
|
|
@ -55,6 +55,7 @@ import * as migration_20260716_090032_add_user_parish_page_assignments from './2
|
||||||
import * as migration_20260716_113205_add_blog_pinned from './20260716_113205_add_blog_pinned';
|
import * as migration_20260716_113205_add_blog_pinned from './20260716_113205_add_blog_pinned';
|
||||||
import * as migration_20260721_090435_add_mass_times_range from './20260721_090435_add_mass_times_range';
|
import * as migration_20260721_090435_add_mass_times_range from './20260721_090435_add_mass_times_range';
|
||||||
import * as migration_20260828_100000_add_fifth_week_of_month from './20260828_100000_add_fifth_week_of_month';
|
import * as migration_20260828_100000_add_fifth_week_of_month from './20260828_100000_add_fifth_week_of_month';
|
||||||
|
import * as migration_20261008_075404_donation_form_title_and_block_link from './20261008_075404_donation_form_title_and_block_link';
|
||||||
|
|
||||||
export const migrations = [
|
export const migrations = [
|
||||||
{
|
{
|
||||||
|
|
@ -335,11 +336,16 @@ export const migrations = [
|
||||||
{
|
{
|
||||||
up: migration_20260721_090435_add_mass_times_range.up,
|
up: migration_20260721_090435_add_mass_times_range.up,
|
||||||
down: migration_20260721_090435_add_mass_times_range.down,
|
down: migration_20260721_090435_add_mass_times_range.down,
|
||||||
name: '20260721_090435_add_mass_times_range'
|
name: '20260721_090435_add_mass_times_range',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
up: migration_20260828_100000_add_fifth_week_of_month.up,
|
up: migration_20260828_100000_add_fifth_week_of_month.up,
|
||||||
down: migration_20260828_100000_add_fifth_week_of_month.down,
|
down: migration_20260828_100000_add_fifth_week_of_month.down,
|
||||||
name: '20260828_100000_add_fifth_week_of_month',
|
name: '20260828_100000_add_fifth_week_of_month',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
up: migration_20261008_075404_donation_form_title_and_block_link.up,
|
||||||
|
down: migration_20261008_075404_donation_form_title_and_block_link.down,
|
||||||
|
name: '20261008_075404_donation_form_title_and_block_link'
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,7 @@ export interface Parish {
|
||||||
blockType: 'document';
|
blockType: 'document';
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
|
form: string | DonationForm;
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
blockName?: string | null;
|
blockName?: string | null;
|
||||||
blockType: 'donation';
|
blockType: 'donation';
|
||||||
|
|
@ -254,7 +255,7 @@ export interface Parish {
|
||||||
value: string | Group;
|
value: string | Group;
|
||||||
} | null);
|
} | null);
|
||||||
/**
|
/**
|
||||||
* Alternative zu "Verknüpfung". Nur eins von beiden kann gesetzt werden.
|
* Alternative zu "Verknüpfung", z.B. für externe Seiten oder PDF-Dokumente.
|
||||||
*/
|
*/
|
||||||
customLink?: string | null;
|
customLink?: string | null;
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
|
|
@ -409,6 +410,33 @@ export interface Document {
|
||||||
focalX?: number | null;
|
focalX?: number | null;
|
||||||
focalY?: number | null;
|
focalY?: number | null;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "donation-form".
|
||||||
|
*/
|
||||||
|
export interface DonationForm {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
photo?: (string | null) | Media;
|
||||||
|
text: {
|
||||||
|
root: {
|
||||||
|
type: string;
|
||||||
|
children: {
|
||||||
|
type: any;
|
||||||
|
version: number;
|
||||||
|
[k: string]: unknown;
|
||||||
|
}[];
|
||||||
|
direction: ('ltr' | 'rtl') | null;
|
||||||
|
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
||||||
|
indent: number;
|
||||||
|
version: number;
|
||||||
|
};
|
||||||
|
[k: string]: unknown;
|
||||||
|
};
|
||||||
|
url: string;
|
||||||
|
updatedAt: string;
|
||||||
|
createdAt: string;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
* via the `definition` "media".
|
* via the `definition` "media".
|
||||||
|
|
@ -567,6 +595,7 @@ export interface Page {
|
||||||
blockType: 'contactform';
|
blockType: 'contactform';
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
|
form: string | DonationForm;
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
blockName?: string | null;
|
blockName?: string | null;
|
||||||
blockType: 'donation';
|
blockType: 'donation';
|
||||||
|
|
@ -754,7 +783,7 @@ export interface Page {
|
||||||
value: string | Group;
|
value: string | Group;
|
||||||
} | null);
|
} | null);
|
||||||
/**
|
/**
|
||||||
* Alternative zu "Verknüpfung". Nur eins von beiden kann gesetzt werden.
|
* Alternative zu "Verknüpfung", z.B. für externe Seiten oder PDF-Dokumente.
|
||||||
*/
|
*/
|
||||||
customLink?: string | null;
|
customLink?: string | null;
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
|
|
@ -866,6 +895,7 @@ export interface Group {
|
||||||
blockType: 'document';
|
blockType: 'document';
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
|
form: string | DonationForm;
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
blockName?: string | null;
|
blockName?: string | null;
|
||||||
blockType: 'donation';
|
blockType: 'donation';
|
||||||
|
|
@ -911,7 +941,7 @@ export interface Group {
|
||||||
value: string | Group;
|
value: string | Group;
|
||||||
} | null);
|
} | null);
|
||||||
/**
|
/**
|
||||||
* Alternative zu "Verknüpfung". Nur eins von beiden kann gesetzt werden.
|
* Alternative zu "Verknüpfung", z.B. für externe Seiten oder PDF-Dokumente.
|
||||||
*/
|
*/
|
||||||
customLink?: string | null;
|
customLink?: string | null;
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
|
|
@ -1105,6 +1135,7 @@ export interface Blog {
|
||||||
blockType: 'document';
|
blockType: 'document';
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
|
form: string | DonationForm;
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
blockName?: string | null;
|
blockName?: string | null;
|
||||||
blockType: 'donation';
|
blockType: 'donation';
|
||||||
|
|
@ -1154,7 +1185,7 @@ export interface Blog {
|
||||||
value: string | Group;
|
value: string | Group;
|
||||||
} | null);
|
} | null);
|
||||||
/**
|
/**
|
||||||
* Alternative zu "Verknüpfung". Nur eins von beiden kann gesetzt werden.
|
* Alternative zu "Verknüpfung", z.B. für externe Seiten oder PDF-Dokumente.
|
||||||
*/
|
*/
|
||||||
customLink?: string | null;
|
customLink?: string | null;
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
|
|
@ -1304,32 +1335,6 @@ export interface Classified {
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
|
||||||
* via the `definition` "donation-form".
|
|
||||||
*/
|
|
||||||
export interface DonationForm {
|
|
||||||
id: string;
|
|
||||||
photo: string | Media;
|
|
||||||
text: {
|
|
||||||
root: {
|
|
||||||
type: string;
|
|
||||||
children: {
|
|
||||||
type: any;
|
|
||||||
version: number;
|
|
||||||
[k: string]: unknown;
|
|
||||||
}[];
|
|
||||||
direction: ('ltr' | 'rtl') | null;
|
|
||||||
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
|
||||||
indent: number;
|
|
||||||
version: number;
|
|
||||||
};
|
|
||||||
[k: string]: unknown;
|
|
||||||
};
|
|
||||||
url: string;
|
|
||||||
updatedAt: string;
|
|
||||||
createdAt: string;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
* via the `definition` "prayers".
|
* via the `definition` "prayers".
|
||||||
|
|
@ -1709,6 +1714,7 @@ export interface ParishSelect<T extends boolean = true> {
|
||||||
donation?:
|
donation?:
|
||||||
| T
|
| T
|
||||||
| {
|
| {
|
||||||
|
form?: T;
|
||||||
id?: T;
|
id?: T;
|
||||||
blockName?: T;
|
blockName?: T;
|
||||||
};
|
};
|
||||||
|
|
@ -1918,6 +1924,7 @@ export interface BlogSelect<T extends boolean = true> {
|
||||||
donation?:
|
donation?:
|
||||||
| T
|
| T
|
||||||
| {
|
| {
|
||||||
|
form?: T;
|
||||||
id?: T;
|
id?: T;
|
||||||
blockName?: T;
|
blockName?: T;
|
||||||
};
|
};
|
||||||
|
|
@ -2139,6 +2146,7 @@ export interface GroupSelect<T extends boolean = true> {
|
||||||
donation?:
|
donation?:
|
||||||
| T
|
| T
|
||||||
| {
|
| {
|
||||||
|
form?: T;
|
||||||
id?: T;
|
id?: T;
|
||||||
blockName?: T;
|
blockName?: T;
|
||||||
};
|
};
|
||||||
|
|
@ -2241,6 +2249,7 @@ export interface GroupSelect<T extends boolean = true> {
|
||||||
* via the `definition` "donation-form_select".
|
* via the `definition` "donation-form_select".
|
||||||
*/
|
*/
|
||||||
export interface DonationFormSelect<T extends boolean = true> {
|
export interface DonationFormSelect<T extends boolean = true> {
|
||||||
|
title?: T;
|
||||||
photo?: T;
|
photo?: T;
|
||||||
text?: T;
|
text?: T;
|
||||||
url?: T;
|
url?: T;
|
||||||
|
|
@ -2342,6 +2351,7 @@ export interface PagesSelect<T extends boolean = true> {
|
||||||
donation?:
|
donation?:
|
||||||
| T
|
| T
|
||||||
| {
|
| {
|
||||||
|
form?: T;
|
||||||
id?: T;
|
id?: T;
|
||||||
blockName?: T;
|
blockName?: T;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue