This commit is contained in:
parent
93625f753b
commit
c605420dcb
7 changed files with 21823 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ import { EventsBlock } from '@/collections/blocks/Events'
|
|||
import { PublicationAndNewsletterBlock } from '@/collections/blocks/PublicationAndNewsletter'
|
||||
import { ContactPersonBlock } from '@/collections/blocks/ContactPersonBlock'
|
||||
import { ImageCardsBlock } from '@/collections/blocks/ImageCards'
|
||||
import { ClassifiedsBlock } from '@/collections/blocks/Classifieds'
|
||||
import { isPublishedPublic } from '@/collections/access/public'
|
||||
|
||||
export const Pages: CollectionConfig = {
|
||||
|
|
@ -102,6 +103,7 @@ export const Pages: CollectionConfig = {
|
|||
EventsBlock,
|
||||
ContactPersonBlock,
|
||||
ImageCardsBlock,
|
||||
ClassifiedsBlock,
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
14
src/collections/blocks/Classifieds.ts
Normal file
14
src/collections/blocks/Classifieds.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { Block } from 'payload'
|
||||
|
||||
export const ClassifiedsBlock: Block = {
|
||||
slug: 'classifieds',
|
||||
labels: {
|
||||
singular: {
|
||||
de: 'Kleinanzeigen',
|
||||
},
|
||||
plural: {
|
||||
de: 'Kleinanzeigen',
|
||||
},
|
||||
},
|
||||
fields: [],
|
||||
}
|
||||
|
|
@ -21,6 +21,7 @@ import { BlogSliderBlock } from '@/compositions/Blocks/BlogSliderBlock'
|
|||
import { MassTimesBlock } from '@/compositions/Blocks/MassTimesBlock'
|
||||
import { EventsBlock } from '@/compositions/Blocks/EventsBlock'
|
||||
import { ImageCardsBlock } from '@/compositions/Blocks/ImageCardsBlock'
|
||||
import { ClassifiedsFromApi } from '@/components/Classifieds/ClassifiedsFromApi'
|
||||
|
||||
type BlocksProps = {
|
||||
content: Blog['content']['content'] | NonNullable<Page['content']>
|
||||
|
|
@ -239,6 +240,16 @@ export function Blocks({ content }: BlocksProps) {
|
|||
return <ImageCardsBlock key={item.id} items={item.items} />
|
||||
}
|
||||
|
||||
if (item.blockType === 'classifieds') {
|
||||
return (
|
||||
<Section key={item.id} padding={'small'}>
|
||||
<Container>
|
||||
<ClassifiedsFromApi />
|
||||
</Container>
|
||||
</Section>
|
||||
)
|
||||
}
|
||||
|
||||
if (item.blockType === 'contactPersonBlock') {
|
||||
const contact = typeof item.contact === 'object'
|
||||
? item.contact
|
||||
|
|
|
|||
21734
src/migrations/20260413_122020.json
Normal file
21734
src/migrations/20260413_122020.json
Normal file
File diff suppressed because it is too large
Load diff
44
src/migrations/20260413_122020.ts
Normal file
44
src/migrations/20260413_122020.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||
|
||||
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
CREATE TABLE "pages_blocks_classifieds" (
|
||||
"_order" integer NOT NULL,
|
||||
"_parent_id" uuid NOT NULL,
|
||||
"_path" text NOT NULL,
|
||||
"id" varchar PRIMARY KEY NOT NULL,
|
||||
"block_name" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE "_pages_v_blocks_classifieds" (
|
||||
"_order" integer NOT NULL,
|
||||
"_parent_id" uuid NOT NULL,
|
||||
"_path" text NOT NULL,
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"_uuid" varchar,
|
||||
"block_name" varchar
|
||||
);
|
||||
|
||||
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-04-19T12:20:19.986Z';
|
||||
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-04-19T12:20:20.277Z';
|
||||
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-05-13T12:20:20.339Z';
|
||||
ALTER TABLE "pages_blocks_classifieds" ADD CONSTRAINT "pages_blocks_classifieds_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."pages"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "_pages_v_blocks_classifieds" ADD CONSTRAINT "_pages_v_blocks_classifieds_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."_pages_v"("id") ON DELETE cascade ON UPDATE no action;
|
||||
CREATE INDEX "pages_blocks_classifieds_order_idx" ON "pages_blocks_classifieds" USING btree ("_order");
|
||||
CREATE INDEX "pages_blocks_classifieds_parent_id_idx" ON "pages_blocks_classifieds" USING btree ("_parent_id");
|
||||
CREATE INDEX "pages_blocks_classifieds_path_idx" ON "pages_blocks_classifieds" USING btree ("_path");
|
||||
CREATE INDEX "_pages_v_blocks_classifieds_order_idx" ON "_pages_v_blocks_classifieds" USING btree ("_order");
|
||||
CREATE INDEX "_pages_v_blocks_classifieds_parent_id_idx" ON "_pages_v_blocks_classifieds" USING btree ("_parent_id");
|
||||
CREATE INDEX "_pages_v_blocks_classifieds_path_idx" ON "_pages_v_blocks_classifieds" USING btree ("_path");`)
|
||||
}
|
||||
|
||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TABLE "pages_blocks_classifieds" DISABLE ROW LEVEL SECURITY;
|
||||
ALTER TABLE "_pages_v_blocks_classifieds" DISABLE ROW LEVEL SECURITY;
|
||||
DROP TABLE "pages_blocks_classifieds" CASCADE;
|
||||
DROP TABLE "_pages_v_blocks_classifieds" CASCADE;
|
||||
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-04-19T09:46:18.288Z';
|
||||
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-04-19T09:46:18.569Z';
|
||||
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-05-13T09:46:18.627Z';`)
|
||||
}
|
||||
|
|
@ -32,6 +32,7 @@ import * as migration_20260410_115248_parish_title_block from './20260410_115248
|
|||
import * as migration_20260410_124639 from './20260410_124639';
|
||||
import * as migration_20260413_093410_search from './20260413_093410_search';
|
||||
import * as migration_20260413_094618_search_pages from './20260413_094618_search_pages';
|
||||
import * as migration_20260413_122020 from './20260413_122020';
|
||||
|
||||
export const migrations = [
|
||||
{
|
||||
|
|
@ -202,6 +203,11 @@ export const migrations = [
|
|||
{
|
||||
up: migration_20260413_094618_search_pages.up,
|
||||
down: migration_20260413_094618_search_pages.down,
|
||||
name: '20260413_094618_search_pages'
|
||||
name: '20260413_094618_search_pages',
|
||||
},
|
||||
{
|
||||
up: migration_20260413_122020.up,
|
||||
down: migration_20260413_122020.down,
|
||||
name: '20260413_122020'
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -613,6 +613,11 @@ export interface Page {
|
|||
blockName?: string | null;
|
||||
blockType: 'imageCards';
|
||||
}
|
||||
| {
|
||||
id?: string | null;
|
||||
blockName?: string | null;
|
||||
blockType: 'classifieds';
|
||||
}
|
||||
)[]
|
||||
| null;
|
||||
updatedAt: string;
|
||||
|
|
@ -1965,6 +1970,12 @@ export interface PagesSelect<T extends boolean = true> {
|
|||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
classifieds?:
|
||||
| T
|
||||
| {
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
|
|
|
|||
Loading…
Reference in a new issue