Feat/um 62 prisma property names (#1562)

* checkpoint

* fix pg schema

* fix mysql schema

* change property names
This commit is contained in:
Brian Cao 2022-10-10 13:42:18 -07:00 committed by GitHub
parent 36edbe2f4c
commit 78338205a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 431 additions and 433 deletions

View file

@ -23,9 +23,9 @@ export async function getSession(req) {
}
}
const { website: website_uuid, hostname, screen, language } = payload;
const { website: websiteUuid, hostname, screen, language } = payload;
if (!validate(website_uuid)) {
if (!validate(websiteUuid)) {
return null;
}
@ -33,21 +33,21 @@ export async function getSession(req) {
// Check if website exists
if (redis.enabled) {
websiteId = Number(await redis.get(`website:${website_uuid}`));
websiteId = Number(await redis.get(`website:${websiteUuid}`));
}
// Check database if does not exists in Redis
if (!websiteId) {
const website = await getWebsiteByUuid(website_uuid);
websiteId = website ? website.website_id : null;
const website = await getWebsiteByUuid(websiteUuid);
websiteId = website ? website.websiteId : null;
}
if (!websiteId || websiteId === DELETED) {
throw new Error(`Website not found: ${website_uuid}`);
throw new Error(`Website not found: ${websiteUuid}`);
}
const { userAgent, browser, os, ip, country, device } = await getClientInfo(req, payload);
const session_uuid = uuid(websiteId, hostname, ip, userAgent);
const sessionUuid = uuid(websiteId, hostname, ip, userAgent);
let sessionId = null;
let session = null;
@ -55,19 +55,19 @@ export async function getSession(req) {
if (!clickhouse.enabled) {
// Check if session exists
if (redis.enabled) {
sessionId = Number(await redis.get(`session:${session_uuid}`));
sessionId = Number(await redis.get(`session:${sessionUuid}`));
}
// Check database if does not exists in Redis
if (!sessionId) {
session = await getSessionByUuid(session_uuid);
sessionId = session ? session.session_id : null;
session = await getSessionByUuid(sessionUuid);
sessionId = session ? session.sessionId : null;
}
if (!sessionId) {
try {
session = await createSession(websiteId, {
session_uuid,
sessionUuid,
hostname,
browser,
os,
@ -84,8 +84,8 @@ export async function getSession(req) {
}
} else {
session = {
session_id: sessionId,
session_uuid,
sessionId,
sessionUuid,
hostname,
browser,
os,
@ -97,7 +97,7 @@ export async function getSession(req) {
}
return {
website_id: websiteId,
websiteId: websiteId,
session,
};
}