Git Product home page Git Product logo

hmpps-visits-internal-admin-ui's Introduction

hmpps-visits-internal-admin-ui

repo standards badge CircleCI

Allows internal staff to administer prison visit bookings system.

Running the app

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

docker compose pull

docker compose up

Dependencies

The app requires:

  • hmpps-auth - for authentication
  • redis - session store and token caching
  • prison-register - look up names of prisons from Prison codes
  • visit-scheduler - all VSiP admin operations

Running the app for development

It is simplest to use HMPPS Auth dev, in which case no dependencies need to be started locally.

Install dependencies using npm install, ensuring you are using node v20.x and npm v10.x

Note: Using nvm (or fnm), run nvm install --latest-npm within the repository folder to use the correct version of node, and the latest version of npm. This matches the engines config in package.json and the CircleCI build config.

Using credentials from the dev namespace, create a .env local settings file

HMPPS_AUTH_URL=https://sign-in-dev.hmpps.service.justice.gov.uk/auth
HMPPS_AUTH_EXTERNAL_URL=https://sign-in-dev.hmpps.service.justice.gov.uk/auth
NOMIS_AUTH_URL=https://sign-in-dev.hmpps.service.justice.gov.uk/auth
MANAGE_USERS_API_URL=https://manage-users-api-dev.hmpps.service.justice.gov.uk
NODE_ENV=development

# Use credentials from the dev namespace for API and SYSTEM client
API_CLIENT_ID=clientid
API_CLIENT_SECRET=clientsecret
SYSTEM_CLIENT_ID=clientid
SYSTEM_CLIENT_SECRET=clientsecret

BOOKER_REGISTRY_API_URL="https://hmpps-prison-visit-booker-registry-dev.prison.service.justice.gov.uk"

PRISONER_CONTACT_REGISTRY_API_URL="https://prisoner-contact-registry-dev.prison.service.justice.gov.uk"

PRISON_REGISTER_API_URL="https://prison-register-dev.hmpps.service.justice.gov.uk"

VISIT_SCHEDULER_API_URL="https://visit-scheduler-dev.prison.service.justice.gov.uk"

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

npm run start:dev

Run linter

npm run lint

Run tests

npm run test

Running integration tests

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

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

Then run the server in test mode by:

npm run start-feature (or npm run start-feature:dev to run with nodemon)

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

Imported types

Some TypeScript types are imported via the Open API (Swagger) docs, e.g. from the Visit Scheduler, etc.

These are stored in ./server/@types/, for example ./server/@types/visit-scheduler-api.d.ts. There are also some corresponding files such as ./server/data/visitSchedulerApiTypes.ts that contain the particular imported types that are actually used in the project.

For example, to update types for the Visit Scheduler use the API docs URL from Swagger and the appropriate output filename:

npx openapi-typescript https://visit-scheduler-dev.prison.service.justice.gov.uk/v3/api-docs --output ./server/@types/visit-scheduler-api.d.ts

The downloaded file will need tidying (e.g. single rather than double quotes, etc):

  • npm run lint-fix should tidy most of the formatting
  • there may be some remaining errors about empty interfaces; these can be fixed be either removing the line or putting // eslint-disable-next-line @typescript-eslint/no-empty-interface before.

After updating the types, running the TypeScript complier across the project (npx tsc) will show any issues that have been caused by the change.

Import all types

To download and update all the API types and tidy up the files, run:

./bin/update-types.sh

hmpps-visits-internal-admin-ui's People

Contributors

aledwevans avatar andrewrlee avatar dhirajshettymoj avatar github-actions[bot] avatar hutcheonb-moj avatar infojav avatar psoleckimoj avatar renovate[bot] avatar tpmcgowan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hmpps-visits-internal-admin-ui's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.