Giter Site home page Giter Site logo

gpsportplaner's Introduction

GPSportPlaner

Frontend

Angular v16 with i18n

setup:

npm install

develop with:

npm run dev or npm run hostdev (to be able to access it from your phone)

Backend

Express with Typescript and Mongoose

setup:

  1. Install packages npm install

  2. Setup local mongodb

docker run -d -p 27017:27017 --name gpsmongo -e MONGO_INITDB_ROOT_USERNAME=gpsbackend -e MONGO_INITDB_ROOT_PASSWORD=gpstest mongo:latest

send POST to http://localhost:3000/auth/setInitialPw with

{
    "role": "user",
    "newPassword": "pw"
}

curl command to set all roles:

curl -X POST http://localhost:3000/auth/setInitialPw -H "Content-Type: application/json" -d "{\"role\": \"user\", \"newPassword\": \"userpw\"}"
curl -X POST http://localhost:3000/auth/setInitialPw -H "Content-Type: application/json" -d "{\"role\": \"master\", \"newPassword\": \"masterpw\"}"
curl -X POST http://localhost:3000/auth/setInitialPw -H "Content-Type: application/json" -d "{\"role\": \"admin\", \"newPassword\": \"adminpw\"}"

to set user pw and set pws for all other roles (admin and master)

run mongodb docker

npm run start:db

develop with:

npm run dev

run tests with:

npm run test or npm run testwatch

Hosting

Frontend

Angular frontend is hosted via google firebase hosting

Backend Deployment to VPS for CI/CD with Github Actions

Point A-Record to VPS-IP

adduser username
usermod -aG sudo username
sudo su - username
mkdir ~/.ssh
chmod 700 ~/.ssh
Enter your key: nano ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
sudo service ssh restart
try to login as the user
sudo nano /etc/ssh/sshd_config
change PermitRootLogin no
PasswordAuthentication no if it is yes

sudo systemctl reload sshd
sudo apt install nginx ufw
sudo ufw enable

sudo ufw allow ssh
sudo ufw allow 'Nginx Full'

Optional (new repo)
Goto Github Actions and use the deploy-backend.yml
Goto settings -> actions -> add runner
Enter each command on the server
then
sudo ./svc.sh install
sudo ./svc.sh start

install NodeJs
curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install -y nodejs

setup pm2
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
nano ~/.profile
add "export PATH=~/.npm-global/bin:$PATH"

npm install -g pm2

gpsportplaner's People

Contributors

kevinunger avatar

Stargazers

 avatar  avatar

Watchers

 avatar

gpsportplaner's Issues

delete old db entries

Currently all bookings are stored in the bookings table and are never deleted.
ToDo: Backend cronjob / schedular within express that deletes all bookings older than ~1 month.

very low-prio, because the data size is very low (10_000 entries < 2 MB)

i18n

  • add i18n
  • add english / german
  • add language switcher to the sidebar

improve password form

Problems:

  • Password not hidden
    image

  • autocomplete (on mobile) should be disabled

  • browser not remembering login

  • not a submittable form (you cant hit ENTER and it submits the whole thing)

add checkboxes

  • add a checkbox at the top of the add-booking screen "only show free slots"
    -> only shows slots that aren't booked by someone

  • add a checkbox at the top of the overview-bookings screen "only show occupied slots"
    -> only shows slots that are booked by someone

after setting one of the two, set setting in settings service
load settings on init

can only be done after #9

test env

  • test db
  • test branch
  • test autodeployment to test.url

local env will be hotwired to test db

let user change bookings

  • add controller function
  • add route /bookings/changeBooking body: oldbooking: {...} newbooking: {...}
  • check if bookedBy in bookings == decodedJWTPayload.user
    problem: a user can just login as another user and change their booking (we don't care for now)

logging

log stuff to log collection

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.