docs: adiciona README com instrucoes de instalacao e uso da api

This commit is contained in:
2026-05-03 23:07:13 -05:00
parent 652f33ec8a
commit 393811aadb

116
README.md
View File

@@ -1,58 +1,100 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p> # 🎮 Gameverse - Wishlist Service
<p align="center"> Este é o microsserviço responsável pelo gerenciamento de Favoritos e Listas de Desejos (Wishlist) dos usuários no ecossistema Gameverse. Desenvolvido com **Laravel 11**, operando em um ambiente isolado via **Docker** e protegido por autenticação **JWT (RS256)**.
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel ---
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: ## 🛠️ Tecnologias Utilizadas
- [Simple, fast routing engine](https://laravel.com/docs/routing). * **Framework:** Laravel 11 (PHP 8.3)
- [Powerful dependency injection container](https://laravel.com/docs/container). * **Banco de Dados:** MySQL 8.2
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. * **Infraestrutura:** Docker & Docker Compose (Ambiente customizado, sem dependência do Laravel Sail)
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). * **Segurança:** Autenticação via Token JWT (`firebase/php-jwt`)
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications. ---
## Learning Laravel ## ⚙️ Pré-requisitos
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. Para rodar este microsserviço localmente, você precisará ter instalado em sua máquina:
* [Docker Desktop](https://www.docker.com/products/docker-desktop/) ou Docker Engine.
* [Git](https://git-scm.com/)
In addition, [Laracasts](https://laracasts.com) contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. ---
You can also watch bite-sized lessons with real-world projects on [Laravel Learn](https://laravel.com/learn), where you will be guided through building a Laravel application from scratch while learning PHP fundamentals. ## 🚀 Passo a Passo de Instalação
## Agentic Development
Laravel's predictable structure and conventions make it ideal for AI coding agents like Claude Code, Cursor, and GitHub Copilot. Install [Laravel Boost](https://laravel.com/docs/ai) to supercharge your AI workflow:
**1. Clone o repositório do Gitea:**
```bash ```bash
composer require laravel/boost --dev git clone <URL_DO_SEU_REPOSITORIO_NO_GITEA>
cd wishlist-service
php artisan boost:install
``` ```
Boost provides your agent 15+ tools and skills that help agents build Laravel applications while following best practices. **2. Configure o ambiente:**
Crie uma cópia do arquivo de configuração base.
```bash
cp .env.example .env
```
Abra o arquivo `.env` gerado e certifique-se de configurar a conexão com o banco de dados e as chaves públicas do JWT conforme fornecido pela equipe de Autenticação:
```env
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=gameverse_wishlist
DB_USERNAME=root
DB_PASSWORD=root
## Contributing JWT_ISSUER="https://sistema-distribuido-trabalho-faculd.vercel.app"
JWT_AUDIENCE="internal-apis"
JWT_PUBLIC_KEY_PEM="-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"
```
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). **3. Suba os containers do Docker:**
Este comando fará o build da imagem do PHP 8.3 com os drivers necessários e iniciará o MySQL.
```bash
docker compose up -d --build
```
## Code of Conduct **4. Instale as dependências do PHP:**
```bash
docker compose exec app composer install
```
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). **5. Crie as tabelas no Banco de Dados:**
```bash
docker compose exec app php artisan migrate
```
## Security Vulnerabilities O servidor estará rodando e disponível em: `http://localhost:8000`
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. ---
## License ## 🔒 Autenticação e Rotas (API)
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). Todas as rotas da Wishlist são protegidas pelo middleware customizado `JwtAuthMiddleware`. O cliente deve enviar o Token JWT no cabeçalho da requisição:
`Authorization: Bearer <SEU_TOKEN_AQUI>`
### Endpoints Disponíveis:
#### 1. Salvar ou Atualizar Jogo na Lista
* **Rota:** `POST /api/wishlist`
* **Body (JSON):**
```json
{
"game_id": "string (Obrigatório)",
"is_wishlist": "boolean (Opcional, default false)",
"is_favorite": "boolean (Opcional, default false)",
"saved_for_later": "boolean (Opcional, default false)",
"price_alert": "boolean (Opcional, default false)"
}
```
#### 2. Listar Jogos do Usuário
* **Rota:** `GET /api/wishlist`
* **Retorno:** Lista de objetos contendo os IDs dos jogos e suas respectivas flags (favorito, alerta de preço, etc) atrelados ao `auth_id` extraído do Token.
#### 3. Remover Jogo da Lista
* **Rota:** `DELETE /api/wishlist/{game_id}`
* **Retorno:** Mensagem de sucesso confirmando a remoção do jogo da base de dados.
---
*Centro Educacional UniNorte - Projeto Gameverse*