Implemented short UUID as UID
parent
e5dc036c50
commit
6c92e2fe1b
|
@ -160,13 +160,19 @@
|
|||
}
|
||||
},
|
||||
"@headlessui/react": {
|
||||
"version": "1.1.1"
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@headlessui/react/-/react-1.1.1.tgz",
|
||||
"integrity": "sha512-fxNKxRrjNXdNYNMhAVrv1nz0gIMX3JhFizTA9lNrEC8+aY3JR00GZTPhuG785RZGvnHXCdYCGHeAhqw9uRNRrA=="
|
||||
},
|
||||
"@heroicons/react": {
|
||||
"version": "1.0.1"
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-1.0.1.tgz",
|
||||
"integrity": "sha512-uikw2gKCmqnvjVxitecWfFLMOKyL9BTFcU4VM3hHj9OMwpkCr5Ke+MRMyY2/aQVmsYs4VTq7NCFX05MYwAHi3g=="
|
||||
},
|
||||
"@jitsu/sdk-js": {
|
||||
"version": "2.0.1"
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@jitsu/sdk-js/-/sdk-js-2.0.1.tgz",
|
||||
"integrity": "sha512-PPtbNZosEGZ+rWefYodstAA69eJSHMgWfufqZ1ATiYUrobpbGQsLQBKxI0fJ+YvO1oryfYLlJqgJe0X12vNraQ=="
|
||||
},
|
||||
"@next/env": {
|
||||
"version": "10.2.0",
|
||||
|
@ -300,6 +306,8 @@
|
|||
},
|
||||
"@prisma/client": {
|
||||
"version": "2.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-2.23.0.tgz",
|
||||
"integrity": "sha512-xsHdo3+wIH0hJVGfKHYTEKtifStjKH0b5t8t7hV32Fypq6+3uxhAi3F25yxuI4XSHXg21nb7Ha82lNwU/0TERA==",
|
||||
"requires": {
|
||||
"@prisma/engines-version": "2.23.0-36.adf5e8cba3daf12d456d911d72b6e9418681b28b"
|
||||
}
|
||||
|
@ -340,6 +348,8 @@
|
|||
},
|
||||
"@tailwindcss/forms": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.2.1.tgz",
|
||||
"integrity": "sha512-czfvEdY+J2Ogfd6RUSr/ZSUmDxTujr34M++YLnp2cCPC3oJ4kFvFMaRXA6cEXKw7F1hJuapdjXRjsXIEXGgORg==",
|
||||
"requires": {
|
||||
"mini-svg-data-uri": "^1.2.3"
|
||||
}
|
||||
|
@ -357,6 +367,8 @@
|
|||
},
|
||||
"@types/react": {
|
||||
"version": "17.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.5.tgz",
|
||||
"integrity": "sha512-bj4biDB9ZJmGAYTWSKJly6bMr4BLUiBrx9ujiJEoP9XIDY9CTaPGxE5QWN/1WjpPLzYF7/jRNnV2nNxNe970sw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/prop-types": "*",
|
||||
|
@ -432,6 +444,11 @@
|
|||
"color-convert": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"any-base": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz",
|
||||
"integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg=="
|
||||
},
|
||||
"any-promise": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
|
||||
|
@ -503,6 +520,8 @@
|
|||
},
|
||||
"autoprefixer": {
|
||||
"version": "10.2.5",
|
||||
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.2.5.tgz",
|
||||
"integrity": "sha512-7H4AJZXvSsn62SqZyJCP+1AWwOuoYpUfK6ot9vm0e87XD6mT8lDywc9D9OTJPMULyGcvmIxzTAMeG2Cc+YX+fA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"browserslist": "^4.16.3",
|
||||
|
@ -575,7 +594,9 @@
|
|||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"bcryptjs": {
|
||||
"version": "2.4.3"
|
||||
"version": "2.4.3",
|
||||
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz",
|
||||
"integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms="
|
||||
},
|
||||
"big.js": {
|
||||
"version": "5.2.2",
|
||||
|
@ -1028,7 +1049,9 @@
|
|||
"integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og=="
|
||||
},
|
||||
"dayjs": {
|
||||
"version": "1.10.4"
|
||||
"version": "1.10.4",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.4.tgz",
|
||||
"integrity": "sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.1",
|
||||
|
@ -1518,6 +1541,8 @@
|
|||
},
|
||||
"googleapis": {
|
||||
"version": "67.1.1",
|
||||
"resolved": "https://registry.npmjs.org/googleapis/-/googleapis-67.1.1.tgz",
|
||||
"integrity": "sha512-WLYk8R4dpW/oIxXhj0PQGhu+eOUpQbtWYTCxx/jeENr4arE9UmV5qmz0h1Gs1SPF/O/8PjCQIsPwOuHAlj78GA==",
|
||||
"requires": {
|
||||
"google-auth-library": "^7.0.2",
|
||||
"googleapis-common": "^5.0.1"
|
||||
|
@ -1678,6 +1703,8 @@
|
|||
},
|
||||
"ics": {
|
||||
"version": "2.27.0",
|
||||
"resolved": "https://registry.npmjs.org/ics/-/ics-2.27.0.tgz",
|
||||
"integrity": "sha512-Qgf59OEE38EYX/tVPbo+4bsk0+91Io7jTfp37N3o8BbW/CBYHPdw3GcBov8u2ywjg35xNk8o2b+4UmFwdKOP8A==",
|
||||
"requires": {
|
||||
"joi": "^17.1.1",
|
||||
"uuid": "^3.3.3"
|
||||
|
@ -2249,6 +2276,8 @@
|
|||
},
|
||||
"next": {
|
||||
"version": "10.2.0",
|
||||
"resolved": "https://registry.npmjs.org/next/-/next-10.2.0.tgz",
|
||||
"integrity": "sha512-PKDKCSF7s82xudu3kQhOEaokxggpbLEWouEUtzP6OqV0YqKYHF+Ff+BFLycEem8ixtTM2M6ElN0VRJcskJfxPQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "7.12.5",
|
||||
"@hapi/accept": "5.0.1",
|
||||
|
@ -2314,6 +2343,8 @@
|
|||
},
|
||||
"next-auth": {
|
||||
"version": "3.19.8",
|
||||
"resolved": "https://registry.npmjs.org/next-auth/-/next-auth-3.19.8.tgz",
|
||||
"integrity": "sha512-BB3h3JedZrQ/usB5JFdJSxQcSsMopT8/RfboGAVIASfH7Lyu2PddZnlM1YlmqDZ90lHeFd2AfrxxCYX7HdDcKg==",
|
||||
"requires": {
|
||||
"@next-auth/prisma-legacy-adapter": "^0.0.1-canary.163",
|
||||
"@next-auth/typeorm-legacy-adapter": "^0.0.2-canary.155",
|
||||
|
@ -2358,6 +2389,8 @@
|
|||
},
|
||||
"next-transpile-modules": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/next-transpile-modules/-/next-transpile-modules-7.0.0.tgz",
|
||||
"integrity": "sha512-HgVczU5ajXKvE7HO3ZLmBmxXj79aq8jSZNYpCttim+MZ+b0GIsdk7AV2w7Ax/tIM1/dJA+vV/6loXCRYlbsGGA==",
|
||||
"requires": {
|
||||
"enhanced-resolve": "^5.7.0",
|
||||
"escalade": "^3.1.1"
|
||||
|
@ -2552,7 +2585,9 @@
|
|||
"integrity": "sha512-uW7fodD6pyW2FZNZnp/Z3hvWKeEW1Y8R1+1CnErE8cXFXzl5blBOoVB41CvMer6P6Q0S5FXDwcHgFd1Wj0U9zg=="
|
||||
},
|
||||
"nodemailer": {
|
||||
"version": "6.6.1"
|
||||
"version": "6.6.1",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.1.tgz",
|
||||
"integrity": "sha512-1xzFN3gqv+/qJ6YRyxBxfTYstLNt0FCtZaFRvf4Sg9wxNGWbwFmGXVpfSi6ThGK6aRxAo+KjHtYSW8NvCsNSAg=="
|
||||
},
|
||||
"normalize-path": {
|
||||
"version": "3.0.0",
|
||||
|
@ -2886,6 +2921,8 @@
|
|||
},
|
||||
"prisma": {
|
||||
"version": "2.23.0",
|
||||
"resolved": "https://registry.npmjs.org/prisma/-/prisma-2.23.0.tgz",
|
||||
"integrity": "sha512-3c/lmDy8nsPcEsfCufvCTJUEuwmAcTPbeGg9fL1qjlvS314duLUA/k2nm3n1rq4ImKqzeC5uaKfvI2IoAfwrJA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@prisma/engines": "2.23.0-36.adf5e8cba3daf12d456d911d72b6e9418681b28b"
|
||||
|
@ -3018,6 +3055,8 @@
|
|||
},
|
||||
"react": {
|
||||
"version": "17.0.1",
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-17.0.1.tgz",
|
||||
"integrity": "sha512-lG9c9UuMHdcAexXtigOZLX8exLWkW0Ku29qPRU8uhF2R9BN96dLCt0psvzPLlHc5OWkgymP3qwTRgbnw5BKx3w==",
|
||||
"requires": {
|
||||
"loose-envify": "^1.1.0",
|
||||
"object-assign": "^4.1.1"
|
||||
|
@ -3025,6 +3064,8 @@
|
|||
},
|
||||
"react-dom": {
|
||||
"version": "17.0.1",
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.1.tgz",
|
||||
"integrity": "sha512-6eV150oJZ9U2t9svnsspTMrWNyHc6chX0KzDeAOXftRa8bNeOKTTfCJ7KorIwenkHd2xqVTBTCZd79yk/lx/Ug==",
|
||||
"requires": {
|
||||
"loose-envify": "^1.1.0",
|
||||
"object-assign": "^4.1.1",
|
||||
|
@ -3046,6 +3087,8 @@
|
|||
},
|
||||
"react-phone-number-input": {
|
||||
"version": "3.1.21",
|
||||
"resolved": "https://registry.npmjs.org/react-phone-number-input/-/react-phone-number-input-3.1.21.tgz",
|
||||
"integrity": "sha512-Q1CS7RKFE+DyiZxEKrs00wf7geQ4qBJpOflCVNtTXnO0a2iXG42HFF7gtUpKQpro8THr7ejNy8H+zm2zD+EgvQ==",
|
||||
"requires": {
|
||||
"classnames": "^2.2.5",
|
||||
"country-flag-icons": "^1.0.2",
|
||||
|
@ -3061,6 +3104,8 @@
|
|||
},
|
||||
"react-timezone-select": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/react-timezone-select/-/react-timezone-select-1.0.2.tgz",
|
||||
"integrity": "sha512-MDv4rmDkop3nZcIH27tLwIuIVovJE6ushmr9r0kR1SSzVErdydV01vI1ch8u4JAAFpnR5lYDt5PBqQW/lUS+Jg==",
|
||||
"requires": {
|
||||
"react-select": "^4.2.1",
|
||||
"spacetime": "^6.14.0",
|
||||
|
@ -3246,6 +3291,15 @@
|
|||
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz",
|
||||
"integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg=="
|
||||
},
|
||||
"short-uuid": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/short-uuid/-/short-uuid-4.2.0.tgz",
|
||||
"integrity": "sha512-r3cxuPPZSuF0QkKsK9bBR7u+7cwuCRzWzgjPh07F5N2iIUNgblnMHepBY16xgj5t1lG9iOP9k/TEafY1qhRzaw==",
|
||||
"requires": {
|
||||
"any-base": "^1.1.0",
|
||||
"uuid": "^8.3.2"
|
||||
}
|
||||
},
|
||||
"side-channel": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
||||
|
@ -3430,6 +3484,8 @@
|
|||
},
|
||||
"tailwindcss": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-2.1.2.tgz",
|
||||
"integrity": "sha512-T5t+wwd+/hsOyRw2HJuFuv0LTUm3MUdHm2DJ94GPVgzqwPPFa9XxX0KlwLWupUuiOUj6uiKURCzYPHFcuPch/w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@fullhuman/postcss-purgecss": "^3.1.3",
|
||||
|
@ -3640,6 +3696,8 @@
|
|||
},
|
||||
"typescript": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz",
|
||||
"integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==",
|
||||
"dev": true
|
||||
},
|
||||
"unbox-primitive": {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
"react-phone-number-input": "^3.1.21",
|
||||
"react-select": "^4.3.0",
|
||||
"react-timezone-select": "^1.0.2",
|
||||
"short-uuid": "^4.2.0",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -2,8 +2,11 @@ import type {NextApiRequest, NextApiResponse} from 'next';
|
|||
import prisma from '../../../lib/prisma';
|
||||
import {CalendarEvent, createEvent, updateEvent} from '../../../lib/calendarClient';
|
||||
import createConfirmBookedEmail from "../../../lib/emails/confirm-booked";
|
||||
import sha256 from "../../../lib/sha256";
|
||||
import async from 'async';
|
||||
import {v5 as uuidv5} from 'uuid';
|
||||
import short from 'short-uuid';
|
||||
|
||||
const translator = short();
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
const {user} = req.query;
|
||||
|
@ -36,8 +39,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
]
|
||||
};
|
||||
|
||||
// TODO: Use UUID algorithm to shorten this
|
||||
const hashUID = sha256(JSON.stringify(evt));
|
||||
const hashUID = translator.fromUUID(uuidv5(JSON.stringify(evt), uuidv5.URL));
|
||||
|
||||
const eventType = await prisma.eventType.findFirst({
|
||||
where: {
|
||||
|
|
13
yarn.lock
13
yarn.lock
|
@ -391,6 +391,11 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0:
|
|||
dependencies:
|
||||
color-convert "^2.0.1"
|
||||
|
||||
any-base@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/any-base/-/any-base-1.1.0.tgz#ae101a62bc08a597b4c9ab5b7089d456630549fe"
|
||||
integrity sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==
|
||||
|
||||
any-promise@^1.0.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f"
|
||||
|
@ -2849,6 +2854,14 @@ shell-quote@1.7.2:
|
|||
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2"
|
||||
integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==
|
||||
|
||||
short-uuid@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/short-uuid/-/short-uuid-4.2.0.tgz#3706d9e7287ac589dc5ffe324d3e34817a07540b"
|
||||
integrity sha512-r3cxuPPZSuF0QkKsK9bBR7u+7cwuCRzWzgjPh07F5N2iIUNgblnMHepBY16xgj5t1lG9iOP9k/TEafY1qhRzaw==
|
||||
dependencies:
|
||||
any-base "^1.1.0"
|
||||
uuid "^8.3.2"
|
||||
|
||||
side-channel@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
|
||||
|
|
Loading…
Reference in New Issue