feature: contact person in group

This commit is contained in:
Benno Tielen 2026-06-11 09:31:32 +02:00
parent 636222eead
commit 1ae2542a0f
5 changed files with 26406 additions and 1 deletions

View file

@ -12,6 +12,7 @@ import { ImageCardsBlock } from '@/collections/blocks/ImageCards'
import { CollapsiblesBlock } from '@/collections/blocks/Collapsibles' import { CollapsiblesBlock } from '@/collections/blocks/Collapsibles'
import { TitleBlock } from '@/collections/blocks/Title' import { TitleBlock } from '@/collections/blocks/Title'
import { NextPrevButtonsBlock } from '@/collections/blocks/NextPrevButtons' import { NextPrevButtonsBlock } from '@/collections/blocks/NextPrevButtons'
import { ContactPersonBlock } from '@/collections/blocks/ContactPersonBlock'
export const Groups: CollectionConfig = { export const Groups: CollectionConfig = {
slug: 'group', slug: 'group',
@ -88,6 +89,7 @@ export const Groups: CollectionConfig = {
DocumentBlock, DocumentBlock,
DonationBlock, DonationBlock,
YoutubePlayerBlock, YoutubePlayerBlock,
ContactPersonBlock,
ContactformBlock, ContactformBlock,
ButtonBlock, ButtonBlock,
ImageCardsBlock, ImageCardsBlock,

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,50 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
CREATE TABLE "group_blocks_contact_person_block" (
"_order" integer NOT NULL,
"_parent_id" uuid NOT NULL,
"_path" text NOT NULL,
"id" varchar PRIMARY KEY NOT NULL,
"contact_id" uuid,
"block_name" varchar
);
CREATE TABLE "_group_v_blocks_contact_person_block" (
"_order" integer NOT NULL,
"_parent_id" uuid NOT NULL,
"_path" text NOT NULL,
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"contact_id" uuid,
"_uuid" varchar,
"block_name" varchar
);
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-06-14T07:26:50.172Z';
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-06-14T07:26:50.530Z';
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-07-11T07:26:50.607Z';
ALTER TABLE "group_blocks_contact_person_block" ADD CONSTRAINT "group_blocks_contact_person_block_contact_id_contact_person_id_fk" FOREIGN KEY ("contact_id") REFERENCES "public"."contact_person"("id") ON DELETE set null ON UPDATE no action;
ALTER TABLE "group_blocks_contact_person_block" ADD CONSTRAINT "group_blocks_contact_person_block_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."group"("id") ON DELETE cascade ON UPDATE no action;
ALTER TABLE "_group_v_blocks_contact_person_block" ADD CONSTRAINT "_group_v_blocks_contact_person_block_contact_id_contact_person_id_fk" FOREIGN KEY ("contact_id") REFERENCES "public"."contact_person"("id") ON DELETE set null ON UPDATE no action;
ALTER TABLE "_group_v_blocks_contact_person_block" ADD CONSTRAINT "_group_v_blocks_contact_person_block_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."_group_v"("id") ON DELETE cascade ON UPDATE no action;
CREATE INDEX "group_blocks_contact_person_block_order_idx" ON "group_blocks_contact_person_block" USING btree ("_order");
CREATE INDEX "group_blocks_contact_person_block_parent_id_idx" ON "group_blocks_contact_person_block" USING btree ("_parent_id");
CREATE INDEX "group_blocks_contact_person_block_path_idx" ON "group_blocks_contact_person_block" USING btree ("_path");
CREATE INDEX "group_blocks_contact_person_block_contact_idx" ON "group_blocks_contact_person_block" USING btree ("contact_id");
CREATE INDEX "_group_v_blocks_contact_person_block_order_idx" ON "_group_v_blocks_contact_person_block" USING btree ("_order");
CREATE INDEX "_group_v_blocks_contact_person_block_parent_id_idx" ON "_group_v_blocks_contact_person_block" USING btree ("_parent_id");
CREATE INDEX "_group_v_blocks_contact_person_block_path_idx" ON "_group_v_blocks_contact_person_block" USING btree ("_path");
CREATE INDEX "_group_v_blocks_contact_person_block_contact_idx" ON "_group_v_blocks_contact_person_block" USING btree ("contact_id");`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "group_blocks_contact_person_block" DISABLE ROW LEVEL SECURITY;
ALTER TABLE "_group_v_blocks_contact_person_block" DISABLE ROW LEVEL SECURITY;
DROP TABLE "group_blocks_contact_person_block" CASCADE;
DROP TABLE "_group_v_blocks_contact_person_block" CASCADE;
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-06-14T11:32:58.445Z';
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-06-14T11:32:58.773Z';
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-07-09T11:32:58.852Z';`)
}

View file

@ -49,6 +49,7 @@ import * as migration_20260605_113107_occurrence_end_time from './20260605_11310
import * as migration_20260605_124103_gallery_caption from './20260605_124103_gallery_caption'; import * as migration_20260605_124103_gallery_caption from './20260605_124103_gallery_caption';
import * as migration_20260605_130843_add_worship_language_other from './20260605_130843_add_worship_language_other'; import * as migration_20260605_130843_add_worship_language_other from './20260605_130843_add_worship_language_other';
import * as migration_20260609_113259_parish_gallery_caption from './20260609_113259_parish_gallery_caption'; import * as migration_20260609_113259_parish_gallery_caption from './20260609_113259_parish_gallery_caption';
import * as migration_20260611_072650_add_contact_person_to_group from './20260611_072650_add_contact_person_to_group';
export const migrations = [ export const migrations = [
{ {
@ -304,6 +305,11 @@ export const migrations = [
{ {
up: migration_20260609_113259_parish_gallery_caption.up, up: migration_20260609_113259_parish_gallery_caption.up,
down: migration_20260609_113259_parish_gallery_caption.down, down: migration_20260609_113259_parish_gallery_caption.down,
name: '20260609_113259_parish_gallery_caption' name: '20260609_113259_parish_gallery_caption',
},
{
up: migration_20260611_072650_add_contact_person_to_group.up,
down: migration_20260611_072650_add_contact_person_to_group.down,
name: '20260611_072650_add_contact_person_to_group'
}, },
]; ];

View file

@ -825,6 +825,12 @@ export interface Group {
blockName?: string | null; blockName?: string | null;
blockType: 'youtube'; blockType: 'youtube';
} }
| {
contact: string | ContactPerson;
id?: string | null;
blockName?: string | null;
blockType: 'contactPersonBlock';
}
| { | {
title: string; title: string;
description: string; description: string;
@ -2048,6 +2054,13 @@ export interface GroupSelect<T extends boolean = true> {
id?: T; id?: T;
blockName?: T; blockName?: T;
}; };
contactPersonBlock?:
| T
| {
contact?: T;
id?: T;
blockName?: T;
};
contactform?: contactform?:
| T | T
| { | {