Nik Afiq 88f4ee3d4a Add Danime episode metadata fetching and related API endpoint
- Implemented FetchEpisode function to retrieve episode metadata from dアニメストア.
- Added /api/v1/danime GET endpoint to fetch episode details by partId.
- Updated Swagger documentation for the new endpoint and response structure.
- Created DanimeEpisodeResponse type for API responses.
- Added tests for the new functionality and handlers.
2025-12-06 19:26:45 +09:00
..
2025-11-04 21:22:13 +09:00
2025-11-04 21:22:13 +09:00

Backend (Go + Gin)

REST API that serves the schedule/time endpoints and current episode control. Built in Go, containerized with a multi-stage Dockerfile.

Prerequisites

  • Go 1.22+
  • PostgreSQL reachable (uses env-driven DSN pieces)
  • golang-migrate not required locally (migrations shipped in repo)

Env

The server builds its DSN from:

  • PGHOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB, PGSSLMODE
  • ADDR (listen address, default :8082)
  • GIN_MODE (e.g., release)

Commands

# Run locally (expects Postgres per env)
go run ./cmd/server

# Run migrations
go run ./cmd/migrate

# Tests
go test ./...

# Swagger create docs
swag init -g cmd/server/main.go -o ./docs

Docker build (used by compose)

docker build -t watchparty-backend .

Compose uses the same image for api and the one-off migrate job.

Endpoints (key)

  • GET /api/v1/time — server time for client clock sync
  • GET /api/v1/current — current schedule item
  • POST /api/v1/current — set current episode (expects { id, start_time? })
  • GET /api/v1/shows — list of episodes
  • POST /api/v1/shows — create a new episode (expects { ep_num, ep_title, season_name, start_time, playback_length })
  • GET /healthz — health check