diff --git a/elysia/src/index.ts b/elysia/src/index.ts index 66bbce1..7b84d46 100644 --- a/elysia/src/index.ts +++ b/elysia/src/index.ts @@ -65,7 +65,7 @@ app.get( const visitor_data = { 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() @@ -92,7 +92,7 @@ app.get('/link/:shortenerCode', async ({ params: { shortenerCode } }) => { .selectFrom('visitor') .select([ 'visitor.created_at as visited_at', - 'visitor.country', + 'visitor.country_code', ]) .whereRef('visitor.shortener_id', '=', 'shortener.id') ).as('visitors'), diff --git a/elysia/src/types.ts b/elysia/src/types.ts index 85691cc..bd20939 100644 --- a/elysia/src/types.ts +++ b/elysia/src/types.ts @@ -25,7 +25,7 @@ export type ShortenerUpdate = Updateable export interface VisitorTable { id: Generated shortener_id: number - country: string + country_code: string created_at: ColumnType }