feature: rolling or current week masses
This commit is contained in:
parent
27a66bf320
commit
66bb076485
8 changed files with 27723 additions and 6 deletions
6
package-lock.json
generated
6
package-lock.json
generated
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"name": "drei-koenige-v3",
|
||||
"name": "@bennotielen/parish-website",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "drei-koenige-v3",
|
||||
"name": "@bennotielen/parish-website",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"dependencies": {
|
||||
"@nyariv/sandboxjs": "0.8.28",
|
||||
"@payloadcms/db-postgres": "^3.74.0",
|
||||
|
|
|
|||
|
|
@ -26,6 +26,28 @@ export const MassTimesBlock: Block = {
|
|||
de: 'Untertitel',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'range',
|
||||
type: 'select',
|
||||
label: {
|
||||
de: 'Zeitraum',
|
||||
},
|
||||
options: [
|
||||
{
|
||||
label: {
|
||||
de: 'Ab heute (7 Tage)',
|
||||
},
|
||||
value: 'rolling',
|
||||
},
|
||||
{
|
||||
label: {
|
||||
de: 'Aktuelle Woche (Montag bis Sonntag)',
|
||||
},
|
||||
value: 'week',
|
||||
},
|
||||
],
|
||||
defaultValue: 'rolling',
|
||||
},
|
||||
{
|
||||
name: 'churches',
|
||||
label: {
|
||||
|
|
|
|||
|
|
@ -203,6 +203,7 @@ export function Blocks({ content }: BlocksProps) {
|
|||
key={item.id}
|
||||
title={item.title}
|
||||
subtitle={item.subtitle}
|
||||
range={item.range}
|
||||
churches={item.churches}
|
||||
/>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import styles from './massTimesBlock.module.scss'
|
|||
type MassTimesBlockProps = {
|
||||
title?: string | null
|
||||
subtitle?: string | null
|
||||
range?: 'rolling' | 'week' | null
|
||||
churches?: (string | Church)[] | null
|
||||
}
|
||||
|
||||
|
|
@ -40,10 +41,15 @@ const sortWorship = (worship: Worship[]) => {
|
|||
export async function MassTimesBlock({
|
||||
title = 'Nächste Gottesdienste',
|
||||
subtitle,
|
||||
range,
|
||||
churches,
|
||||
}: MassTimesBlockProps) {
|
||||
const fromDate = moment().isoWeekday(1).hours(0).minutes(0)
|
||||
const tillDate = moment().isoWeekday(7).hours(23).minutes(59)
|
||||
const fromDate =
|
||||
range === 'week' ? moment().isoWeekday(1).startOf('day') : moment()
|
||||
const tillDate =
|
||||
range === 'week'
|
||||
? moment().isoWeekday(7).endOf('day')
|
||||
: moment().add(1, 'week')
|
||||
|
||||
const churchIds = churches
|
||||
?.map((c) => (typeof c === 'object' ? c.id : c))
|
||||
|
|
|
|||
27657
src/migrations/20260721_090435_add_mass_times_range.json
Normal file
27657
src/migrations/20260721_090435_add_mass_times_range.json
Normal file
File diff suppressed because it is too large
Load diff
23
src/migrations/20260721_090435_add_mass_times_range.ts
Normal file
23
src/migrations/20260721_090435_add_mass_times_range.ts
Normal 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`
|
||||
CREATE TYPE "public"."enum_pages_blocks_mass_times_range" AS ENUM('rolling', 'week');
|
||||
CREATE TYPE "public"."enum__pages_v_blocks_mass_times_range" AS ENUM('rolling', 'week');
|
||||
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 "pages_blocks_mass_times" ADD COLUMN "range" "enum_pages_blocks_mass_times_range" DEFAULT 'rolling';
|
||||
ALTER TABLE "_pages_v_blocks_mass_times" ADD COLUMN "range" "enum__pages_v_blocks_mass_times_range" DEFAULT 'rolling';`)
|
||||
}
|
||||
|
||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-07-19T11:32:04.857Z';
|
||||
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-07-19T11:32:05.134Z';
|
||||
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-08-15T11:32:05.193Z';
|
||||
ALTER TABLE "pages_blocks_mass_times" DROP COLUMN "range";
|
||||
ALTER TABLE "_pages_v_blocks_mass_times" DROP COLUMN "range";
|
||||
DROP TYPE "public"."enum_pages_blocks_mass_times_range";
|
||||
DROP TYPE "public"."enum__pages_v_blocks_mass_times_range";`)
|
||||
}
|
||||
|
|
@ -53,6 +53,7 @@ import * as migration_20260611_072650_add_contact_person_to_group from './202606
|
|||
import * as migration_20260611_084920_add_image_with_text_block from './20260611_084920_add_image_with_text_block';
|
||||
import * as migration_20260716_090032_add_user_parish_page_assignments from './20260716_090032_add_user_parish_page_assignments';
|
||||
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';
|
||||
|
||||
export const migrations = [
|
||||
{
|
||||
|
|
@ -328,6 +329,11 @@ export const migrations = [
|
|||
{
|
||||
up: migration_20260716_113205_add_blog_pinned.up,
|
||||
down: migration_20260716_113205_add_blog_pinned.down,
|
||||
name: '20260716_113205_add_blog_pinned'
|
||||
name: '20260716_113205_add_blog_pinned',
|
||||
},
|
||||
{
|
||||
up: migration_20260721_090435_add_mass_times_range.up,
|
||||
down: migration_20260721_090435_add_mass_times_range.down,
|
||||
name: '20260721_090435_add_mass_times_range'
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -712,6 +712,7 @@ export interface Page {
|
|||
| {
|
||||
title?: string | null;
|
||||
subtitle?: string | null;
|
||||
range?: ('rolling' | 'week') | null;
|
||||
/**
|
||||
* Leer lassen, um alle Kirchen alphabetisch anzuzeigen.
|
||||
*/
|
||||
|
|
@ -2429,6 +2430,7 @@ export interface PagesSelect<T extends boolean = true> {
|
|||
| {
|
||||
title?: T;
|
||||
subtitle?: T;
|
||||
range?: T;
|
||||
churches?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
|
|
|
|||
Loading…
Reference in a new issue