Skip to content

karla-vm/cms-carts-seds

Repository files navigation

Maintainability

cms-carts-seds

Architecture

Architecture Diagram

Required Tools

You will need Node and to make things easier you should have NVM installed

This project uses Yarn as a package manager. Make sure to install it globally. No not use npm or commit any package-lock files

You will need docker installed. either with homebrew or may we suggest the docker desktop

You will need serverless installed globally. npm install -g serverless

Environments

The master branch reflects our latest product. On merge to master, the dev environment is deployed and tested in Amazon. When the master build succeeds, the commit on master is tagged in git as a candidate release version.

There are three primary environments

Continuous Integration and Deployment

Jenkins is used to deploy the various releasses from master into their respective environments

When a version needs to be deployed to staging or production select the desired pipeline and choose deploy with parameters inserting the release number you wish to deploy.

Some development notes

Development will be done on feature/bugfix branches that will be submitted as PRs. Accepted PRs will be merged to the master branch.

A PR must be reviewed and approved by someone other than the submitter. The submitting developer is responsible for merging it to master once the PR has been approved and all comments have been resolved.

This project uses Prettier for code formatting. Uee format_on_save functionality or run npx prettier --write /path/to/file on your files before submitting your PR

Set up

  1. Clone this repository
  2. Navigate to the cloned repository
    • cd cms-carts-seds
  3. Ensure you are in the master branch

Start Up Localhost with Django/Postgres Backend

  1. Navigate to the 'frontend' subfolder
    • cd frontend
  2. Connect a container to the network (only necessary on first build)
    • docker network create data_net
  3. Build your services
  • docker-compose -f docker-compose.local.yml down -v --rmi local
  • docker-compose -f docker-compose.local.yml up -d

This will run in the console and then a few things happen in the background. There is a roughly a two minute time period from when the command completes and the ui is available to see the status you can do docker-compose -f docker-compose.local.yml logs

  1. Access the project

Available Endpoints:

  • /api/v1/sections/<int:year>/<str:state>: all the sections for a year and state, e.g. /api/v1/sections/2020/ak.
  • /api/v1/sections/<int:year>/<str:state>/<int:section>: the section for that year and state, e.g. /api/v1/sections/2020/ak/1.
  • /api/v1/sections/<int:year>/<str:state>/<int:section>/<str:subsection>: the subsection for that year and state, e.g. /api/v1/sections/2020/az/3/c.
  • /api/v1/questions/<str:state>/<slug:id>: e.g. /api/v1/questions/ma/2020-03-c-01-01.
  • /api/v1/generic-sections/<int:year>: all the default sections for a year e.g. /api/v1/generic-sections/2020.
  • /api/v1/generic-sections/<int:year>/<int:section>: the default section for that year e.g. /api/v1/generic-sections/2020/1.
  • /api/v1/generic-sections/<int:year>/<int:section>/<str:subsection>: the default subsection for that year e.g. /api/v1/generic-sections/2020/1/a.
  • /api/v1/generic-questions/<slug:id>: the default corresponding question, e.g. /api/v1/generic-questions/2020-01-a-01.

Currently only Sections 1, 2, 3 (incomplete) and 5 are available, and only mock data for AK, AZ, and MA is available.

Append ?format=json to the URLs to get bare JSON.

Available Routes:

  • /sections/:year/:sectionOrdinal/:subsectionMarker e.g. http://localhost:81/sections/2020/3/c
  • /sections/:year/:sectionOrdinal/ e.g. http://localhost:81/sections/2020/3

Running the React Test Suite

  1. Navigate to the front end
    1. cd frontend\react\src
  2. Launch the test runner in interactive watch mode.
    1. Run npm test
    2. Press a to run all tests.