From 393811aadbf9ea3fafed050ddda0fac62e159492 Mon Sep 17 00:00:00 2001 From: Edson Salvatore Date: Sun, 3 May 2026 23:07:13 -0500 Subject: [PATCH] docs: adiciona README com instrucoes de instalacao e uso da api --- README.md | 116 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 79 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 5ad1377..c2816cd 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,100 @@ -

Laravel Logo

+# 🎮 Gameverse - Wishlist Service -

-Build Status -Total Downloads -Latest Stable Version -License -

+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)**. -## 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). -- [Powerful dependency injection container](https://laravel.com/docs/container). -- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. -- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). -- 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). +* **Framework:** Laravel 11 (PHP 8.3) +* **Banco de Dados:** MySQL 8.2 +* **Infraestrutura:** Docker & Docker Compose (Ambiente customizado, sem dependência do Laravel Sail) +* **Segurança:** Autenticação via Token JWT (`firebase/php-jwt`) -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. - -## 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: +## 🚀 Passo a Passo de Instalação +**1. Clone o repositório do Gitea:** ```bash -composer require laravel/boost --dev - -php artisan boost:install +git clone +cd wishlist-service ``` -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 ` + +### 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* \ No newline at end of file