add subdivision1/2, cities to query logic

This commit is contained in:
Francis Cao 2023-02-20 09:04:20 -08:00
parent 6bacfa5892
commit 55a586fe27
16 changed files with 184 additions and 57 deletions

View file

@ -44,7 +44,8 @@ export async function findSession(req) {
throw new Error(`Website not found: ${websiteId}`);
}
const { userAgent, browser, os, ip, country, device } = await getClientInfo(req, payload);
const { userAgent, browser, os, ip, country, subdivision1, subdivision2, city, device } =
await getClientInfo(req, payload);
const sessionId = uuid(websiteId, hostname, ip, userAgent);
// Clickhouse does not require session lookup
@ -59,6 +60,9 @@ export async function findSession(req) {
screen,
language,
country,
subdivision1,
subdivision2,
city,
};
}
@ -84,6 +88,9 @@ export async function findSession(req) {
screen,
language,
country,
subdivision1,
subdivision2,
city,
});
} catch (e) {
if (!e.message.toLowerCase().includes('unique constraint')) {