A project to track work on projects for clients.
The following are required to run this project:
- Node & NPM installed, package dependencies installed
npm i
. - Authenticated your local NPM with github packages for access to private Badgateway github packages.
- MySQL database set up and running.
If npm i
first gave you an error, you might need to get access to our Github
packages first.
Follow the steps here:
- Go to your Github Settings > Developer Settings > Personal Access Tokens
- Generate yourself a new one, give it read/write packages permissions. (save the PAT, cant be found again)
- Navigate to your home directory, find or create a
.npmrc
file, add the following line//npm.pkg.github.com/:_authToken=[your-recently-generated-PAT]
Now when running 'npm i' the node modules will be downloaded.
Create a mysql database for this project. We're using "tt" as an identifier here often, shortform for "time tracking". Set the database user password your_password
to your own appropriate password.
mysql> CREATE DATABASE tt;
mysql> CREATE USER 'tt' IDENTIFIED BY 'your_password';
mysql> GRANT SELECT, REFERENCES, INSERT, UPDATE, DELETE, ALTER, CREATE, DROP ON tt.* TO 'tt';
mysql> FLUSH PRIVILEGES;
Run cp .env.defaults .env
to set up your configuration. Update .env
with the database username and password you set up.
Populate the database using knex, which should add tables automatically.
$ npx knex --knexfile src/knexfile.ts migrate:latest
This should populate your database with the required tables.
After a12n-server is running, and you have confirmed you can log in, you'll need to add an 'app' principal and OAuth 2 credentials. The easiest way to do this is by opening:
At the end of this process, this will give you a 'client secret'. Copy this secret and add it to your .env
file in the OAUTH2_CLIENT_SECRET value.
Now that the app has been created, give it *admin
privileges.
{
"*": [
"admin"
]
}
From the root directory, initiate the project with make start-dev
(make sure the deps are installed).
The API server can be browsed at http://localhost:8901/.