Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2010-2017 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
47 changes: 13 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,13 @@
# A tarefa
Sua tarefa consiste em desenvolver uma API RESTful para manipular um determinado recurso. Deverá ser utilizado o framework Silex.

# Requisitos
A escolha do recurso deverá ser feita pelo desenvolvedor, atendendo apenas os requisitos mínimos abaixo:

* Deverá conter um ID
* Deverá conter pelo menos quatro propriedades (exemplos: nome, email, etc.)
* Deverá conter campos que armazenem as datas de criação e alteração do recurso

A API deverá atender às seguintes exigências:

* Listagem de todos os recursos
* Busca de um recurso pelo ID
* Criação de um novo recurso
* Alteração de um recurso existente
* Exclusão de um recurso
* Aceitar e retornar apenas JSON
* Deverá possuir algum método de autenticação para utilização de seus endpoints

# Ferramentas
* PHP
* Banco de dados MySQL
* Framework Silex

# Fluxo de desenvolvimento
1. Faça um fork deste repositório
2. Crie uma nova branch e nomeie-a com seu usuário do Github
3. Quando o desenvolvimento estiver concluído, faça um pull request

# Padrões de nomenclatura
1. Código fonte, nome do banco de dados, tabelas e campos devem estar em inglês

**Inclua no seu commit todos os arquivos necessários para que possamos testar o código.**
# Sobre o projeto
Eu escolhi algumas publicações do site da GFT Brasil como o recurso da minha API. De acordo com os requisitos, é possível inserir/alterar/remover as publicações.

# Deploy
* Configurar as credenciais do banco de dados em src/app.php
* Importar o arquivo database.sql que está na raíz

# Instruções de uso
* Nome do recurso com as publicações: releases
* Obter token com PUT /tokens e JSON body {"username": "gft", "password": "1234"}
* Repassar o token em todos os endpoints como parâmetro GET _token. Exemplo: /releases?_token=e3b50681ffdf0fbe7dfb25acbb809ed0 (o token não possui expiração)
* Os usuários podem ser incluídos somente diretamente no banco de dados
* No endpoint GET /releases, é possível enviar um parâmetro "query" para efetuar uma busca fulltext
16 changes: 16 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env php
<?php

require_once __DIR__.'/../vendor/autoload.php';

set_time_limit(0);

use Symfony\Component\Console\Input\ArgvInput;

$input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');

$app = require __DIR__.'/../src/app.php';
require __DIR__.'/../config/'.$env.'.php';
$console = require __DIR__.'/../src/console.php';
$console->run();
41 changes: 41 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "fabpot/silex-skeleton",
"description": "A pre-configured skeleton for the Silex microframework",
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"silex/silex": "~2.0",
"silex/web-profiler": "~2.0",
"symfony/asset": "~2.8|^3.0",
"symfony/browser-kit": "~2.8|^3.0",
"symfony/class-loader": "~2.8|^3.0",
"symfony/config": "~2.8|^3.0",
"symfony/console": "~2.8|^3.0",
"symfony/css-selector": "~2.8|^3.0",
"symfony/debug": "~2.8|^3.0",
"symfony/finder": "~2.8|^3.0",
"symfony/form": "~2.8|^3.0",
"symfony/monolog-bridge": "~2.8|^3.0",
"symfony/process": "~2.8|^3.0",
"symfony/security": "~2.8|^3.0",
"symfony/translation": "~2.8|^3.0",
"symfony/twig-bridge": "~2.8|^3.0",
"symfony/validator": "~2.8|^3.0",
"doctrine/dbal": "~2.2"
},
"autoload": {
"psr-0": { "": "src/" }
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"scripts": {
"run": [
"echo 'Started web server on http://localhost:8888'",
"php -S localhost:8888 -t web"
]
}
}
Loading