|
|
|
@ -65,7 +65,7 @@ app.get(
|
|
|
|
|
|
|
|
|
|
|
|
const visitor_data = {
|
|
|
|
const visitor_data = {
|
|
|
|
shortener_id: shortener[0].id,
|
|
|
|
shortener_id: shortener[0].id,
|
|
|
|
country: geolocation.data.location.country.name as string,
|
|
|
|
country_code: geolocation.data.location.country.alpha2 as string,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await db.insertInto('visitor').values(visitor_data).execute()
|
|
|
|
await db.insertInto('visitor').values(visitor_data).execute()
|
|
|
|
@ -92,7 +92,7 @@ app.get('/link/:shortenerCode', async ({ params: { shortenerCode } }) => {
|
|
|
|
.selectFrom('visitor')
|
|
|
|
.selectFrom('visitor')
|
|
|
|
.select([
|
|
|
|
.select([
|
|
|
|
'visitor.created_at as visited_at',
|
|
|
|
'visitor.created_at as visited_at',
|
|
|
|
'visitor.country',
|
|
|
|
'visitor.country_code',
|
|
|
|
])
|
|
|
|
])
|
|
|
|
.whereRef('visitor.shortener_id', '=', 'shortener.id')
|
|
|
|
.whereRef('visitor.shortener_id', '=', 'shortener.id')
|
|
|
|
).as('visitors'),
|
|
|
|
).as('visitors'),
|
|
|
|
|