Hubla Transactions
Built with
Setup
The project can be run in a production environment with a single docker-compose
located on project root
- Install docker and docker-compose
- Copy
.env.example
to a.env
file on project root, making changes if necessary- The
NGINX_PORT
variabel defines the port in wich the application will be exposed
- The
- The web interface can be accessed at
http://localhost:NGINX_PORT
and the server athttp://localhost:NGINX_PORT/api/
- Setting
NGINX_PORT
to80
, the default HTTP port, exposes the app athttp://localhost
andhttp://localhost/api/
- Setting
- At project root run:
docker-compose up
Testing
There is also a docker-compose setup in the server
directory for running the backend test suites
cd server
- Make sure the variables in
.env.test
have appropriate values - Run:
yarn docker:test:run
Development
Curently there is no docker development environment setup
- Prerequisites
- A running
postgres service
, either in a Docker container or in a local instance - Having
Node
installed
- Back-end
cd server
- Copy
.env.example
to a.env
file, making changes if necessary yarn start:dev
- Front-end
cd client
- Copy
.env.example
to a.env
file, making changes if necessary- The
VITE_SERVER_BASE_URL
environment variable should point to the running server URL
- The
yarn dev
Database ERD
๐ Routes
-
The default responses are:
200
- Successful GET request201
- Successful POST request204
- Successful DELETE request401
- Auth errors404
- Resource not found422
- Body validation error on POST requests
-
By default routes require:
Authorization: Bearer TOKEN
header for JWT auth -
๐
denotes an open route
GET /
- ๐ Hello from running server!
Auth
POST /auth/signup
- ๐ Route for creating a new user
- body:{
"username": "jondoe",
"password": "DonJoe27"
}
- response: {"token": "JWT_TOKEN"}
POST /auth/signin
- ๐ Route for signing an existing user
- body:{
"username": "jondoe",
"password": "DonJoe27"
}
- Response: {"token": JWT_TOKEN}
POST /auth/delete
- Deletes current signed user
- headers: {"Authorization": "Bearer TOKEN"}
Transactions
POST /transactions/upload
- Route for creating many transactions via input file
- Duplicate transactions are ignored by a unique (vendorId & productId & date) contraint
- headers: {"Authorization": "Bearer TOKEN"}
- Form Data: { file }
GET /transactions
- Route for getting all trnasactions
- headers: {"Authorization": "Bearer TOKEN"}
- Response: array of transactions
GET /credentials/:id
- Route for finding one transaction
- headers: {"Authorization": "Bearer TOKEN"}
- Response: transaction
DELETE /credentials/:id
- Route for deleting one transaction
- headers: {"Authorization": "Bearer TOKEN"}