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

development #30

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7e001b0
configuração da framework e dependências
diones-souza Jun 1, 2022
878ca72
Update README.md
diones-souza Jun 1, 2022
60ae29c
Update README.md
diones-souza Jun 1, 2022
7afdff5
Update LogController.php
diones-souza Jun 2, 2022
6c6eecd
criar conta automatico
diones-souza Jun 2, 2022
56f2356
estrutura para movimentações dos investimentos
diones-souza Jun 2, 2022
da4e7ba
Update supervisord.conf
diones-souza Jun 2, 2022
5069843
Update Dockerfile
diones-souza Jun 2, 2022
149065f
Update docker-compose.yml
diones-souza Jun 2, 2022
40abb6f
remover arquivos lixos
diones-souza Jun 2, 2022
99c5575
Update .env.example
diones-souza Jun 2, 2022
afa28d8
gravar deposito e adicionar ganhos
diones-souza Jun 2, 2022
9df26e9
Update Routes.php
diones-souza Jun 2, 2022
552ec29
calcular taxas dos impostos
diones-souza Jun 3, 2022
b9d0b90
Create SendEmail.php
diones-souza Jun 3, 2022
03ee8af
Update phpunit.xml
diones-souza Jun 3, 2022
12b89ac
ajustes acesso
diones-souza Jun 3, 2022
291f34c
Update README.md
diones-souza Jun 3, 2022
e64b795
Update .gitignore
diones-souza Jun 3, 2022
4a7b65f
estrutura base front
diones-souza Jun 3, 2022
51a0404
remove lixos
diones-souza Jun 3, 2022
0cc95b6
Update jwt.php
diones-souza Jun 3, 2022
092d4c7
Delete README.md
diones-souza Jun 3, 2022
90d41bb
listar investimentos
diones-souza Jun 3, 2022
9f1e415
Update all-components.js
diones-souza Jun 3, 2022
262e636
Update router.js
diones-souza Jun 3, 2022
28e8adb
saque e deposito
diones-souza Jun 3, 2022
8c8faf5
Update DropSchema.php
diones-souza Jun 3, 2022
6fd25cc
Update MoveService.php
diones-souza Jun 3, 2022
119a768
Update README.md
diones-souza Jun 3, 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
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
storage/
48 changes: 48 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
APP_NAME="Api de investimentos"
APP_ENV=dev
APP_KEY=
APP_DEBUG=true
API_IP=localhost
API_HOST=http://${API_IP}:8000
APP_HOST=http://${API_IP}:8080

DB_CONNECTION=pgsql
DB_HOST=db
DB_PORT=5432
DB_DATABASE=postgres
DB_USERNAME=postgres
DB_PASSWORD=root

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=database
SESSION_DRIVER=cookie
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

L5_SWAGGER_GENERATE_ALWAYS=true

JWT_SECRET=
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
35 changes: 35 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy master

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
laravel:

runs-on: ubuntu-latest

steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '7.4'
- uses: actions/checkout@v2
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate &&
php artisan jwt:secret
- name: Directory Permissions
run: chmod -R storage bootstrap/cache
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker-compose build
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/node_modules
/storage/*.key
/storage/api-docs
/vendor
/logs
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
*.log
supervisord.pid
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 13 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
php:
preset: laravel
disabled:
- no_unused_imports
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM php:7.4-fpm

# Arguments defined in docker-compose.yml
ARG user
ARG uid

# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
libpq-dev \
libzip-dev \
zip \
unzip \
sed \
supervisor && \
docker-php-ext-install zip

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install pdo pdo_pgsql mbstring exif pcntl bcmath gd

# Update Php Settings
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
&& sed -E -i -e 's/max_execution_time = 30/max_execution_time = 4800/' $PHP_INI_DIR/php.ini \
&& sed -E -i -e 's/max_input_time = 60/max_input_time = 2400/' $PHP_INI_DIR/php.ini \
&& sed -E -i -e 's/memory_limit = 128M/memory_limit = 5120M/' $PHP_INI_DIR/php.ini \
&& sed -E -i -e 's/post_max_size = 8M/post_max_size = 300M/' $PHP_INI_DIR/php.ini \
&& sed -E -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 300M/' $PHP_INI_DIR/php.ini \
&& sed -E -i -e 's/output_buffering = 4096/output_buffering = 3e+8/' $PHP_INI_DIR/php.ini \
&& sed -E -i -e 's/odbc.defaultlrl = 4096/odbc.defaultlrl = 3e+8/' $PHP_INI_DIR/php.ini

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user

COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Set working directory
WORKDIR /var/www

USER $user

CMD /usr/bin/supervisord; php-fpm;
131 changes: 65 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,87 @@
# Back End Test Project <img src="https://coderockr.com/assets/images/coderockr.svg" align="right" height="50px" />
## Install

You should see this challenge as an opportunity to create an application following modern development best practices (given the stack of your choice), but also feel free to use your own architecture preferences (coding standards, code organization, third-party libraries, etc). It’s perfectly fine to use vanilla code or any framework or libraries.
- [Docker Documentation](https://docs.docker.com).
### Install BACKEND

## Scope
- docker-compose up -d --build
- docker-compose exec app cp .env.example .env
- docker-compose exec app composer install
- docker-compose exec app php artisan key:generate
- docker-compose exec app php artisan jwt:secret
- docker-compose exec app php artisan schema:create default
- docker-compose exec app php artisan migrator
### Optional
- docker-compose exec app php artisan db:seed

In this challenge you should build an API for an application that stores and manages investments, it should have the following features:
### Install FRONTEND

1. __Creation__ of an investment with an owner, a creation date and an amount.
1. The creation date of an investment can be today or a date in the past.
2. An investment should not be or become negative.
2. __View__ of an investment with its initial amount and expected balance.
1. Expected balance should be the sum of the invested amount and the [gains][].
3. __Withdrawal__ of a investment.
1. The withdraw will always be the sum of the initial amount and its gains,
partial withdrawn is not supported.
2. Withdrawals can happen in the past or today, but can't happen before the investment creation or the future.
3. [Taxes][taxes] need to be applied to the withdrawals before showing the
final value.
4. __List__ of a person's investments
1. This list should have pagination.
- cd client
- docker-compose up -d --build

__NOTE:__ the implementation of an interface will not be evaluated.
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>

### Gain Calculation
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>

The investment will pay 0.52% every month in the same day of the investment creation.
## About Laravel

Given that the gain is paid every month, it should be treated as [compound gain][], which means that every new period (month) the amount gained will become part of the investment balance for the next payment.
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:

### Taxation
- [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).

When money is withdrawn, tax is triggered. Taxes apply only to the profit/gain portion of the money withdrawn. For example, if the initial investment was 1000.00, the current balance is 1200.00, then the taxes will be applied to the 200.00.
Laravel is accessible, powerful, and provides tools required for large, robust applications.

The tax percentage changes according to the age of the investment:
* If it is less than one year old, the percentage will be 22.5% (tax = 45.00).
* If it is between one and two years old, the percentage will be 18.5% (tax = 37.00).
* If older than two years, the percentage will be 15% (tax = 30.00).
## Learning Laravel

## Requirements
1. Create project using any technology of your preference. It’s perfectly OK to use vanilla code or any framework or libraries;
2. Although you can use as many dependencies as you want, you should manage them wisely;
3. It is not necessary to send the notification emails, however, the code required for that would be welcome;
4. The API must be documented in some way.
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.

## Deliverables
The project source code and dependencies should be made available in GitHub. Here are the steps you should follow:
1. Fork this repository to your GitHub account (create an account if you don't have one, you will need it working with us).
2. Create a "development" branch and commit the code to it. Do not push the code to the main branch.
3. Include a README file that describes:
- Special build instructions, if any
- List of third-party libraries used and short description of why/how they were used
- A link to the API documentation.
4. Once the work is complete, create a pull request from "development" into "main" and send us the link.
5. Avoid using huge commits hiding your progress. Feel free to work on a branch and use `git rebase` to adjust your commits before submitting the final version.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 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.

## Coding Standards
When working on the project be as clean and consistent as possible.
## Laravel Sponsors

## Project Deadline
Ideally you'd finish the test project in 5 days. It shouldn't take you longer than a entire week.
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).

## Quality Assurance
Use the following checklist to ensure high quality of the project.
### Premium Partners

### General
- First of all, the application should run without errors.
- Are all requirements set above met?
- Is coding style consistent?
- The API is well documented?
- The API has unit tests?
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/)**
- **[OP.GG](https://op.gg)**

## Submission
1. A link to the Github repository.
2. Briefly describe how you decided on the tools that you used.
## Contributing

## Have Fun Coding 🤘
- This challenge description is intentionally vague in some aspects, but if you need assistance feel free to ask for help.
- If any of the seems out of your current level, you may skip it, but remember to tell us about it in the pull request.
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).

## Credits
## Code of Conduct

This coding challenge was inspired on [kinvoapp/kinvo-back-end-test](https://github.com/kinvoapp/kinvo-back-end-test/blob/2f17d713de739e309d17a1a74a82c3fd0e66d128/README.md)
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).

[gains]: #gain-calculation
[taxes]: #taxation
[interest]: #interest-calculation
[compound gain]: https://www.investopedia.com/terms/g/gain.asp
## Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.

## License

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

## libraries

- [artesaos/migrator Documentation](https://github.com/artesaos/migrator).
- [jwt-auth Documentation](https://jwt-auth.readthedocs.io/en/develop/laravel-installation).
Loading