concatenate subdivision saves

This commit is contained in:
Francis Cao 2023-04-13 22:40:48 -07:00
parent 44e37ece2d
commit 9dd9ab1325
2 changed files with 32 additions and 2 deletions

View File

@ -137,7 +137,7 @@ async function clickhouseQuery(data: {
session_id: sessionId,
event_id: eventId,
country: country ? country : null,
subdivision1: subdivision1 ? subdivision1 : null,
subdivision1: subdivision1 ? country.concat('-', subdivision1) : null,
subdivision2: subdivision2 ? subdivision2 : null,
city: city ? city : null,
url_path: urlPath?.substring(0, URL_LENGTH),

View File

@ -18,7 +18,37 @@ export async function createSession(args: Prisma.SessionCreateInput) {
}
async function relationalQuery(data: Prisma.SessionCreateInput) {
return prisma.client.session.create({ data });
const {
id,
websiteId,
hostname,
browser,
os,
device,
screen,
language,
country,
subdivision1,
subdivision2,
city,
} = data;
return prisma.client.session.create({
data: {
id,
websiteId,
hostname,
browser,
os,
device,
screen,
language,
country,
subdivision1: country.concat('-', subdivision1),
subdivision2,
city,
},
});
}
async function clickhouseQuery(data: {