Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weverton Matias #36

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4949fa5
Iniciando a estrutura do docker.
wevertonmatias Nov 6, 2022
72e4c5b
Adicionando o framework yii2.
wevertonmatias Nov 6, 2022
e08db42
Adicionando url amigavel.
wevertonmatias Nov 6, 2022
4a7947d
Ajustando variáveis do banco para trabalhar local.
wevertonmatias Nov 8, 2022
65b65a8
Migrate da tabela tipos de transações.
wevertonmatias Nov 8, 2022
9ae0d00
Adicionando a migration da tabela arquivos_cnab
wevertonmatias Nov 8, 2022
ebf832f
Ajusdando o build dos containers.
wevertonmatias Nov 8, 2022
4bc6d60
Adicionando o model para comunicação com a tabela arquivos_cnab.
wevertonmatias Nov 8, 2022
b34e351
Adicionando o model para comunicação com a tabela tipos_de_transacoes.
wevertonmatias Nov 8, 2022
58aa3a1
Adicionando toda a estrutura de CRUD do arquivo CNAB
wevertonmatias Nov 8, 2022
0a576dd
Adicionando página de envio do arquivo CNAB.
wevertonmatias Nov 8, 2022
021d61c
Resolvendo bug da url amigável.
wevertonmatias Nov 8, 2022
779cf63
Adicionando ao menu as opções para acesso das funcionalidades
wevertonmatias Nov 8, 2022
f7b6a2d
Ajustando tamanho ca coluna cartão.
wevertonmatias Nov 9, 2022
f9b6826
Criando a rotina para parsear o arquivo e salvar os registros
wevertonmatias Nov 9, 2022
213fe35
Adicionando o módulo api e ajustando regra de url amigável.
wevertonmatias Nov 9, 2022
38cdb73
Adicionando o readme com as informções básicas para rodar a aplicação.
wevertonmatias Nov 9, 2022
c48b9d1
Ajustando fluxo após enviar arquivo CNAB.
wevertonmatias Nov 9, 2022
88009f5
Adicionando a pasta vendor pois não consegui instalar o composer no c…
wevertonmatias Nov 21, 2022
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.
66 changes: 66 additions & 0 deletions Dockerfile-php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
FROM ubuntu:18.04

ARG DEBIAN_FRONTEND=noninteractive

# UPDATE PACKAGES
RUN apt-get update

# REMOVE LIBCURL
RUN apt remove -y \
libcurl4

# INSTALL SYSTEM UTILITIES
RUN apt-get install -y \
apt-utils \
libcurl4 \
curl \
git \
apt-transport-https \
software-properties-common \
g++ \
build-essential \
dialog

# INSTALL APACHE2
RUN apt-get install -y apache2
RUN a2enmod rewrite

# INSTALL locales
RUN apt-get install -qy language-pack-en-base \
&& locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8

# INSTALL PHP & LIBRARIES
RUN add-apt-repository -y ppa:ondrej/php
RUN apt-get update
RUN apt-get --no-install-recommends --no-install-suggests --yes install \
php-pear \
php7.4 \
php7.4-common \
php7.4-mbstring \
php7.4-dev \
php7.4-xml \
php7.4-cli \
php7.4-mbstring \
php7.4-curl \
php7.4-gd \
php7.4-imagick \
php7.4-xdebug \
php7.4-xml \
php7.4-zip \
php7.4-odbc \
php7.4-soap \
php7.4-curl \
php7.4-cgi \
libapache2-mod-php7.4 \
php7.4-mysql

# INSTALL EDITORS
RUN apt-get update && apt-get install nano vim -y

EXPOSE 80

WORKDIR /var/www/html/

CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
41 changes: 41 additions & 0 deletions README-DEV.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Instruções básicas

#Levantando o ambiente
OBS: É preciso ter instalado na máquina docker e docker-compose, caso o usuário não tenha permissão para acessar o docker sempre adicione o comando sudo antes. Certifique-se que as portas 80 e 3306 não estejam sendo usadas e liberadas .

1 - Acesse o terminal e navegue até a pasta raiz do projeto, desafio-dev.
2 - Rode o comando docker-compose up -d.
3 – Para garantir que aplicação tenha acesso aos arquivos rode o comando,
sudo chmod -R 777 www/ .
4 - Acesse o container do webserver para rodar as migrações de banco de dados.
4.1 - Rode o comando docker exec -it webserver /bin/bash.
4.2 - Rode o comando php yii migrate.
4.3 – Rode o comando exit.

#Para navegação via web
1 - Acesse o link http://localhost/web/index.php, link raiz da aplicação.
2 - No menu superior acesse o link Enviar arquivo cnab. Essa página é responsável pelo envio do arquivo e salvar os registros no banco.
3 - Para visualização dos registros cnab acesse o menu Registros CNAB no menu lateral. Esse crud foi realizado pelo build do próprio framework yii.

#Para consumo da API

1 - Acesse o link http://localhost/web/index.php/api, link raiz da api, módulo de api criando pelo build do framework yii onde segue o padrão rest.

OBS: Para trabalhar com json no header da requisição adicione o parâmetro
content-type application/json.

2 - Para interação com api.
2.1 – Listagem, usando o método GET acesse o link raiz.
2.2 – View, usando o método GET acesse http://localhost/web/index.php/api + id
2.3 – Delete, usando o método DELETE acesse http://localhost/web/index.php/api + id
2.4 – Update, usando o método PUT, acesse http://localhost/web/index.php/api + id.
2.4.1 – No corpo da requisição envio os campos e valores que serão alterados.
2.4.2 – Campos e tipos de dados para update.
tipo_transacao => inteiro tamanho 1, ID conforme readme.
data => string tamanho 8, yyyymmdd.
valor => string precisão de 2 casas, 125,50.
cpf => string tamanho 11.
cartao => string tamanho 12.
hora => string tamanho 6, hhmmss 145607.
dono_loja => string tamanho 14.
nome_loja => string tamanho 19.
37 changes: 37 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: "3"

services:
webserver:
container_name: webserver
build:
context: .
dockerfile: Dockerfile-php
volumes:
- "./www:/var/www/html"
- "/home:/home"
ports:
- 80:80
- 443:443
cap_add:
- NET_ADMIN

db:
image: mysql:8.0
container_name: db
cap_add:
- SYS_NICE
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: yii2basic
MYSQL_USER: teste
MYSQL_PASSWORD: 123456
MYSQL_ROOT_HOST: '%'
ports:
- '3306:3306'
volumes:
- db:/var/lib/mysql

volumes:
db:
driver: local
8 changes: 8 additions & 0 deletions uploads.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
file_uploads = On
memory_limit = 500M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 600
max_file_uploads = 50000
max_execution_time = 5000
max_input_time = 5000
3 changes: 3 additions & 0 deletions www/.bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory" : "vendor/bower-asset"
}
30 changes: 30 additions & 0 deletions www/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# phpstorm project files
.idea

# netbeans project files
nbproject

# zend studio for eclipse project files
.buildpath
.project
.settings

# windows thumbnail cache
Thumbs.db

# composer itself is not needed
composer.phar

# Mac DS_Store Files
.DS_Store

# phpunit itself is not needed
phpunit.phar
# local phpunit config
/phpunit.xml

tests/_output/*
tests/_support/_generated

#vagrant folder
/.vagrant
29 changes: 29 additions & 0 deletions www/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Yii Software LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Loading