Skip to content

Latest commit

 

History

History
44 lines (24 loc) · 2.07 KB

CONTRIBUTING.md

File metadata and controls

44 lines (24 loc) · 2.07 KB

Contributing

Want to add a new system? Are the docs not clear enough? We're always accepting contributions so please share any new features, improvements or bug fixes with us.

Installation

  1. Clone the repo and run npm install.
  2. Copy envs/.env.dev to the project root and rename it to .env.
  3. Run npm run up to spin up the Docker Compose containers.
  4. The backend will be accessible via http://localhost:3000.

Seeding data

Run npm run seed to seed your database with some fake data like users, events, games and players.

The seed command will create two users: admin@trytalo.com (an admin user) and dev@trytalo.com (a dev user with less permissions), both can be logged in with using the password password.

Testing

Run npm test to run the unit tests.

The tests run against your database container. They'll automatically backup and restore the current state of your database before executing the tests.

Your .env file will be used along with any additional env vars you define in envs/.env.test.

Please make sure to include tests with all pull requests.

Creating new services

You can create a new service using the npm run service:create command. You need to pass in the name of the entity you want the service to interact with.

For example, if you are adding a "Global Stats" service, you would run: npm run service:create global-stat (note that the entity name is singular and not a plural).

This will create a policy, entity and REST API for your new entity. If you want to expose API endpoints (so that it can be used by the Unity SDK), add --api to the end of the command.

Migrations

To create a migration, use npm run migration:create. This will create a migration class in the migrations folder.

Modify the default name of the file from Migration[Timestamp].ts to [Timestamp][PascalCaseDescriptionOfTheMigration].ts.

You should also rename the exported class to be [PascalCaseDescriptionOfTheMigration].

You will then need to import and add that migration class to the end of the list of migrations inside index.ts in the same folder.