Giter Site home page Giter Site logo

adrianomonteiroweb / mycash Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 169 KB

Repositório de estudos em uma aplicação de gestão de pagamentos e recebimentos. Para estudos com docker-compose, sequelize e typescript.

License: MIT License

Shell 2.62% JavaScript 18.28% TypeScript 77.83% Dockerfile 1.27%
docker-compose postgresql frisby integration-testing javascript orm sequelize typescript

mycash's Introduction

MyCash

TECHNOLOGIES

  • Dependency Manager

    • yarn
  • Server

    Dependencies:
    • @types/express;
    • express;
    • dotenv;
    • bcrypt;
    • joi;
    • http-status-codes;
    • pg;
    • sequelize;
    • sequelize-typescript;
    • uuid.
    DevDependencies:
    • @types/bcrypt;
    • @types/express;
    • @types/frisby;
    • @types/jest;,
    • frisby;
    • jest;
    • nodemon;
    • sequelize-cli;
    • shelljs;
    • ts-node;
    • typescript.

RUNNING THE APPLICATION

1 - Run the command "yarn install" to install the application's dependencies.

2 - To run the application, it is first necessary to inform the environment variables with the .env file. As in .env.example.

  • Example:
# NODE_ENV status
NODE_ENV=test

# docker compose config
CONTAINER_NAME=mycash_db
DOCKER_IMAGE=postgres

# volumes
DB_DATA=./postgres-data:/var/lib/postgresql/data
CREATE_TABLES=./sql/create_tables.sql:/docker-entrypoint-initdb.d/create_tables.sql
FILL_TABLES=./sql/fill_tables.sql:/docker-entrypoint-initdb.d/fill_tables.sql

# db config
DB_HOST=0.0.0.0
DB_PORT=5438
DB_USER=mycashuser
DB_PASS=mycashpass
DB_NAME=mycash_db
DB_DRIVER=postgres

# server
HOST=localhost
PORT=3333

# deploy
DEPLOY_URL=https://mycash.com.br

3 - Here are some commands used in this application:

  • Start the application in production.
yarn start
  • Start the application in development.
yarn dev
  • Test the application in development.
yarn test
  • Using sequelize-cli to manage the local database.

    • Create database;
    yarn db:create
    • Migrate tables;
    yarn db:migrate
    • Running all seeders;
    yarn db:seeders
    • Drop database;
    yarn db:drop

BUSINESS RULES

Users
  • Anyone should be able to use the application. To do so, simply register by entering your username and password;
  • It must be ensured that each username is unique and composed of at least 3 characters;
  • You must ensure that the password consists of at least 8 characters, a number and a capital letter. Remember that it must be hashed when stored in the database;
  • During the process of registering a new user, their respective account should be created automatically in the Accounts table with a balance of R$ 100.00. It is important to note that if a problem occurs and the user is not created, the Accounts table should not be affected;
  • Every user should be able to log into the application by informing username and password. If login is successful, a JWT token (with 24h validity) must be provided;
  • Every logged-in user (ie who presents a valid token) should be able to see their own current balance. User A cannot view user B's balance sheet, for example;
  • Every logged-in user (that is, who presents a valid token) must be able to perform a cash-out by informing the username of the user who will be cash-in), if he has enough balance for that. Pay attention to the fact that a user should not be able to make a transfer for himself.

mycash's People

Contributors

adrianomonteiroweb avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.