This commit is contained in:
Mike Cao 2022-10-11 23:48:05 -07:00
commit c33729e185
12 changed files with 42 additions and 28 deletions

View file

@ -61,7 +61,7 @@ function getDateFormat(date) {
}
function getCommaSeparatedStringFormat(data) {
return data.map(a => `'${a}'`).join(',');
return data.map(a => `'${a}'`).join(',') || '';
}
function getBetweenDates(field, start_at, end_at) {

View file

@ -39,7 +39,7 @@ export async function getSession(req) {
// Check database if does not exists in Redis
if (!websiteId) {
const website = await getWebsiteByUuid(websiteUuid);
websiteId = website ? website.websiteId : null;
websiteId = website ? website.id : null;
}
if (!websiteId || websiteId === DELETED) {
@ -47,7 +47,7 @@ export async function getSession(req) {
}
const { userAgent, browser, os, ip, country, device } = await getClientInfo(req, payload);
const sessionUuid = uuid(websiteId, hostname, ip, userAgent);
const sessionUuid = uuid(websiteUuid, hostname, ip, userAgent);
let sessionId = null;
let session = null;
@ -61,7 +61,7 @@ export async function getSession(req) {
// Check database if does not exists in Redis
if (!sessionId) {
session = await getSessionByUuid(sessionUuid);
sessionId = session ? session.sessionId : null;
sessionId = session ? session.id : null;
}
if (!sessionId) {
@ -97,7 +97,10 @@ export async function getSession(req) {
}
return {
websiteId: websiteId,
website: {
websiteId,
websiteUuid,
},
session,
};
}