Skip to content

Latest commit

 

History

History
executable file
·
169 lines (149 loc) · 4.48 KB

README.md

File metadata and controls

executable file
·
169 lines (149 loc) · 4.48 KB

Bank API

Made by Joao Paulo Pereira License TypeScript server Node.js

AboutTechnologiesHow to start the projectMySQL databaseLicenseDeveloper


About

The project Bank API were made to start my journey learning backend using NodeJS and Typescript.


Technologies


How to start the project

Clone repository:
$ git clone https://github.com/joaorpereira/bank-api.git
Get inside folder:
$ cd bank-api
Install dependencies:
$ npm install
Create MySQL database:
$ create database as bank_database at MySQL 
Get inside folder:
$ create database as bank_database at MySQL 
Create database connection:
  client: 'mysql',
  connection: {
    host: proccess.env.HOST,
    port: 3306,
    user: proccess.env.DB_NAME,
    password: proccess.env.DB_PASSWORD,
    database: proccess.env.DB_DATABASE,
  },
Create MySQL tables:
$ npm create-tables
Start project:
$ npm run dev
The endpoints of this API are at the file .rest in this repository

MySQL database

Users Table
    id VARCHAR(255) PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    password VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL UNIQUE,
    cpf VARCHAR(255) NOT NULL,
    date_of_birth DATETIME NOT NULL,
    is_admin ENUM('NORMAL', 'ADMIN') DEFAULT 'NORMAL'
Transactions Table
    id VARCHAR(255) PRIMARY KEY,
    user_id VARCHAR(255) NULL,
    value FLOAT NOT NULL,
    type VARCHAR(50) NOT NULL,
    description TEXT,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE
Accounts Table
    id VARCHAR(255) PRIMARY KEY,
    user_id VARCHAR(255) NULL,
    user_name VARCHAR(255) NOT NULL REFERENCES users(name),                
    balance FLOAT DEFAULT 0,             
    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE

License

This project is under MIT license


Developer

Foto
Joao Paulo

Desenvolvido por Joao Paulo.

Linkedin Joao Paulo Rodrigues gmail Joao Paulo