mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
remover booker, that's overdosed
It also brings the problem of consolidating bookers over multiple bookings. The amount of data is not justifying having it in an own entity
This commit is contained in:
@@ -21,7 +21,7 @@ export function generateCalendarEntry(booking: Booking): string {
|
||||
duration: { days: booking.days.length },
|
||||
location: 'Mömpelgardgasse 25, 72348 Rosenfeld, Deutschland',
|
||||
geo: { lat: 48.287044, lon: 8.726361 },
|
||||
description: `Gebucht auf ${booking.booker.name}
|
||||
description: `Gebucht auf ${booking.name}
|
||||
|
||||
Buchungs-Link: ${getBaseURL()}/booking/${booking.uuid}
|
||||
`,
|
||||
@@ -39,18 +39,27 @@ Buchungs-Link: ${getBaseURL()}/booking/${booking.uuid}
|
||||
}
|
||||
|
||||
export function generateBookedCalendar(bookings: Booking[]): string {
|
||||
const events = bookings.map((booking): { productId: string; calName: string; start: [number, number, number]; startOutputType: 'local' | 'utc'; duration: { days: number }; title: string; description: string; status: EventStatus } => ({
|
||||
const events = bookings.map((booking): {
|
||||
productId: string
|
||||
calName: string
|
||||
start: [number, number, number]
|
||||
startOutputType: 'local' | 'utc'
|
||||
duration: { days: number }
|
||||
title: string
|
||||
description: string
|
||||
status: EventStatus
|
||||
} => ({
|
||||
productId: 'app.vercel.pfadi-bussle/ics',
|
||||
calName: 'Pfadi-Bussle Buchungen',
|
||||
start: convertDay(booking.days[0]),
|
||||
startOutputType: 'local',
|
||||
duration: { days: booking.days.length },
|
||||
title: `Buchung ${booking.booker.name}`,
|
||||
description: `Name: ${booking.booker.name}
|
||||
title: `Buchung ${booking.name}`,
|
||||
description: `Name: ${booking.name}
|
||||
Zeitraum: ${daysFormatFrontend(booking.days)}
|
||||
|
||||
Email: ${booking.booker.email}
|
||||
Telefon: ${booking.booker.phone}
|
||||
Email: ${booking.email}
|
||||
Telefon: ${booking.phone}
|
||||
|
||||
Link: ${getBaseURL()}/admin/booking/${booking.uuid}
|
||||
`,
|
||||
|
||||
@@ -32,7 +32,7 @@ Tel. 0151/212 253 62
|
||||
`
|
||||
|
||||
function getReceivedBookingBookerText(booking: Booking): string {
|
||||
return `Hallo liebe/r ${booking.booker.name},
|
||||
return `Hallo liebe/r ${booking.name},
|
||||
|
||||
Vielen Dank für Deine Buchungsanfrage zum ${daysFormatFrontend(booking.days)}!
|
||||
|
||||
@@ -49,7 +49,7 @@ ${footer}
|
||||
}
|
||||
|
||||
function getBookingConfirmedText(booking: Booking): string {
|
||||
return `Hallo liebe/r ${booking.booker.name},
|
||||
return `Hallo liebe/r ${booking.name},
|
||||
|
||||
deine Buchunganfrage zum ${daysFormatFrontend(
|
||||
booking.days
|
||||
@@ -65,7 +65,7 @@ ${footer}
|
||||
`
|
||||
}
|
||||
function getBookingRejectedText(booking: Booking): string {
|
||||
return `Hallo liebe/r ${booking.booker.name},
|
||||
return `Hallo liebe/r ${booking.name},
|
||||
|
||||
es tut uns leid aber deine Buchungsanfrage zum ${daysFormatFrontend(
|
||||
booking.days
|
||||
@@ -86,7 +86,9 @@ es ging folgende Buchung ein: ${getBaseURL()}/admin/booking/${booking.uuid}
|
||||
MfG`
|
||||
}
|
||||
|
||||
export async function sendReceivedBookingAdminMail(booking: Booking): Promise<void> {
|
||||
export async function sendReceivedBookingAdminMail(
|
||||
booking: Booking
|
||||
): Promise<void> {
|
||||
try {
|
||||
await sendMail({
|
||||
to: [{ email: ADMIN_EMAIL }],
|
||||
@@ -102,10 +104,12 @@ export async function sendReceivedBookingAdminMail(booking: Booking): Promise<vo
|
||||
}
|
||||
}
|
||||
|
||||
export async function sendReceivedBookingBookerMail(booking: Booking): Promise<void> {
|
||||
export async function sendReceivedBookingBookerMail(
|
||||
booking: Booking
|
||||
): Promise<void> {
|
||||
try {
|
||||
await sendMail({
|
||||
to: [{ email: booking.booker.email, name: booking.booker.name }],
|
||||
to: [{ email: booking.email, name: booking.name }],
|
||||
from: { email: FROM_EMAIL, name: 'Pfadi-Bussle Wart' },
|
||||
subject: `Deine Pfadi-Bussle Buchung ist eingegangen!`,
|
||||
textPlainContent: getReceivedBookingBookerText(booking),
|
||||
@@ -121,7 +125,7 @@ export async function sendReceivedBookingBookerMail(booking: Booking): Promise<v
|
||||
export async function sendBookingConfirmed(booking: Booking): Promise<void> {
|
||||
try {
|
||||
await sendMail({
|
||||
to: [{ email: booking.booker.email, name: booking.booker.name }],
|
||||
to: [{ email: booking.email, name: booking.name }],
|
||||
from: { email: FROM_EMAIL, name: 'Pfadi-Bussle Wart' },
|
||||
subject: `Deine Pfadi-Bussle Buchung wurde bestätigt!`,
|
||||
textPlainContent: getBookingConfirmedText(booking),
|
||||
@@ -146,7 +150,7 @@ export async function sendBookingConfirmed(booking: Booking): Promise<void> {
|
||||
export async function sendBookingRejected(booking: Booking): Promise<void> {
|
||||
try {
|
||||
await sendMail({
|
||||
to: [{ email: booking.booker.email, name: booking.booker.name }],
|
||||
to: [{ email: booking.email, name: booking.name }],
|
||||
from: { email: FROM_EMAIL, name: 'Pfadi-Bussle Wart' },
|
||||
subject: `Deine Pfadi-Bussle Buchung wurde abgelehnt!`,
|
||||
textPlainContent: getBookingRejectedText(booking),
|
||||
|
||||
@@ -7,8 +7,7 @@ function getStorage() {
|
||||
}
|
||||
|
||||
export function storeBookingData(booking: Booking) {
|
||||
const { name, email, street, zip, city } = booking.booker
|
||||
const { org } = booking
|
||||
const { name, email, street, zip, city, org } = booking
|
||||
|
||||
getStorage().setItem(
|
||||
BOOKING_DATA_KEY,
|
||||
|
||||
Reference in New Issue
Block a user