Skip to content

Latest commit

 

History

History
101 lines (69 loc) · 2.36 KB

README.md

File metadata and controls

101 lines (69 loc) · 2.36 KB

competition backend

install

open a terminal at this directory and run:

npm install

start application

npm run build
npm start

setup system

# creates database schema, inserts masterdata, updates db
npm run generate:dbddl
# creates typescript types generated from db schema
npm run generate:dbtypes
# inserts test data (postman collection)
npm run test:data
# runs integration tests (postman collection)
npm run test:integration

edit / test

expose for apps during testing:

npx localtunnel --subdomain intesso  --port 8080
https://intesso.loca.lt/admin/overview

docker setup

# https://docs.docker.com/engine/install/ubuntu/
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

db setup

install postgres (docker) with mounted volume

docker run -dit --restart unless-stopped -e POSTGRES_DB=competition -e POSTGRES_USER=competition -e POSTGRES_PASSWORD=comp1234 -p 5432:5432 -v competition-postgres-data:/var/lib/postgresql/data --name competition-postgres postgres

# set db connection
export DB_CONNECTION="postgres://competition:comp1234@localhost:5432/competition"

if needed first reset the existing db. check run the script: reset.db.test.sql

# generate db tables and master data
npm run generate:dbddl
# generate typescript db types
npm run generate:dbtypes
# start the application
npm start 

# insert dummy data manually (if needed) in another terminal:
ts-node src/lib/db-migrations/0003-insert-dummy-data.ts

google sheet api

(reporting test, currently not in use)

if you run the application the first time, run this command to get a token:

ts-node src/lib/reports/google-auth.ts