Coder Social home page Coder Social logo

hmcts / prl-dgs-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 8.0 1.0 4.4 MB

For generating PDF and storing in docstore via case-document-am-api

License: MIT License

Shell 0.86% Dockerfile 0.22% Groovy 2.11% HCL 0.17% Java 96.64%
jenkins-cft jenkins-cft-j-z

prl-dgs-api's Introduction

Document Generator

License: MIT Build Status codecov Documentation

This is a document generation and template management service. This allows to generate documents based on a given template name and placeholder data in JSON format and will also store the generated document in the Document Management Store (via Case Document AM).

The service provides a single RESTful endpoint that will generate the document, store it in Evidence Management Store and return the link to the stored data.

Updated with master code base until 2.1

Dynamic file name

You must pass dynamic_fileName key in the placeholders map to get a dynamic file name

Setup

Prerequisites

Building

The project uses Gradle as a build tool but you don't have to install it locally since there is a ./gradlew wrapper script.

To build project please execute the following command:

./gradlew build

Running

First you need to create distribution by executing following command:

./gradlew installDist

To begin download the azure client cli:

brew update && brew install azure-cli

After it has finished downloaded run:

az login

This should open a browser window for you to login, use your HMCTS account

After logging in run the following command:

az acr login --name hmcts --subscription <ask the team for the secret>

Make sure you are connected to the VPN to before you run docker-compose up otherwise it won't be able to use the image.

When the distribution has been created in build/install/prl-dgs-api directory, you can run the application by executing following command:

docker-compose up

As a result the following container(s) will get created and started:

  • long living container for API application exposing port 4007

Troubleshooting

Managing Preview environment PODs

Make sure you have added the label 'enable_keep_helm' while creating the PR. Otherwise, add the label and re-trigger the build.

Testing

Integration tests

To run all integration tests locally:

  • Make a copy of src/main/resources/example-application-aat.yml as src/main/resources/application-aat.yml
  • Make a copy of src/integrationTest/resources/example-application-local.properties as src/integrationTest/resources/application-local.properties
  • Replace the replace_me secrets in the newly created files. You can get the values from SCM and Azure secrets key vault (the new files are in .gitignore and should not be committed to git)
  • Assuming you use IntelliJ, run your application
  • And then run your gradle functional tests task
  • Or if using command line:
    • Start the app with AAT config using ./gradlew clean bootRunAat
    • Start the test with AAT config using ./gradlew clean functional

If you update content in templates, you can re-generate the PDFs by running the ignored test PDFGenerationTest.ignoreMe_updateGeneratedPdfs. The test will output generated PDFs to the folder src/integrationTest/resources/documentgenerator/documents/regenerated

Unit tests

To run all unit tests please execute following command:

./gradlew test

Coding style tests

To run all checks (including unit tests) please execute following command:

./gradlew check

Mutation tests

To run all mutation tests execute the following command:

./gradlew pitest

Developing

Flow Diagram

diagram

API documentation

API documentation is provided with Swagger:

  • http://localhost:4007/swagger-ui.html - UI to interact with the API resources

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Standard API

We follow RESTful API standards.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

prl-dgs-api's People

Contributors

alokdatta avatar bharadwajsairam avatar channa-patil avatar cshiwarale avatar dependabot[bot] avatar hcarslaw avatar hmcts-jenkins-cft[bot] avatar hmcts-jenkins-j-to-z[bot] avatar hmcts-shajahan avatar jamescutts00 avatar khurshedk avatar mohitvijay45 avatar mokainos avatar pete-lowe avatar pragnesh-patel3 avatar praneethhm avatar praveenguntoju avatar praveenrach avatar priteshkr avatar priyankahmcts avatar rameshme avatar ravipati89 avatar remya-james avatar sahasonali avatar sahitya-desireddy avatar sairamkantheti1 avatar saravanakumar-palanichamy avatar shashisk97 avatar swaroopa86 avatar yogendrau avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

someshra

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.