Skip to content

Repository files navigation

Scouter-DataGateway

Scouter-DataGateway

Internal scouting API for FRC Team 7563 — Megazord





Overview · Features · Getting Started · API Reference · Authentication · Tech Stack · Contributing


📡 Overview

Scouter-DataGateway is the REST API powering Team 7563's internal scouting platform. Built with Spring Boot 4, it handles user authentication, scout data persistence (auto, teleop, pit), and exposes a fully documented OpenAPI interface for the frontend and field tools to consume.


✨ Features

🔐

Authentication
Credential-based auth via X-Credentials header — BCrypt password hashing, role-based access (SCOUT / ADMIN)

👥

User Management
Full CRUD for users, preferences, and favorite events/teams — admin-gated actions

📋

Scout Modules
Separate endpoints for auto, teleop and pit scouting — queryable by match, team, event or user

📸

Pit Photos
Photo attachment support for pit scout entries

❤️

Health Check
Real DB health check at /health with build info, Java and Spring Boot version

📄

API Docs
Interactive Swagger UI at /docs — full OpenAPI 3.0 spec included

🚀 Getting Started

Pré-requisitos: Java 17+, Gradle, banco PostgreSQL (Supabase ou local)

1
git clone https://github.com/Kaique-Sique/Scouter-DataGateway.git
cd Scouter-DataGateway
2
cp .env.exemple .env
3

Edite o .env com suas credenciais:

DB_HOST=localhost
DB_PORT=5432
DB_NAME=scouter
DB_USER=postgres
DB_PASSWORD=sua_senha
4
./gradlew bootRun
→ API rodando em localhost:8080 · Swagger em localhost:8080/docs

🔐 Authentication

Todas as rotas protegidas exigem o header X-Credentials com o formato:

X-Credentials: email@exemplo.com/suasenha

Rotas públicas (sem autenticação):

Método Rota Descrição
POST /auth/register Criar conta
POST /auth/login Validar credenciais
GET /health Status da API e do banco
GET /docs Swagger UI

📚 API Reference

Auth

Método Rota Auth Descrição
POST /auth/register ❌ Registrar novo usuário
POST /auth/login ❌ Login

Users

Método Rota Auth Descrição
GET /users/me ✅ Dados do usuário autenticado
PATCH /users/me/username ✅ Atualizar username
PATCH /users/me/email ✅ Atualizar email
GET /users 🔒 Admin Listar todos os usuários
GET /users/{id} 🔒 Admin Buscar usuário por ID
DELETE /users/{id} 🔒 Admin Desativar usuário

Scout — Auto

Método Rota Auth Descrição
POST /scout/auto ✅ Criar entrada de auto
GET /scout/auto/{matchTeamId} ✅ Buscar por ID
GET /scout/auto/user/{userId} ✅ Buscar por usuário
GET /scout/auto/team/{teamKey} ✅ Buscar por time
GET /scout/auto/event/{eventKey} ✅ Buscar por evento
GET /scout/auto/match/{matchKey} ✅ Buscar por partida
GET /scout/auto/team/{teamKey}/match/{matchKey} ✅ Buscar por time + partida
DELETE /scout/auto/{matchTeamId} ✅ Deletar entrada

Scout — Teleop

Método Rota Auth Descrição
POST /scout/teleop ✅ Criar entrada de teleop
GET /scout/teleop/{matchTeamId} ✅ Buscar por ID
GET /scout/teleop/user/{userId} ✅ Buscar por usuário
GET /scout/teleop/team/{teamKey} ✅ Buscar por time
GET /scout/teleop/event/{eventKey} ✅ Buscar por evento
GET /scout/teleop/match/{matchKey} ✅ Buscar por partida
GET /scout/teleop/team/{teamKey}/match/{matchKey} ✅ Buscar por time + partida
DELETE /scout/teleop/{matchTeamId} ✅ Deletar entrada

Scout — Pit

Método Rota Auth Descrição
POST /scout/pit ✅ Criar entrada de pit
GET /scout/pit/user/{userId} ✅ Buscar por usuário
GET /scout/pit/team/{teamKey} ✅ Buscar por time
GET /scout/pit/event/{eventKey} ✅ Buscar por evento
GET /scout/pit/team/{teamKey}/event/{eventKey} ✅ Buscar por time + evento
DELETE /scout/pit/team/{teamKey}/event/{eventKey} ✅ Deletar entrada
POST /scout/pit/{pitScoutId}/photos ✅ Adicionar fotos
GET /scout/pit/{pitScoutId}/photos ✅ Listar fotos
DELETE /scout/pit/{pitScoutId}/photos ✅ Remover fotos

System

Método Rota Auth Descrição
GET /health ❌ Status da API + banco + build info

🛠 Tech Stack

Camada Tecnologia
Runtime Java 17
Framework Spring Boot 4.1
Banco de dados PostgreSQL via Supabase
ORM Spring Data JPA / Hibernate
Segurança Spring Security Crypto (BCrypt)
Docs SpringDoc OpenAPI 3 / Swagger UI
Build Gradle
CI GitHub Actions

🏗 Estrutura do Projeto

src/main/java/com/scouter/gateway/
├── auth/           # Login, registro e autenticação por X-Credentials
├── user/           # Entidade User, CRUD e favoritos
│   ├── favorites/
│   │   ├── events/
│   │   └── teams/
│   └── preferences/
├── scout/          # Módulos de scouting
│   ├── auto/
│   ├── teleop/
│   └── pit_scout/
│       └── pit_scout_photos/
├── health/         # Health check endpoint
└── build/          # Build info via git.properties

Built by Team 7563 — Megazord · Jundiaí, SP

About

API for Internal scouting platform from FRC Team 7563 - Megazord7563

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages