diff --git a/components/common/Calendar.js b/components/common/Calendar.js index 7aea34c3..288cb184 100644 --- a/components/common/Calendar.js +++ b/components/common/Calendar.js @@ -106,12 +106,19 @@ export default function Calendar({ date, minDate, maxDate, onChange }) { } const DaySelector = ({ date, minDate, maxDate, locale, onSelect }) => { - const startWeek = startOfWeek(date, { locale: getDateLocale(locale) }); - const startMonth = startOfMonth(date, { locale: getDateLocale(locale) }); - const startDay = subDays(startMonth, startMonth.getDay()); + const dateLocale = getDateLocale(locale); + const weekStartsOn = dateLocale?.options?.weekStartsOn || 0; + const startWeek = startOfWeek(date, { + locale: dateLocale, + weekStartsOn, + }); + const startMonth = startOfMonth(date); + const startDay = subDays(startMonth, startMonth.getDay() - weekStartsOn); const month = date.getMonth(); const year = date.getFullYear(); + console.log({ dateLocale, startDay, startWeek, startMonth, month, year }); + const daysOfWeek = []; for (let i = 0; i < 7; i++) { daysOfWeek.push(addDays(startWeek, i)); diff --git a/components/metrics/ReferrersTable.js b/components/metrics/ReferrersTable.js index f2fa0215..c7079e8d 100644 --- a/components/metrics/ReferrersTable.js +++ b/components/metrics/ReferrersTable.js @@ -35,7 +35,6 @@ export default function ReferrersTable({ websiteId, websiteDomain, showFilters, ]; const renderLink = ({ w: link, x: label }) => { - console.log({ link, label }); return (
diff --git a/lib/queries.js b/lib/queries.js index f54b9267..5bcd18ba 100644 --- a/lib/queries.js +++ b/lib/queries.js @@ -36,7 +36,7 @@ export async function rawQuery(query, params = []) { const sql = db === MYSQL ? query.replace(/\$[0-9]+/g, '?') : query; - return prisma.$queryRaw.apply(prisma, [sql, ...params]); + return prisma.$queryRawUnsafe.apply(prisma, [sql, ...params]); } export function getDateQuery(field, unit, timezone) { @@ -170,14 +170,11 @@ export async function resetWebsite(website_id) { export async function deleteWebsite(website_id) { return runQuery( - /* Prisma bug, does not cascade on non-nullable foreign keys prisma.website.delete({ where: { website_id, }, }), - */ - prisma.$queryRaw`delete from website where website_id=${website_id}`, ); } @@ -269,14 +266,11 @@ export async function updateAccount(user_id, data) { export async function deleteAccount(user_id) { return runQuery( - /* Prisma bug, does not cascade on non-nullable foreign keys prisma.account.delete({ where: { user_id, }, }), - */ - prisma.$queryRaw`delete from account where user_id=${user_id}`, ); } diff --git a/package.json b/package.json index 496b961b..0a7a1f9d 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ }, "dependencies": { "@fontsource/inter": "4.5.0", - "@prisma/client": "2.29.1", + "@prisma/client": "3.6.0", "@reduxjs/toolkit": "^1.6.1", "bcryptjs": "^2.4.3", "chalk": "^4.1.1", @@ -122,7 +122,7 @@ "postcss-rtlcss": "^3.3.2", "prettier": "^2.3.2", "prettier-eslint": "^13.0.0", - "prisma": "2.29.1", + "prisma": "3.6.0", "rollup": "^2.48.0", "rollup-plugin-hashbang": "^2.2.2", "rollup-plugin-terser": "^7.0.2", diff --git a/yarn.lock b/yarn.lock index f099413c..44f4703d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1631,22 +1631,22 @@ resolved "https://registry.yarnpkg.com/@panva/asn1.js/-/asn1.js-1.0.0.tgz#dd55ae7b8129e02049f009408b97c61ccf9032f6" integrity sha512-UdkG3mLEqXgnlKsWanWcgb6dOjUzJ+XC5f+aWw30qrtjxeNUSfKX1cd5FBzOaXQumoe9nIqeZUvrRJS03HCCtw== -"@prisma/client@2.29.1": - version "2.29.1" - resolved "https://registry.yarnpkg.com/@prisma/client/-/client-2.29.1.tgz#a7b91c9644800de4e00b2f7c3789ff4bae42b3d6" - integrity sha512-GhieSvHGPIV5IwRYIkJ4FrGSNfX18lPhFtlyVWxhvX0ocdy8oTnjNZVTFgGxB6qVmJIUpH1HsckAzIoAX689IA== +"@prisma/client@3.6.0": + version "3.6.0" + resolved "https://registry.yarnpkg.com/@prisma/client/-/client-3.6.0.tgz#68a60cd4c73a369b11f72e173e86fd6789939293" + integrity sha512-ycSGY9EZGROtje0iCNsgC5Zqi/ttX2sO7BNMYaLsUMiTlf3F69ZPH+08pRo0hrDfkZzyimXYqeXJlaoYDH1w7A== dependencies: - "@prisma/engines-version" "2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a" + "@prisma/engines-version" "3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727" -"@prisma/engines-version@2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a": - version "2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a" - resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a.tgz#96db92f09714d4dd2a5e21054c28bd1c0820fa77" - integrity sha512-BU1DNNDhdzqjHtycpUzDrU8+jf6ZY+fbXvCV/rbqG+0JifljlIo4vbkHDMg97gBi1Do8pTLZGlTH16FlniKgAg== +"@prisma/engines-version@3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727": + version "3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727" + resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727.tgz#25aa447776849a774885866b998732b37ec4f4f5" + integrity sha512-vtoO2ys6mSfc8ONTWdcYztKN3GBU1tcKBj0aXObyjzSuGwHFcM/pEA0xF+n1W4/0TAJgfoPX2khNEit6g0jtNA== -"@prisma/engines@2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a": - version "2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a" - resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a.tgz#0a44a6dcbee7e0a2850ea086675a8a4f4d627f9d" - integrity sha512-cgEoGK3dmKZkMp/sRbL8TsuVS50rHXYBHk2NY18DPUGr5//4ICno46EjzlayqAFVak8J6RtWZEs+8tE8j8frAQ== +"@prisma/engines@3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727": + version "3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727" + resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727.tgz#c68ede6aeffa9ef7743a32cfa6daf9172a4e15b3" + integrity sha512-dRClHS7DsTVchDKzeG72OaEyeDskCv91pnZ72Fftn0mp4BkUvX2LvWup65hCNzwwQm5IDd6A88APldKDnMiEMA== "@reduxjs/toolkit@^1.6.1": version "1.6.2" @@ -6568,12 +6568,12 @@ pretty-format@^23.0.1: ansi-regex "^3.0.0" ansi-styles "^3.2.0" -prisma@2.29.1: - version "2.29.1" - resolved "https://registry.yarnpkg.com/prisma/-/prisma-2.29.1.tgz#7845f55c7f09955b01f973c6a4b1f330cb212e7d" - integrity sha512-fRGh90+z0m3Jw3D6KBE6wyVCRR0w6M6QD93jh+em8IOQycmC48zB8hho8zeri3J9//C0k8fkDeQrRLJUosXROw== +prisma@3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/prisma/-/prisma-3.6.0.tgz#99532abc02e045e58c6133a19771bdeb28cecdbe" + integrity sha512-6SqgHS/5Rq6HtHjsWsTxlj+ySamGyCLBUQfotc2lStOjPv52IQuDVpp58GieNqc9VnfuFyHUvTZw7aQB+G2fvQ== dependencies: - "@prisma/engines" "2.29.0-34.1be4cd60b89afa04b192acb1ef47758a39810f3a" + "@prisma/engines" "3.6.0-24.dc520b92b1ebb2d28dc3161f9f82e875bd35d727" process@0.11.10: version "0.11.10"