3.11.0 • Published 1 year ago

trucks-volume-v3 v3.11.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

trucks-volume-v3

Date 2024/05/30

Description

What is this repository for?

  • trucks-volume-v3 is an API to store and retrieve Volume Data for TruckMetrics

  • Please check CHANGELOG.md for version history

Who do I talk to?

  • jack@motionmetrics.com

Installation

  1. Copy trucks-volume-v3.env from \motionmetrics.net\i2l\Bamboo_Files\MMPro_Env\I2L-Staging and rename it as .env

  2. Copy .npmrc from \motionmetrics.net\i2l\Bamboo_Files\MMPro_Env\I2L-Staging

  3. Install all the dependencies with the command:

    npm ci
  1. Compile the typescript to javascript and run lint
    npm run-script build
6. Start the program
npm start
7. Test the program by going to http://localhost:8080/trucks/volume/v3/help

Setup Database Table with Sequelize Migrations (ver 6.17.0)

  1. Install the Sequelize CLI: npm install --save-dev sequelize-cli

  2. Add .sequelize file to the root domain. The most important is 'config' and 'migrations-path'. 'config' contains the credential to the database, and 'migrations-path' consists of scripts to modify data.

    const path = require('path');
    
    module.exports = {
    'config': path.resolve('sources/config', 'db.config.ts'),
    'models-path': path.resolve('database', 'models'),
    'seeders-path': path.resolve('database', 'seeders'),
    'migrations-path': path.resolve('database', 'migrations')
    };
  3. Generate migration file using sequelize-cli. The migration file allows user to safely modify the column of the table using scripts. It also provides a place to script the database if the migration fails.

    npx sequelize-cli migration:generate --name new-migrations-script
  4. Use sequelize-cli to execute the modification.

    npx sequelize-cli db:migrate
  5. Update the files under sources/models to ensure that the newly added tables or columns have been updated.

  6. To rollback the most recent migration, use the following command:

    npx sequelize-cli db:migrate:undo

Commit Message Format - Angular Convention

(): │ │ │ │ │ └─⫸ Summary in present tense. Not capitalized. No period at the end. │ │ │ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core| │ elements|forms|http|language-service|localize|platform-browser| │ platform-browser-dynamic|platform-server|router|service-worker| │ upgrade|zone.js|packaging|changelog|docs-infra|migrations| │ devtools │ └─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test see https://github.com/angular/angular/blob/main/CONTRIBUTING.md#-commit-message-format for more details

Alternatively, you can use the module commitizen to help you format the commit message. 1. install commitizen

    npm install -g commitizen
  1. making your repo commitizen-friendly
    commitizen init cz-conventional-changelog --save-dev --save-exact
  1. commit your changes Simply use git cz or just cz instead of git commit when committing. You can also use git-cz, which is an alias for cz.
    git add .
    git cz

see https://github.com/commitizen/cz-cli for more details

Running Integration Tests

  1. Copy the \\motionmetrics.net\i2l\UBC_I2L_Bamboo_data\MMPro_Env\QC\I2L-Staging\npm-qc-user-credentials.env from NAS, and save it to the IntegrationTest folder and rename it as .env

  2. Repeat Steps in "Getting started for developer" if you haven't done

  3. Run the Integration Test:

    npm run-script integration-test

Formatting

    npm run format

Releasing APIdoc (OpenAPI definition)

  1. Start the program
    npm start
  1. Verify APIdoc is viewable at http://localhost:8080/api and the content is correct.

  2. In ./src/documentation.ts, set the third parameter to false for edit users to access.

  3. Releasing Open API doc is uploaded automatically when bitbucket pipeline is triggered.

  4. Navigate to https://v2.metricsmanagerstaging.com/documentation/serve.html?name=trucks-volume-v3 view the documentation

Note

We are currently using Node LTS v18.13.0