+
+
+
+
+
+
+
+
:
+
+
+
+
+
);
@@ -225,4 +376,4 @@ export async function getServerSideProps(context) {
return {
props: {integrations},
}
-}
\ No newline at end of file
+}
diff --git a/pages/settings/billing.tsx b/pages/settings/billing.tsx
new file mode 100644
index 00000000..57acc64f
--- /dev/null
+++ b/pages/settings/billing.tsx
@@ -0,0 +1,66 @@
+import Head from 'next/head';
+import Shell from '../../components/Shell';
+import SettingsShell from '../../components/Settings';
+import prisma from '../../lib/prisma';
+import {getSession, useSession} from 'next-auth/client';
+
+export default function Billing(props) {
+ const [ session, loading ] = useSession();
+
+ if (loading) {
+ return
Loading...
;
+ }
+
+ return (
+
+
+ Billing | Calendso
+
+
+
+
+
+ Change your Subscription
+
+
+ Cancel, update credit card or change plan
+
+
+
+
+
+
+
+
+ );
+}
+
+export async function getServerSideProps(context) {
+ const session = await getSession(context);
+ if (!session) {
+ return { redirect: { permanent: false, destination: '/auth/login' } };
+ }
+
+ const user = await prisma.user.findFirst({
+ where: {
+ email: session.user.email,
+ },
+ select: {
+ id: true,
+ username: true,
+ name: true,
+ email: true,
+ bio: true,
+ avatar: true,
+ timeZone: true,
+ weekStart: true,
+ }
+ });
+
+ return {
+ props: {user}, // will be passed to the page component as props
+ }
+}
\ No newline at end of file
diff --git a/pages/success.tsx b/pages/success.tsx
index c36ab173..0d962393 100644
--- a/pages/success.tsx
+++ b/pages/success.tsx
@@ -10,6 +10,7 @@ import utc from 'dayjs/plugin/utc';
import toArray from 'dayjs/plugin/toArray';
import timezone from 'dayjs/plugin/timezone';
import { createEvent } from 'ics';
+import {getEventName} from "../lib/event";
dayjs.extend(utc);
dayjs.extend(toArray);
@@ -17,7 +18,7 @@ dayjs.extend(timezone);
export default function Success(props) {
const router = useRouter();
- const { location } = router.query;
+ const {location, name} = router.query;
const [ is24h, setIs24h ] = useState(false);
const [ date, setDate ] = useState(dayjs.utc(router.query.date));
@@ -27,6 +28,8 @@ export default function Success(props) {
setIs24h(!!localStorage.getItem('timeOption.is24hClock'));
}, []);
+ const eventName = getEventName(name, props.eventType.title, props.eventType.eventName);
+
function eventLink(): string {
let optional = {};
@@ -35,9 +38,9 @@ export default function Success(props) {
}
const event = createEvent({
- start: date.utc().toArray().slice(0, 6),
+ start: date.utc().toArray().slice(0, 6).map((v, i) => i === 1 ? v + 1 : v),
startInputType: 'utc',
- title: props.eventType.title + ' with ' + props.user.name,
+ title: eventName,
description: props.eventType.description,
duration: { minutes: props.eventType.length },
...optional
@@ -53,7 +56,7 @@ export default function Success(props) {
return(
-
Booking Confirmed | {props.eventType.title} with {props.user.name || props.user.username} | Calendso
+ Booking Confirmed | {eventName} | Calendso
@@ -76,7 +79,7 @@ export default function Success(props) {
-
{props.eventType.title} with {props.user.name}
+
{eventName}
{props.eventType.length} minutes
@@ -95,17 +98,17 @@ export default function Success(props) {
Add to your calendar
-
+
-
+
-
+
@@ -149,7 +152,8 @@ export async function getServerSideProps(context) {
id: true,
title: true,
description: true,
- length: true
+ length: true,
+ eventName: true
}
});
diff --git a/prisma/migrations/20210615140247_added_selected_calendar/migration.sql b/prisma/migrations/20210615140247_added_selected_calendar/migration.sql
new file mode 100644
index 00000000..cdb27778
--- /dev/null
+++ b/prisma/migrations/20210615140247_added_selected_calendar/migration.sql
@@ -0,0 +1,11 @@
+-- CreateTable
+CREATE TABLE "SelectedCalendar" (
+ "userId" INTEGER NOT NULL,
+ "integration" TEXT NOT NULL,
+ "externalId" TEXT NOT NULL,
+
+ PRIMARY KEY ("userId","integration","externalId")
+);
+
+-- AddForeignKey
+ALTER TABLE "SelectedCalendar" ADD FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/prisma/migrations/20210615142134_added_custom_event_name/migration.sql b/prisma/migrations/20210615142134_added_custom_event_name/migration.sql
new file mode 100644
index 00000000..856cb4c7
--- /dev/null
+++ b/prisma/migrations/20210615142134_added_custom_event_name/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "EventType" ADD COLUMN "eventName" TEXT;
diff --git a/prisma/migrations/20210615153546_added_buffer_time/migration.sql b/prisma/migrations/20210615153546_added_buffer_time/migration.sql
new file mode 100644
index 00000000..9d6d8ca1
--- /dev/null
+++ b/prisma/migrations/20210615153546_added_buffer_time/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "users" ADD COLUMN "bufferTime" INTEGER NOT NULL DEFAULT 0;
diff --git a/prisma/migrations/20210615153759_add_email_verification_column/migration.sql b/prisma/migrations/20210615153759_add_email_verification_column/migration.sql
new file mode 100644
index 00000000..83352168
--- /dev/null
+++ b/prisma/migrations/20210615153759_add_email_verification_column/migration.sql
@@ -0,0 +1,20 @@
+-- AlterTable
+ALTER TABLE "users" ADD COLUMN "emailVerified" TIMESTAMP(3);
+
+-- CreateTable
+CREATE TABLE "VerificationRequest" (
+ "id" SERIAL NOT NULL,
+ "identifier" TEXT NOT NULL,
+ "token" TEXT NOT NULL,
+ "expires" TIMESTAMP(3) NOT NULL,
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "updatedAt" TIMESTAMP(3) NOT NULL,
+
+ PRIMARY KEY ("id")
+);
+
+-- CreateIndex
+CREATE UNIQUE INDEX "VerificationRequest.token_unique" ON "VerificationRequest"("token");
+
+-- CreateIndex
+CREATE UNIQUE INDEX "VerificationRequest.identifier_token_unique" ON "VerificationRequest"("identifier", "token");
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 57f4a90a..835f4533 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -22,6 +22,7 @@ model EventType {
userId Int?
bookings Booking[]
availability Schedule[]
+ eventName String?
}
model Credential {
@@ -45,12 +46,14 @@ model User {
weekStart String? @default("Sunday")
startTime Int @default(0)
endTime Int @default(1440)
+ bufferTime Int @default(0)
createdDate DateTime @default(now()) @map(name: "created")
eventTypes EventType[]
credentials Credential[]
teams Membership[]
bookings Booking[]
availability Schedule[]
+ selectedCalendars SelectedCalendar[]
@@map(name: "users")
}
@@ -137,3 +140,11 @@ model Schedule {
length Int
isOverride Boolean @default(false)
}
+
+model SelectedCalendar {
+ user User @relation(fields: [userId], references: [id])
+ userId Int
+ integration String
+ externalId String
+ @@id([userId,integration,externalId])
+}