- Added country, city, countryCode, latitude, and longitude fields to the Session model. - Updated geoip service to fetch and store geolocation data based on user IP. - Created a new admin endpoint to retrieve geolocation statistics, including user counts by country and city. - Enhanced admin page to display geolocation statistics with expandable city details. - Introduced caching for geolocation data to optimize performance.
To install dependencies:
bun install
To run:
bun run dev
Tests
Run all backend tests:
bun run test
Test naming convention
*.test.tsor*.spec.ts: service-level tests. These run with the shared Prisma preload attest/support/prisma.mock.ts.*.handler.test.ts: handler-level tests. These should mock the service module locally withmock.module(...)and import the handler after the mock is in place.
Recommended pattern
- Keep business logic tests focused on the service layer.
- Use handler tests only to verify request parsing, status mapping, and response shaping.
- Put shared Prisma mocking helpers in
test/support/.