lmr-api-spec

A Cross-team repository to maintain API Specifications for Link My Ride mobile app.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
lmr-api-spec
1.37.1-rc.282 days ago5 months agoMinified + gzip package size for lmr-api-spec in KB

Readme

This repository contains information that describes how communication and data transfer takes place between the LMR Mobile app that is being developed by ASquared and its API layer that is being developed by Jump24. The information hosted on this repository is divided into the following categories:
  • Architectural decision records
  • Open API specs
  • TypeScript type definitions
  • Sample (mock) data
  • Jest unit tests
Installing
In order to be able to run scripts mentioed in package.json file, please make sure you have node installed. Then, the node module dependencies needs to be installed with the following command: npm i
Testing
  • First stage of quality assurance of the repository is lint rule checking, which can be done with the following command:

npm run lint
  • The second part is static type checking, which can be done with the following command:

npm run typecheck
  • In order to run tests locally and offline, the following command is used:

npm run test
  • For being able to run integration tests ( e.g by connecting to a real server environment), you can use the following command:

npm run test:staging
  • Before doing so, please make sure that:
- Your IP is allow-listed by Jump24 so that you can issue requests to their servers. - You replace copy .env.example file to create a .env file that inculdes 2 uath tokens. The token values can be retrieved from other team members or from Gitlab CI's environment variables.
Building
  • The build artifact of the project is located under dist folder and contains the following:

- Mock data under src/mock/data - API specs under src/specs - Type definitions inside type.d.ts file
  • Build artifact can be generated with the following command:

npm run build
CI/CD
  • If a merge request is created where the source is a feature branch and the target is the repository's default branch, the CI/CD does the following

  • Builds the project to generate artifacts.
  • Publishes a node module named lmr-api-spec with a release candidate (-rc) suffix.
Push notifications testing
In order to try out push notifications, you'll need to :
  • Get a copy of the scripts/keys/link-my-ride-8063e-firebase-adminsdk-v2knp-7e348e9853.json file from Nick K
  • Then run npm run send-notification

This should run the /scripts/send-notification.ts file using NodeJS. This is expected to send a push notification to all devices that have subscribed to firebase topic u54797216-e1b6-11ec-8fea-0242ac120001 - the current mock api user id is 54797216-e1b6-11ec-8fea-0242ac120001 so this will only send to all mock users running a this MR in their branch on a real device: