From d1bdac45eb2afe1a6e1916b0a4414b103bbd069e Mon Sep 17 00:00:00 2001 From: femyeda Date: Mon, 28 Jun 2021 19:39:08 -0500 Subject: [PATCH 1/3] dont allow user to book a past date --- pages/api/book/[user].ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pages/api/book/[user].ts b/pages/api/book/[user].ts index c6d41e0711..8fbd5791a6 100644 --- a/pages/api/book/[user].ts +++ b/pages/api/book/[user].ts @@ -66,6 +66,16 @@ const getLocationRequestFromIntegration = ({ location }: GetLocationRequestFromI export default async function handler(req: NextApiRequest, res: NextApiResponse) { const { user } = req.query; + const isTimeInPast = (time) => { + return dayjs(time).isBefore(new Date(), "day"); + }; + + if (isTimeInPast(req.body.start)) { + return res + .status(400) + .json({ errorCode: "BookingDateInPast", message: "Attempting to create a meeting in the past." }); + } + const currentUser = await prisma.user.findFirst({ where: { username: user, @@ -170,7 +180,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) }); // TODO isAvailable was throwing an error - const isAvailableToBeBooked = true;//isAvailable(commonAvailability, req.body.start, selectedEventType.length); + const isAvailableToBeBooked = true; //isAvailable(commonAvailability, req.body.start, selectedEventType.length); if (!isAvailableToBeBooked) { return res.status(400).json({ message: `${currentUser.name} is unavailable at this time.` }); From 39df7d61bca26946ea84b482bc8b86d96863a80e Mon Sep 17 00:00:00 2001 From: mihaic195 Date: Tue, 29 Jun 2021 11:45:54 +0300 Subject: [PATCH 2/3] fix: add login link on forgot password page --- pages/auth/forgot-password/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pages/auth/forgot-password/index.tsx b/pages/auth/forgot-password/index.tsx index 5760de01a9..f3313900b7 100644 --- a/pages/auth/forgot-password/index.tsx +++ b/pages/auth/forgot-password/index.tsx @@ -1,4 +1,5 @@ import Head from "next/head"; +import Link from "next/link"; import React from "react"; import { getCsrfToken } from "next-auth/client"; import debounce from "lodash.debounce"; @@ -137,6 +138,15 @@ export default function Page({ csrfToken }) { Request Password Reset +
+ + + +
)} From 272cee28d10698b40a946a4c1a355c9f955b1b81 Mon Sep 17 00:00:00 2001 From: Faraz Patankar Date: Tue, 29 Jun 2021 16:28:42 +0400 Subject: [PATCH 3/3] add railway button --- README.md | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 964e87cdcb..6ee88dc5ef 100644 --- a/README.md +++ b/README.md @@ -80,30 +80,30 @@ You will also need Google API credentials. You can get this from the [Google API ```
If you don't know how to configure the DATABASE_URL, then follow the steps here - + 1. Create a free account with [Heroku](https://www.heroku.com/). - - 2. Create a new app. + + 2. Create a new app. Google Chrome — CleanShotX | 2021-04-20 at 02 01 56 - + 3. In your new app, go to `Overview` and next to `Installed add-ons`, click `Configure Add-ons`. We need this to set up our database. ![image](https://user-images.githubusercontent.com/16905768/115323232-a53ba480-a17f-11eb-98db-58e2f8c52426.png) - 4. Once you clicked on `Configure Add-ons`, click on `Find more add-ons` and search for `postgres`. One of the options will be `Heroku Postgres` - click on that option. + 4. Once you clicked on `Configure Add-ons`, click on `Find more add-ons` and search for `postgres`. One of the options will be `Heroku Postgres` - click on that option. ![image](https://user-images.githubusercontent.com/16905768/115323126-5beb5500-a17f-11eb-8030-7380310807a9.png) - 5. Once the pop-up appears, click `Submit Order Form` - plan name should be `Hobby Dev - Free`. + 5. Once the pop-up appears, click `Submit Order Form` - plan name should be `Hobby Dev - Free`. Google Chrome — CleanShotX | 2021-04-20 at 02 04 29 - - 6. Once you completed the above steps, click on your newly created `Heroku Postgres` and go to its `Settings`. + + 6. Once you completed the above steps, click on your newly created `Heroku Postgres` and go to its `Settings`. ![image](https://user-images.githubusercontent.com/16905768/115323367-e92ea980-a17f-11eb-9ff4-dec95f2ec349.png) - - 7. In `Settings`, copy your URI to your Calendso .env file and replace the `postgresql://:@:` with it. + + 7. In `Settings`, copy your URI to your Calendso .env file and replace the `postgresql://:@:` with it. ![image](https://user-images.githubusercontent.com/16905768/115323556-4591c900-a180-11eb-9808-2f55d2aa3995.png) ![image](https://user-images.githubusercontent.com/16905768/115323697-7a9e1b80-a180-11eb-9f08-a742b1037f90.png) - 8. To view your DB, once you add new data in Prisma, you can use [Heroku Data Explorer](https://heroku-data-explorer.herokuapp.com/). -
+ 8. To view your DB, once you add new data in Prisma, you can use [Heroku Data Explorer](https://heroku-data-explorer.herokuapp.com/). + 5. Set up the database using the Prisma schema (found in `prisma/schema.prisma`) ```sh @@ -127,7 +127,7 @@ You will also need Google API credentials. You can get this from the [Google API git pull ``` 2. Apply database migrations by running one of the following commands: - + In a development environment, run: ``` npx prisma migrate dev @@ -140,7 +140,7 @@ You will also need Google API credentials. You can get this from the [Google API ``` 3. Check the `.env.example` and compare it to your current `.env` file. In case there are any fields not present in your current `.env`, add them there. - + For the current version, especially check if the variable `BASE_URL` is present and properly set in your environment, for example: ``` BASE_URL='https://yourdomain.com' @@ -155,6 +155,13 @@ You will also need Google API credentials. You can get this from the [Google API yarn start ``` 5. Enjoy the new version. + +## Deployment + +[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template?template=https%3A%2F%2Fgithub.com%2Fcalendso%2Fcalendso&plugins=postgresql&envs=GOOGLE_API_CREDENTIALS%2CBASE_URL%2CNEXTAUTH_URL%2CPORT&BASE_URLDefault=http%3A%2F%2Flocalhost%3A3000&NEXTAUTH_URLDefault=http%3A%2F%2Flocalhost%3A3000&PORTDefault=3000) + +You can deploy Calendso on [Railway](https://railway.app/) using the button above. The team at Railway also have a [detailed blog post](https://blog.railway.app/p/calendso) on deploying Calendso on their platform. + ## Roadmap @@ -239,4 +246,3 @@ Special thanks to these amazing projects which help power Calendso: * [Prisma](https://prisma.io/) [product-screenshot]: https://i.imgur.com/4yvFj2E.png -