Skip to content

Commit

Permalink
Update readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zikoat committed Jul 28, 2024
1 parent 87fdd24 commit c221f73
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 85 deletions.
51 changes: 18 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
# BUK Universal Games

## Notes - if project ever re-used

1. Make it possible to clear a match result and to set a match to a draw (splitting winner points)
2. Extra safety on point-and-match clearing function - not allowed after game started
3. Hide highscore to keep things exciting failed because of missing check for timezone when parsing dates from settings (missed by some hours)
4. Recommended: When signing in as systemadmin - everything should be similar as for an admin but with an additional screen for system admin features (clear cache, pre-cache and clear points and matches)
5. Better info: If start links used through Telegram and if stickers scanned directly from phones camera and not camera button i app - user is not signed in because Telegram browser does not have same local storage as the browser used outside Telegram
## Notes - if project is re-used

See issue https://github.com/bcc-code/buk-universal-games/issues/127
## Running Locally

Run `docker-compose up --build -d` for the backend. Visit http://localhost:5127/ for the Directus UI, credentials are [email protected]:password
Run `cd frontend; npm install; npm run dev` for the front-end. Visit https://localhost:8080 to view it. Bun is supported.
Install docker desktop and run `cd backend; docker-compose up --build -d` to start the backend. Visit http://localhost:5127/ for the Directus UI, credentials are [email protected]:password. Go to http://localhost:5125/ to view swagger.
Run `cd frontend; npm install; npm run dev` for the front-end. This project also supports bun. Install bun and replace all usages of npm with bun.

Note: To allow a PWA to work in development in Chromium browsers you must start it with an additional command line flag `--ignore-certificate-errors`:

Expand All @@ -34,7 +29,15 @@ You can import the test data files in Directus in this order:
5. matches...json
6. settings...json

### Accessing Database
There is a points json file, and you can import this to see what the actual points were at the end of ubg, but the points do not have to be imported, because this table will be populated during the game when scores are registered.

### Accessing Database in production
Go to Google Cloud Console > sidebar > SQL > buk-universal-games-pgsql-prod > sidebar > cloud SQL Studio
1. Database: buk-universal-games-prod
2. User: buk-universal-games-prod-default
3. You can find the password by going to: Cloud run > buk-universal-games-api-prod > Revisions > Environment Variables > Press the link which says `buk-universal-games-api-prod-POSTGRES_PASSWORD` > Press 3 dots on the single row which shows up > View secret value. This is the password for the database user.

### Accessing Database locally

1. Visit: http://localhost:5126/
2. Log in with: [email protected] / password (Note: You may get stuck in a redirect loop on Firefox, use Chrome instead)
Expand Down Expand Up @@ -79,29 +82,11 @@ Note: If you're running multiple docker-compose configurations with custom netwo

Migrations are automatically applied when the a new version of the application is deployed.

## Connect to the Remote Postgres Instance

1. Generate a credentials key for the "remote-admin" user in Google Cloud Console
2. Paste this key into 'credentials/gcp-remote-admin.json'
3. Run `docker-compose -f docker-compose.yml -f docker-compose.proxy.yml up`
4. Open pgAdmin: http://localhost:5126/
5. Right click "Servers"->Register->Server...
6. Add following parameters
1. Name: `buk-universal-games - PROD` (or similar)
2. (Under connection)
- Host name: `host.docker.internal` (on windows, can also try localhost on other platforms)
- Port: `5434`
- Username: `remote-admin`
- Password: `{***remote admin password***}`

## Avoiding refresh loops in the frontend

When having refresh loops in the frontend, go to devtools > Application > (in the sidebar) Service workers, and enable "Update on reload" and "Bypass for network".

To log out or clear the cache because of changes to the source code, go to devtools > Application > (in the sidebar) Storage > Clear site data.

## Access directus in prod
https://buk-universal-games-directus-prod-lo75nlp2va-ez.a.run.app/

## Testing team code
A84BQ9
This link may change when a new server is made. Ask Reng for new url in this case.

## Acces swagger in prod

https://universalgames.buk.no/api
47 changes: 0 additions & 47 deletions frontend/README.md

This file was deleted.

7 changes: 3 additions & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
"private": true,
"type": "module",
"scripts": {
"serve": "vite",
"dev": "vite",
"build": "run-p type-check build-only",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"type-watch": "vue-tsc --noEmit --watch",
"build-only": "vite build",
"type-check": "vue-tsc --build --force",
"type-watch": "vue-tsc --noEmit --watch",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/",
"generate:types": "openapi-zod-client http://localhost:5125/swagger/v1/swagger.json -o ./src/types/api.ts --implicit-required"
"generate-types": "openapi-zod-client http://localhost:5125/swagger/v1/swagger.json -o ./src/types/api.ts --implicit-required"
},
"dependencies": {
"@coddicat/vue-pinch-scroll-zoom": "^4.7.1",
Expand Down
1 change: 0 additions & 1 deletion proxy/README.md

This file was deleted.

0 comments on commit c221f73

Please sign in to comment.