mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
Pixel route.
This commit is contained in:
parent
3c5c1e48e9
commit
0ac8bd41b6
10 changed files with 139 additions and 64 deletions
|
|
@ -1,10 +1,7 @@
|
|||
import { Prisma } from '@/generated/prisma/client';
|
||||
import prisma from '@/lib/prisma';
|
||||
|
||||
export async function createSession(
|
||||
data: Prisma.SessionCreateInput,
|
||||
options = { skipDuplicates: false },
|
||||
) {
|
||||
export async function createSession(data: Prisma.SessionCreateInput) {
|
||||
const {
|
||||
id,
|
||||
websiteId,
|
||||
|
|
@ -36,12 +33,7 @@ export async function createSession(
|
|||
},
|
||||
});
|
||||
} catch (e: any) {
|
||||
// With skipDuplicates flag: ignore unique constraint error and return null
|
||||
if (
|
||||
options.skipDuplicates &&
|
||||
e instanceof Prisma.PrismaClientKnownRequestError &&
|
||||
e.code === 'P2002'
|
||||
) {
|
||||
if (e.message.toLowerCase().includes('unique constraint')) {
|
||||
return null;
|
||||
}
|
||||
throw e;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue