Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to Main #12

Merged
merged 52 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b76c1b1
feat: add rating endpoints
invaderb May 6, 2023
c5e2ded
fix: comment typos
invaderb May 6, 2023
bb975a1
fix: select values
invaderb May 6, 2023
afa5960
fix: swagger docs
invaderb May 6, 2023
fd90775
chore: remove unneeded console.log
invaderb May 6, 2023
4061bf0
chore: code clean up and refactor
invaderb May 6, 2023
f84439e
chore: code clean up
invaderb May 6, 2023
d995461
chore: code clean up
invaderb May 6, 2023
ebd3001
Merge branch 'dev' into rating-endpoints
invaderb May 6, 2023
0a92cf2
test: fix game service tests
invaderb May 6, 2023
7fb5c6e
Merge branch 'rating-endpoints' of github.com:USTakAssociation/playta…
invaderb May 6, 2023
b94a5d1
chore[Readme]: make endpoints list more readable
nitzel Apr 30, 2023
f05b892
fix: use path.join to prevent misconfigurations of e.g. DB_PATH when …
nitzel Apr 30, 2023
02cb12a
Merge branch 'rating-endpoints' of github.com:USTakAssociation/playta…
invaderb May 6, 2023
a7b6dbe
feat: add rating endpoints
invaderb May 6, 2023
515846e
fix: comment typos
invaderb May 6, 2023
eac25a0
fix: select values
invaderb May 6, 2023
7d97697
fix: swagger docs
invaderb May 6, 2023
5f44a78
chore: remove unneeded console.log
invaderb May 6, 2023
45ad58c
chore: code clean up and refactor
invaderb May 6, 2023
a6242b1
chore: code clean up
invaderb May 6, 2023
f22056f
chore: code clean up
invaderb May 6, 2023
bfb4264
test: fix game service tests
invaderb May 6, 2023
707a1cb
Merge branch 'rating-endpoints' of github.com:USTakAssociation/playta…
invaderb May 6, 2023
e082bc5
feat: add rating endpoints
invaderb May 6, 2023
dbf940e
chore: code clean up
invaderb May 6, 2023
54ff1fe
chore: code clean up
invaderb May 6, 2023
63de9b8
Merge branch 'rating-endpoints' of github.com:USTakAssociation/playta…
invaderb May 6, 2023
0e85a5c
fix: issues from rebasing
invaderb May 6, 2023
b81caf2
chore: code clean up and refactor
invaderb May 15, 2023
1f95973
fix: spelling error
invaderb May 16, 2023
9e767e0
fix: readme endpoints
invaderb Dec 22, 2023
c92d515
Merge branch 'dev' into rating-endpoints
invaderb Jun 18, 2024
773062e
feat: add bruno tests
invaderb Jun 18, 2024
6651a0a
Merge branch 'dev' into rating-endpoints
invaderb Jun 18, 2024
bb86af3
feat: add bru api test files
invaderb Jun 18, 2024
0194c27
fix: fatigue rating calculation
invaderb Jun 19, 2024
fc03290
fix: unit test for updated typings
invaderb Jun 19, 2024
fa73f96
fix: typos
invaderb Jun 19, 2024
249f7dc
chore: update readme
invaderb Jun 19, 2024
84f152c
fix: logic for always adding fatiguerating to players who have or hav…
invaderb Jun 19, 2024
5631f3c
fix: add cron directive
invaderb Jun 19, 2024
bd77c31
fix: update deploy script
invaderb Jun 19, 2024
66f9493
Merge pull request #8 from USTakAssociation/rating-endpoints
invaderb Jun 19, 2024
6e4939b
chore: remove noisy debug log
invaderb Jun 19, 2024
e316907
fix: query param order
invaderb Jun 19, 2024
e186839
chore: rename fatiguerating to participation_rating
invaderb Jun 21, 2024
a3f7962
fix: set cron value from environment variable
invaderb Jun 21, 2024
bbe0394
chore: remove unneeded cron import
invaderb Jun 23, 2024
2269657
chore: add previous.txt to gitignore
invaderb Jun 27, 2024
a866227
fix: parsed fatigue
invaderb Nov 24, 2024
ce70029
chore: clean up
invaderb Nov 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ NODE_ENV=local
APP_ENV=Local
CORS_DOMAIN='http://localhost:5173,http://127.0.0.1:5173,http://127.0.0.1:3000'
ANON_DB_PATH=/Users/braydonharris/dev/personal-projects/tak/server/games_anon.db
DIST_PATH=dist/
DIST_PATH=dist/
PREVIOUS_FILE=previous.txt
RATING_OUTPUT_PATH=dist/
RATING_CRON_VALUE='0 15 * * * *'
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
indent: ['warn', 'tab', { SwitchCase: 1 }],
indent: ['warn', 'tab', { SwitchCase: 1, "ignoredNodes": [
`FunctionExpression > .params[decorators.length > 0]`,
`FunctionExpression > .params > :matches(Decorator, :not(:first-child))`,
`ClassBody.body > PropertyDefinition[decorators.length > 0] > .key`,
], }],
},
};
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- main
- dev

jobs:
lint_and_test:
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/deploy-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
ANON_DB_PATH: ${{ secrets.ANON_DB_PATH }}
DB_PATH: ${{ secrets.DB_PATH }}
APP_ENV: ${{ secrets.APP_ENV }}
PREVIOUS_FILE: ${{ secrets.PREVIOUS_FILE }}
RATING_OUTPUT_PATH: ${{ secrets.RATING_OUTPUT_PATH }}
RATING_CRON_VALUE: ${{ secrets.RATING_CRON_VALUE }}
run : |
rm .env
touch .env
Expand All @@ -53,8 +56,12 @@ jobs:
echo "ANON_DB_PATH = ${ANON_DB_PATH}" >> .env
echo "DB_PATH = ${DB_PATH}" >> .env
echo "APP_ENV = ${APP_ENV}" >> .env
echo "PREVIOUS_FILE = ${PREVIOUS_FILE}" >> .env
nitzel marked this conversation as resolved.
Show resolved Hide resolved
echo "RATING_OUTPUT_PATH = ${RATING_OUTPUT_PATH}" >> .env
echo "RATING_CRON_VALUE = ${RATING_CRON_VALUE}" >> .env
mv .env ./dist
mv node_modules ./dist
mv previous.txt ./dist
tar -czf artifact.tar.gz ./dist
- name: Deploy
env:
Expand All @@ -70,9 +77,11 @@ jobs:
rm -rf playtak-api-dev-tmp
mkdir playtak-api-dev-tmp
tar -xzf artifact.tar.gz -C ./playtak-api-dev-tmp
cp /var/apps/playtak-api-beta/previous.txt playtak-api-dev-tmp/previous.txt
sudo rm -rf /var/apps/playtak-api-beta
sudo mv playtak-api-dev-tmp/dist/ /var/apps/playtak-api-beta
rm -rf playtak-api-dev-temp
cp playtak-api-dev-tmp/previous.txt /var/apps/playtak-api-beta/previous.txt
rm -rf playtak-api-dev-tmp
rm artifact.tar.gz
pm2 restart playtak-api-beta --update-env
'
10 changes: 9 additions & 1 deletion .github/workflows/deploy-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
ANON_DB_PATH: ${{ secrets.ANON_DB_PATH }}
DB_PATH: ${{ secrets.DB_PATH }}
APP_ENV: ${{ secrets.APP_ENV }}
PREVIOUS_FILE: ${{ secrets.PREVIOUS_FILE }}
RATING_OUTPUT_PATH: ${{ secrets.RATING_OUTPUT_PATH }}
RATING_CRON_VALUE: ${{ secrets.RATING_CRON_VALUE }}
run : |
rm .env
touch .env
Expand All @@ -53,6 +56,9 @@ jobs:
echo "ANON_DB_PATH = ${ANON_DB_PATH}" >> .env
echo "DB_PATH = ${DB_PATH}" >> .env
echo "APP_ENV = ${APP_ENV}" >> .env
echo "PREVIOUS_FILE = ${PREVIOUS_FILE}" >> .env
echo "RATING_OUTPUT_PATH = ${RATING_OUTPUT_PATH}" >> .env
echo "RATING_CRON_VALUE = ${RATING_CRON_VALUE}" >> .env
mv .env ./dist
mv node_modules ./dist
tar -czf artifact.tar.gz ./dist
Expand All @@ -70,9 +76,11 @@ jobs:
rm -rf playtak-api-tmp
mkdir playtak-api-tmp
tar -xzf artifact.tar.gz -C ./playtak-api-tmp
cp /var/apps/playtak-api-prod/previous.txt playtak-api-tmp/previous.txt
sudo rm -rf /var/apps/playtak-api-prod
sudo mv playtak-api-tmp/dist/ /var/apps/playtak-api-prod
rm -rf playtak-api-temp
cp playtak-api-tmp/previous.txt /var/apps/playtak-api-prod/previous.txt
rm -rf playtak-api-tmp
rm artifact.tar.gz
pm2 restart playtak-api-prod --update-env
'
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ lerna-debug.log*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/extensions.json

previous.txt
35 changes: 25 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Playtak-api
# PlayTak-API

## Description

![Unit Tests](https://github.com/USTakAssociation/playtak-api/actions/workflows/ci.yml/badge.svg
)
![Unit Tests](https://github.com/USTakAssociation/playtak-api/actions/workflows/ci.yml/badge.svg)


This is the Play Tak API projects which contains multiple endpoints for serivcing data to the Play Tak UI
This is the Play Tak API project which contains multiple endpoints for servicing data to the Play Tak UI

## Requirements
- node v16.17.1
- sqlite3

## Installation

Expand All @@ -16,6 +19,8 @@ $ npm install

## Running the app


*Note: be sure to update the .env file with the correct paths to where the sqlite db files are located*
```bash
# development
$ npm run start
Expand Down Expand Up @@ -47,21 +52,31 @@ https://api.playtak.com/api

https://api.{env}.playtak.com

Events
- /events

Games History
- /v1/games-history/
- /v1/games-history/{id}
- /v1/games-historoy/ptn/{id}
- /v1/games-history/ptn/{id}
- /v1/hames-history/db

## TODO
Ratings
- /v1/ratings
- /v1/ratings/{player_name}

- Finish up migrating rerating to nest
- endpoints for getting rating data
## TODO
- create user auth endpoints and test
- dockerize app
- automatically setup db files in the project and fill with dummy data
- setup API key registration to track usage
- add automated versioning and setup release artifacts with github
- build out more robust deploy and rollback
- add health check endpoint


## Contributing
PlayTak is an OPEN Open Source Project. This means that:
PlayTak is an Open Source Project. This means that:

> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit.

Expand All @@ -78,7 +93,7 @@ Please read [CONTRIBUTING.md](docs/CONTRIBUTING.md) for details on our code of c
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the tags on this repository.

## Contributors
Play tak is only possible due to the excellent work of the following contributors:
PlayTak is only possible due to the excellent work of the following contributors:

||
:----:|
Expand Down
3 changes: 2 additions & 1 deletion nest-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"assets": ["assets/**/*"]
"assets": ["assets/**/*"],
"plugins": ["@nestjs/swagger"]
}
}
Loading