feature: copyrights

This commit is contained in:
Benno Tielen 2025-09-15 10:08:14 +02:00
parent c10e007c19
commit c8893a43b5
5 changed files with 7002 additions and 2 deletions

View file

@ -31,7 +31,45 @@ export const Media: CollectionConfig = {
type: 'text',
label: {
de: "Suchbegriffe"
}
},
},
{
type: 'group',
name: 'copyrights',
label: {
de: "Urheberrechte"
},
fields: [
{
name: 'source',
type: 'text',
label: {
de: "Urheber / Quelle des Bildes"
},
required: true,
defaultValue: ""
},
{
name: 'publicWithoutName',
type: 'checkbox',
label: {
de: "Ich bestätige, dass ich über die erforderlichen Rechte für dieses Bild verfüge (z. B. als Urheber oder durch eine erworbene Lizenz), der Pfarrei die Erlaubnis zur Veröffentlichung auf der Webseite erteile und damit einverstanden bin, dass die Veröffentlichung ohne Nennung meines Namens oder des Urhebers erfolgt."
},
required: true,
validate: value => value === true || "Bild muss frei veröffentlicht werden können",
defaultValue: false
},
{
name: 'consent',
type: 'checkbox',
label: {
de: "Ich versichere, dass mir von allen erkennbar abgebildeten Personen die ausdrückliche Einwilligung vorliegt, dass ihr Bild veröffentlicht werden darf."
},
required: true,
validate: value => value === true || "Einwilligung erforderlich",
defaultValue: false
},
]
}
],
upload: {

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,23 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2025-09-21T07:52:17.724Z';
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2025-09-21T07:52:17.817Z';
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2025-10-15T07:52:17.878Z';
ALTER TABLE "media" ADD COLUMN "copyrights_source" varchar DEFAULT '' NOT NULL;
ALTER TABLE "media" ADD COLUMN "copyrights_public_without_name" boolean DEFAULT false NOT NULL;
ALTER TABLE "media" ADD COLUMN "copyrights_consent" boolean DEFAULT false NOT NULL;
UPDATE "media" SET copyrights_public_without_name = true, copyrights_consent = true;
`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2025-09-14T07:56:02.742Z';
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2025-09-14T07:56:02.825Z';
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2025-10-09T07:56:02.879Z';
ALTER TABLE "media" DROP COLUMN "copyrights_source";
ALTER TABLE "media" DROP COLUMN "copyrights_public_without_name";
ALTER TABLE "media" DROP COLUMN "copyrights_consent";`)
}

View file

@ -11,6 +11,7 @@ import * as migration_20250818_143115_menu from './20250818_143115_menu';
import * as migration_20250827_093559_magazine from './20250827_093559_magazine';
import * as migration_20250827_105121_new_payload_version from './20250827_105121_new_payload_version';
import * as migration_20250909_075603 from './20250909_075603';
import * as migration_20250915_075218 from './20250915_075218';
export const migrations = [
{
@ -76,6 +77,11 @@ export const migrations = [
{
up: migration_20250909_075603.up,
down: migration_20250909_075603.down,
name: '20250909_075603'
name: '20250909_075603',
},
{
up: migration_20250915_075218.up,
down: migration_20250915_075218.down,
name: '20250915_075218'
},
];

View file

@ -195,6 +195,11 @@ export interface Media {
id: string;
alt: string;
search?: string | null;
copyrights: {
source: string;
publicWithoutName: boolean;
consent: boolean;
};
prefix?: string | null;
updatedAt: string;
createdAt: string;
@ -1096,6 +1101,13 @@ export interface DocumentsSelect<T extends boolean = true> {
export interface MediaSelect<T extends boolean = true> {
alt?: T;
search?: T;
copyrights?:
| T
| {
source?: T;
publicWithoutName?: T;
consent?: T;
};
prefix?: T;
updatedAt?: T;
createdAt?: T;