
* --init * added default event types * updated lib path * updated group link design * fixed collective description * added default minimum booking notice * Accept multi user query for a default event type * check types * check types --WIP * check types still --WIP * --WIP * --WIP * fixed single user type not working * check fix * --import path fix * functional collective eventtype page * fixed check type * minor fixes and --WIP * typefix * custominput in defaultevent fix * added booking page compatibility for dynamic group links * added /book compatibility for dynamic group links * checktype fix --WIP * checktype fix * Success page compatibility added * added migrations * added dynamic group booking slug to booking creation * reschedule and database fix * daily integration * daily integration --locationtype fetch * fixed reschedule * added index to key parameter in eventtype list * fix + added after last group slug * added user setting option for dynamic booking * changed defaultEvents location based on recent changes * updated default event name in updated import * disallow booking when one in group disallows it * fixed setting checkbox association * cleanup * udded better error handling for disabled dynamic group bookings * cleanup * added tooltip to allow dynamic setting and enable by default * Update yarn.lock * Fix: Embed Fixes, UI configuration PRO Only, Tests (#2341) * #2325 Followup (#2369) * Adds initial MDX implementation for App Store pages * Adds endpoint to serve app store static files * Replaces zoom icon with dynamic-served one * Fixes zoom icon * Makes Slider reusable * Adds gray-matter for MDX * Adds zoom screenshots * Update yarn.lock * Slider improvements * WIP * Update TrendingAppsSlider.tsx * WIP * Adds MS teams screenshots * Adds stripe screenshots * Cleanup * Update index.ts * WIP * Cleanup * Cleanup * Adds jitsi screenshot * Adds Google meet screenshots * Adds office 365 calendar screenshots * Adds google calendar screenshots * Follow #2325 Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * requested changes * further requested changes * more changes * type fix * fixed prisma/client import path * added e2e test * test-fix * E2E fixes * Fixes circular dependency * Fixed paid bookings seeder * Added missing imports * requested changes * added username slugs as part of event description * updated event description Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com>
119 lines
3.1 KiB
TypeScript
119 lines
3.1 KiB
TypeScript
import { Prisma } from "@prisma/client";
|
|
import { GetServerSidePropsContext } from "next";
|
|
import { JSONObject } from "superjson/dist/types";
|
|
|
|
import { getLocationLabels } from "@calcom/app-store/utils";
|
|
|
|
import { asStringOrThrow } from "@lib/asStringOrNull";
|
|
import prisma from "@lib/prisma";
|
|
import { inferSSRProps } from "@lib/types/inferSSRProps";
|
|
|
|
import BookingPage from "@components/booking/pages/BookingPage";
|
|
|
|
import { getTranslation } from "@server/lib/i18n";
|
|
|
|
export type TeamBookingPageProps = inferSSRProps<typeof getServerSideProps>;
|
|
|
|
export default function TeamBookingPage(props: TeamBookingPageProps) {
|
|
return <BookingPage {...props} />;
|
|
}
|
|
|
|
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
|
const eventTypeId = parseInt(asStringOrThrow(context.query.type));
|
|
if (typeof eventTypeId !== "number" || eventTypeId % 1 !== 0) {
|
|
return {
|
|
notFound: true,
|
|
} as const;
|
|
}
|
|
|
|
const eventType = await prisma.eventType.findUnique({
|
|
where: {
|
|
id: eventTypeId,
|
|
},
|
|
select: {
|
|
id: true,
|
|
title: true,
|
|
slug: true,
|
|
description: true,
|
|
length: true,
|
|
locations: true,
|
|
customInputs: true,
|
|
periodType: true,
|
|
periodDays: true,
|
|
periodStartDate: true,
|
|
periodEndDate: true,
|
|
periodCountCalendarDays: true,
|
|
disableGuests: true,
|
|
price: true,
|
|
currency: true,
|
|
metadata: true,
|
|
team: {
|
|
select: {
|
|
slug: true,
|
|
name: true,
|
|
logo: true,
|
|
},
|
|
},
|
|
users: {
|
|
select: {
|
|
avatar: true,
|
|
name: true,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
if (!eventType) return { notFound: true };
|
|
|
|
const eventTypeObject = [eventType].map((e) => {
|
|
return {
|
|
...e,
|
|
metadata: (eventType.metadata || {}) as JSONObject,
|
|
periodStartDate: e.periodStartDate?.toString() ?? null,
|
|
periodEndDate: e.periodEndDate?.toString() ?? null,
|
|
};
|
|
})[0];
|
|
|
|
async function getBooking() {
|
|
return prisma.booking.findFirst({
|
|
where: {
|
|
uid: asStringOrThrow(context.query.rescheduleUid),
|
|
},
|
|
select: {
|
|
description: true,
|
|
attendees: {
|
|
select: {
|
|
email: true,
|
|
name: true,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
}
|
|
|
|
type Booking = Prisma.PromiseReturnType<typeof getBooking>;
|
|
let booking: Booking | null = null;
|
|
|
|
if (context.query.rescheduleUid) {
|
|
booking = await getBooking();
|
|
}
|
|
|
|
const t = await getTranslation(context.locale ?? "en", "common");
|
|
|
|
return {
|
|
props: {
|
|
locationLabels: getLocationLabels(t),
|
|
profile: {
|
|
...eventTypeObject.team,
|
|
slug: "team/" + eventTypeObject.slug,
|
|
image: eventTypeObject.team?.logo || null,
|
|
theme: null /* Teams don't have a theme, and `BookingPage` uses it */,
|
|
brandColor: null /* Teams don't have a brandColor, and `BookingPage` uses it */,
|
|
darkBrandColor: null /* Teams don't have a darkBrandColor, and `BookingPage` uses it */,
|
|
},
|
|
eventType: eventTypeObject,
|
|
booking,
|
|
isDynamicGroupBooking: false,
|
|
},
|
|
};
|
|
}
|