{"id":18775781,"url":"https://github.com/sostheblack/bildvitta","last_synced_at":"2025-08-28T19:13:12.755Z","repository":{"id":86506597,"uuid":"329479819","full_name":"SOSTheBlack/bildvitta","owner":"SOSTheBlack","description":"Backend Challenge A NAVE bild vitta","archived":false,"fork":false,"pushed_at":"2021-01-20T20:40:12.000Z","size":550,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-24T18:15:54.624Z","etag":null,"topics":["backend","backend-challenge","bild","bildvitta","test","teste","vitta"],"latest_commit_sha":null,"homepage":"https://github.com/bildvitta/challenges/tree/master/backend","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SOSTheBlack.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-14T01:54:05.000Z","updated_at":"2021-02-02T13:36:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"cd1bffbe-5090-4bba-b291-f5d06baf6bd5","html_url":"https://github.com/SOSTheBlack/bildvitta","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/SOSTheBlack/bildvitta","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOSTheBlack%2Fbildvitta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOSTheBlack%2Fbildvitta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOSTheBlack%2Fbildvitta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOSTheBlack%2Fbildvitta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SOSTheBlack","download_url":"https://codeload.github.com/SOSTheBlack/bildvitta/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SOSTheBlack%2Fbildvitta/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272541898,"owners_count":24952468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","backend-challenge","bild","bildvitta","test","teste","vitta"],"created_at":"2024-11-07T19:43:55.684Z","updated_at":"2025-08-28T19:13:12.710Z","avatar_url":"https://github.com/SOSTheBlack.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coin Conversion\n\n![Currency](public/assests/currency-converter.png)![Tests](public/assests/bild_vitta.png)\n\n## **Requerimentos**\n\n- PHP v8.\n- GIT v2\n- Composer v2.\n- Banco de dados: MySql, SQLite, PostgreSQL, SQLServer.\n\n## Descrição\nEsse ‘software’ tem o intuito de fazer a conversão de moedas pré-cadastradas, é possível informar a quantidade também.\n\nPara instalar e testar o projeto siga os passos a seguir:\n\n### Moedas disponíveis para conversão\n\n| Moeda | Código |\n|--------|--------|\n| BRL | Real Brasileiro |\n| USD | Dólar Americano |\n| ARS | Peso Argentino |\n| EUR | Euro |\n| GBP | Libra |\n| BTC | Bitcoin |\n\n## Instalação\n\n#### Clonando o projeto.\n```shell\ngit clone git@github.com:SOSTheBlack/bildvitta.git\n```\n\n#### Acesse a pasta do projeto.\n```shell\ncd bildvitta\n```\n\n#### Instale as dependências.\n```shell\ncomposer install\n```\n\n#### Criar arquivo de configuração.\nExecute o comando abaixo para criar o seu arquivo `.env`.\n```shell\ncp .env.example .env\n```\nApós a criação do seu `.env` edite as suas configurações de banco de dados para prosseguirmos ao próximo passo.\n\n\n#### Gere a chave de segurança do ‘software’.\n```shell\nphp artisan key:generate\n```\n\n#### Criando as tabelas no banco de dados.\n```shell\nphp artisan migrate\n```\nNesse momento está sendo criado a tabela que irá conter as moedas disponíveis para conversão.\n\n#### Cadastrando as moedas que estarão disponíveis para conversão.\n```shell\nphp artisan db:seed\n```\nAs moedas para conversão estão na tabela `coin_conversions`.\n\n#### Inicializando o software.\n```shell\nphp artisan serve\n```\n\n## Utilização\n\nPara utilizar a API, segue esse cURL de exemplo.\nAtenção a porta que está sendo rodado o ‘software’ no seu sistema.\n\n```\ncurl -L -X GET \"http://127.0.0.1:8000/api/coins/conversions?coin_from=USD\u0026coin_to=GBP\u0026quantity=10\" \\\n-H 'Content-Type: application/json' \\\n-H 'Accept: application/json' \\\n-H 'Token: d812b49499b6b3e6b24a70cece02f2f7'\n```\n\nO endpoint da API é um *GET* e os paramatros deve ser enviado por *query string*.\n\n### Parâmetros da API\n\nSegue os parâmetros da nossa API.\n\n#### Query String\n\n\n| Key | Obrigatório | Descrição |\n|-----|-------------|-----------|\n| coin_from | SIM | Moeda de origen(De) |\n| coin_to | SIM | Modera de destino(Para) |\n| quantity | SIM | Quantidade de moedas a serem convertidas |\n\n#### Headers\n| Key | Value | Obrigatório | Descrição |\n|-----|-------|------|-----------|\n| Token | config('services.api.token') | SIM | Quantidade de moedas a serem convertidas |\n| Accept | application/json | NÃO | Tipo de conteúdo enviado a API |\n| Content-Type | application/json | NÃO | Tipo de conteúdo retornado da API |\n\n### Resposta da API\n\n#### 200 - Sucesso\nExemplo de response segundo o cURL anexado acima.\n\n```json\n{\n    \"data\": {\n        \"coin_from\": \"USD\",\n        \"coin_to\": \"GBP\",\n        \"quantity\": 10,\n        \"price\": 7.8\n    }\n}\n```\n\n#### 422 - Unprocessable Entity\n```json\n{\n    \"message\": \"The given data was invalid.\",\n    \"errors\": {\n        \"quantity\": [\n            \"The quantity field is required.\"\n        ],\n        \"coin_from\": [\n            \"The coin from field is required.\"\n        ],\n        \"coin_to\": [\n            \"The coin to field is required.\"\n        ]\n    }\n}\n```\n\n#### 401 - Unauthorized\n\nAusência do header `Token`.\n```json\n{\n    \"message\": \"missing token, is has required\"\n}\n```\n\nToken inválido\n```json\n{\n    \"message\": \"invalid token\"\n}\n```\n\n## Erros do Software\n\n#### \\App\\Exceptions\\Api\\TokenException\n| Código | Mensagem |\n|----|----|\n| 1001 | missing token, is has required. |\n| 1002 | invalid token. |\n\n#### \\App\\Exceptions\\Repositories\\ModelNotFoundException\n| Código | Mensagem |\n|----|----|\n| 1001 | no results for model. |\n\n#### \\App\\Exceptions\\Repositories\\QueryException\n| Código | Mensagem |\n|----|----|\n| 1001 | error when inserting database. |\n\n## Rodando testes\n\nExecute o comando abaixo:\n\n```shell\nphp artisan test\n```\n\nVocê deve visualizar algo semelhante a isso:\n\n```shell\n   PASS  Tests\\Feature\\Api\\Coins\\ConversionTest\n  ✓ coin conversion with success\n  ✓ coin conversion with success with data set #1\n  ✓ coin conversion with success with data set #2\n  ✓ coin conversion with success with data set #3\n  ✓ coin conversion with success with data set #4\n  ✓ coin conversion with success with data set #5\n  ✓ coin conversion with success with data set #6\n  ✓ coin conversion with success with data set #7\n  ✓ coin conversion with success with data set #8\n  ✓ coin conversion with success with data set #9\n  ✓ coin conversion with success with data set #10\n  ✓ has validation inputs\n  ✓ has validation inputs with data set #1\n  ✓ has validation inputs with data set #2\n  ✓ has validation inputs with data set #3\n  ✓ has validation inputs with data set #4\n  ✓ has validation inputs with data set #5\n  ✓ has validation inputs with data set #6\n  ✓ if coin exists in database\n  ✓ if coin exists in database with data set #1\n  ✓ if coin exists in database with data set #2\n  ✓ if coin exists in database with data set #3\n  ✓ if coin exists in database with data set #4\n  ✓ if coin exists in database with data set #5\n  ✓ if coin exists in database with data set #6\n  ✓ if coin exists in database with data set #7\n  ✓ if coin exists in database with data set #8\n  ✓ if coin exists in database with data set #9\n  ✓ if coin exists in database with data set #10\n  ✓ if coin exists in database with data set #11\n  ✓ if coin exists in database with data set #12\n  ✓ if coin exists in database with data set #13\n  ✓ if coin exists in database with data set #14\n  ✓ if coin exists in database with data set #15\n  ✓ if coin exists in database with data set #16\n  ✓ if coin exists in database with data set #17\n  ✓ if coin exists in database with data set #18\n  ✓ if coin exists in database with data set #19\n  ✓ if coin exists in database with data set #20\n  ✓ if coin exists in database with data set #21\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsostheblack%2Fbildvitta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsostheblack%2Fbildvitta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsostheblack%2Fbildvitta/lists"}