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

Envio v1 Desafio #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM php:8.0-apache
RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN apt-get update \
&& apt-get install -y libzip-dev \
&& apt-get install -y zlib1g-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install zip
53 changes: 53 additions & 0 deletions bruno.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Requisitos
Instalar docker-compose
Instalar Angular

Entrar no diretório pricipal do procedo e executar:

```
sudo chown $USER /var/run/docker.sock
```

Em seguida, executar:

```
docker-compose up -d
```
Acessar a pasta do frontend

```
cd front
```

instalar as depencências com o comando:
```
npm install
```
Logo após, iniciar o servidor:
```
ng serve
```


# Docker
Foram configurados 3 dockers que vão executar:

```
Apache, MySql 8.0, PhpMyAdmin and Php
```

Para abror o phpmyadmin utilize a URL [http://localhost:8000](http://localhost:8000)
Para abrir o servidor web com o backend, executar(segundo URIs configuradas) [http://localhost:8001](http://localhost:8001)

Caso querira entrar no mysql via linha de comando, executar:


- `docker-compose exec db mysql -u root -p`



URL do FrontEnd
http://localhost:4200/

Exemplo da api backend
http://localhost:8001/api/aluno/read.php
13 changes: 13 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "brunoarruda/tecnofit",
"description": "Projeto Tecnofit",
"authors": [
{
"name": "Bruno Arruda",
"email": "[email protected]"
}
],
"require": {
"components/angular.js": "^1.3"
}
}
327 changes: 327 additions & 0 deletions composer.lock

Large diffs are not rendered by default.

Empty file added conf/.gitkeep
Empty file.
43 changes: 43 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: "3.1"
services:
www:
build: .
ports:
- 8001:80
environment:
- APACHE_HTTP_PORT_NUMBER=8001
volumes:
- ./www:/var/www/html/
- ./vhosts/:/etc/apache2/sites-available/
links:
- db
networks:
- default
db:
image: mysql:8.0
ports:
- "3306:3306"
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_DATABASE: tecnofit
MYSQL_USER: user
MYSQL_PASSWORD: test
MYSQL_ROOT_PASSWORD: test
volumes:
- ./dump:/docker-entrypoint-initdb.d
- ./conf:/etc/mysql/conf.d
- persistent:/var/lib/mysql
networks:
- default
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- db:db
ports:
- 8000:80
environment:
MYSQL_USER: user
MYSQL_PASSWORD: test
MYSQL_ROOT_PASSWORD: test
volumes:
persistent:
73 changes: 73 additions & 0 deletions dump/tecnofit.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
ALTER DATABASE `tecnofit` CHARSET = utf8 COLLATE = utf8_unicode_ci;

CREATE TABLE `alunos` (
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`nome` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB CHARACTER SET=utf8 COLLATE utf8_unicode_ci;;

INSERT INTO `alunos` (`id`, `nome`, `email`) VALUES
(1, 'Bruno','[email protected]'),
(2, 'Ronaldo','[email protected]'),
(3, 'Cristiano','[email protected]');


CREATE TABLE `exercicios` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(255) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARACTER SET=utf8 COLLATE utf8_unicode_ci;;

INSERT INTO `exercicios` (`id`, `nome`) VALUES
(1, 'Supino declinado com Halteres'),
(2, 'Apoio no solo'),
(3, 'One Arm Row com Halteres'),
(4, 'Agachamentos com Barra'),
(5, 'Agachamentos Livre');


CREATE TABLE `treinos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`aluno_id` int (11) NOT NULL,
`descricao` varchar(255) NOT NULL,
`ativo` TINYINT (1) NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARACTER SET=utf8 COLLATE utf8_unicode_ci;

alter table treinos add foreign key(aluno_id) references alunos(id) ON DELETE CASCADE ON UPDATE CASCADE;


INSERT INTO `treinos` (`id`, `aluno_id`,`descricao`, `ativo`) VALUES
(1, 1, 'Treino Superior 1', 1),
(2, 2, 'Treino Superior 2', 1),
(3, 1, 'Treino Inferior 1', 0),
(4, 3, 'Treino Completo 1 Dia',1);


CREATE TABLE `treino_detalhes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`treino_id` int(11) NOT NULL,
`exercicio_id` int(11) NOT NULL,
`series` int(2) NOT NULL,
`repeticoes` int(4) NOT NULL,
`status` int(1) DEFAULT 0,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)

) ENGINE=InnoDB CHARACTER SET=utf8 COLLATE utf8_unicode_ci;;

alter table treino_detalhes add foreign key(treino_id) references treinos(id) ON DELETE CASCADE ON UPDATE CASCADE;
alter table treino_detalhes add foreign key(exercicio_id) references exercicios(id) ON DELETE CASCADE ON UPDATE CASCADE;

INSERT INTO `treino_detalhes` (`id`, `treino_id`, `exercicio_id`, `series`, `repeticoes`) VALUES
(1, 1, 1, 3, 10),
(2, 1, 2, 3, 10),
(3, 1, 3, 3, 10),
(4, 2, 1, 4, 10),
(5, 2, 2, 4, 10),
(6, 2, 3, 4, 15),
(7, 3, 5, 4, 15);

12 changes: 12 additions & 0 deletions front/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
# npx browserslist

> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
13 changes: 13 additions & 0 deletions front/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
46 changes: 46 additions & 0 deletions front/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
/node_modules

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db
5 changes: 5 additions & 0 deletions front/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# AngularRoutingTutorial
In this Angular 9 router tutorial, we will learn how to enable routing & navigation service in an Angular app. Routing allows users to navigate between one component to another component based on action taken by the user.

## Written Tutorial
[Angular 9 Router Tutorial – Configure Routing & Navigation](https://www.positronx.io/angular-router-tutorial/)
Loading