Skip to content

ministryofjustice/pre-sentence-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

281 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Pre-sentence Service

Pre-Sentence Service is a service that allows probation staff to capture and store pre-sentence data.

API docs

repo standards badge

Running the app

Ensure docker images are up-to-date

docker-compose pull

The easiest way to run the app is to use docker compose to create the service and all dependencies.

docker-compose up

Dependencies

The app requires:

  • hmpps-auth - for authentication
  • redis - session store and token caching
  • postgres - database
  • gotenberg - PDF generator
  • localstack - Cloud service emulator

Runing the app for development

Ensure docker images are up-to-date

docker-compose pull

To start the main services excluding the typescript app:

docker-compose up --scale app=0

Now in a separate terminal window or tab, at the project root.

Install dependencies using npm install, ensuring you are using >= Node v24.0.0 LTS

And then, to build the assets and start the app with nodemon:

AWS_ENDPOINT=http://localhost:4566 npm run start:dev

Note: AWS_ENDPOINT is only set for correct use with localstack during local development.

You can now access the service at http://localhost:3000

Run linter

npm run lint

Run tests

npm run test

Running integration tests

For local running, start a test db, redis, and wiremock instance by:

docker-compose -f docker-compose-test.yml up

Then, in a separate terminal window or tab, at the project root; run the server in test mode by:

AWS_ENDPOINT=http://localhost:4566 npm run start-feature (or AWS_ENDPOINT=http://localhost:4566 npm run start-feature:dev to run with nodemon)

Note: AWS_ENDPOINT is only set for correct use with localstack during local development.

And then either, run tests in headless mode with:

npm run int-test

Or run tests with the cypress UI:

npm run int-test-ui

Clean database

In order to clean the database you can use:

npm run clean-db

This will remove all database tables, you must then restart the service in order to run the migrations and reset the database.

API Documentation

API documentation is provided via Swagger.

Once the applicaiton is running you can access the Swagger UI at:

http://localhost:3000/api/docs

About

A service that allows probation staff to capture and store pre-sentence data

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors