Skip to content

Conversation

asgeija
Copy link
Member

@asgeija asgeija commented Oct 8, 2026

Closes #28

What

Adds the sightings and sighting(id) queries, so search, sorting, filtering
and pagination run in the database.

  • Case-insensitive search on city, shape and comments
  • Sort by newest, oldest, city and shape
  • Filter on shape, country, state and date range
  • Cursor pagination and totalCount
  • sighting(id) returns null if the id does not exist
  • .env.example and a README section for running against the VM database

Adds the dependency mysql2.

How to try it

  1. ssh -L 3306:localhost:3306 <user>@it2810-XX.idi.ntnu.no
  2. Copy backend/.env.example to backend/.env and add the password
  3. npm run dev:backend and open http://localhost:3001

AI usage

Claude Code helped write the queries, but i simplified it as it generated a lot of spagetti.

Implements the sightings and sighting(id) resolvers so search, sorting, filtering and pagination run in the database instead of the client.
Search matches city, shape and comments case-insensitively. Results
are paginated with an opaque cursor, and totalCount covers all
matches. Adds mysql2 as the database driver.

Refs #28
Adds .env.example and lets dev and start read backend/.env, so
everyone can run the backend against the VM database through an SSH tunnel. Describes the setup in the README.
@asgeija asgeija added this to the Partial submission 2 milestone Oct 8, 2026
@asgeija asgeija requested a review from a team as a code owner October 8, 2026 11:26
@asgeija asgeija linked an issue Oct 8, 2026 that may be closed by this pull request
3 tasks
Copy link
Member

@vitaliyb vitaliyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, now we can connect to the BackEnd.

@vitaliyb vitaliyb merged commit b26b7e8 into main Oct 8, 2026
1 check passed
@asgeija asgeija deleted the 28-build-the-graphql-backend branch October 12, 2026 10:55
Sign in to join this conversation on GitHub.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build the GraphQL backend
2 participants