GithubHelp home page GithubHelp logo

digitalstate / services Goto Github PK

View Code? Open in Web Editor NEW
13.0 7.0 5.0 10.67 MB

The DigitalState Services Microservice

License: MIT License

PHP 34.46% Shell 0.21% Gherkin 65.12% Smarty 0.21%
api-platform php symfony docker microservice formio camunda

services's Introduction

services's People

Contributors

marioprudhomme avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

services's Issues

Add API Scenario Type

Api scenario type allows the detailing of a API and link(s) to API endpoints.

Example Usage:

  1. Garbage Pickup Schedule Service: Has a Widget to allow a user to look it up quickly, but there is also a public API that developers can use to connect their apps to and provide garbage look up abilities.

Add Life Events Entity

The Life Events Entity is similar to Services and Service Scenarios.

Life Events have a Title, Description and Presentation.

Life Events have a list of Related Services.

Camunda Function as a Service Endpoints

Ability to call Functions as a service that active a camunda process.

Todos:

  • create FaaS in core
  • POST capability
  • GET capablity
  • Docs
  • Permissions
  • Function Entity
  • Camunda /start for ID and Key

Design Notes

  1. Support POST (GET with a body is not supported by all http clients.)
  2. Body should be transformed into Camunda Variables. Use same format as Camunda Variables object
  3. Camunda variablesInReturn property should configure the returned API response
    1. Body
    2. Status Code
    3. headers
  4. Ability to call a BPMN based on key and based on ID. This configuration should be in the Service Type configuration. You should not be able to call any process you wish. Only processes that are exposed as a FaaS.
  5. BU owner of a FaaS service will be what controls the security access.

Use Cases

  1. First use case will be the ability for Formio forms to make requests to FaaS service for server side validations. Look into whether this should be a function call that is activated by Formio or by the Service Microservice.

Endpoint Examples:

POST /faas/key/:key
POST /faas/id/:id

{
  "varName1": {"value":"the Value 1", "type":"String"},
  "varName2": {"value":true, "type":"Boolean"}
}

Endpoint Styles

  1. faas
  2. func
  3. function
  4. camunda

Response handling

  1. When Camunda throws an error: If Camunda returns a error then it should be logged and the FaaS API returns a internal server error 500 response.
  2. Camunda will return the following:
    1. body
    2. status_code
    3. Headers? (json object?)

FaaS service type will convert this into a proper response.

All processing should be optimized for speed over elegance. Speed of response is priority.

If Camunda does not return the proper variables that Services Microservice will return a Internal Error


Considerations

  1. How should multiple validations be returned?
    1. body will have array of "errors" will be returned and be the list of errors.
  2. When complex logging should occur about errors, have the logging occur async after the response has been returned
  3. The Service MS will have to parse stringified json objects into proper json.
  4. question: should there be a debug mode (activated through query param) that returns full variable data / the raw response from Camunda?
  5. Status codes will have to be converted to proper format.

Samples

Variables in Camunda process:

response_body = [] or = {} (is valid JSON)
response_headers = [{"key": "value"}]
response_status_code = integer

For multiple errors:

The response_body would be a SPIN Json array, and each error would append to the array.
For single error response scenarios, the json could return any style defined in the bpmn.

If Function/Process cannot be found then Function not found error response is returned


All other variables that would be returned by Camunda would be ignored.


Data Flow

  1. Validations should occur:
    1. Before Form Load,
    2. Before Form Submit or
    3. After Formio Validations.

This should occur as part of a configuration of the BPM Service.

  1. Only Next step is continued if proper status code is returned

example of Usage for:

Before Form Load:

  1. Check if user is currently to load this form

Before Form Submit:

  1. The user can see the form, but are they allowed to submit the form regardless of formio validations

After Formio Validation:

  1. Validate specific data in the form using server side validations beyond that of Formio

Before Form Load, Before Form Submit and After Formio Validation configurations should allow multiple processes to be called. and support weight/order to which they are called. OR at least allow all three options to be implemented. So that a single service can have a Before Load, Before Submit and After Formio processes.

Safe Delete

When we delete a service, the field DeleteAt is filled, but in the API, the result always appears

Formio Error Handling

  1. Formio is offline
  2. Formio throws an error (error that is not a normal/expected error)
  3. Formio cannot submit

Unable to add new scenarios (probably due to translation updates)

Error:

"detail": "service.title: This value should not be blank.\nservice.description: This value should not be blank.\nservice.presentation: This value should not be blank.\nslug: This value should not be blank.",

This occurs whether POSTing values in single or multiple languages.

Add Data field into Services Get List - ACL issue

The current ACL does not expose the Service's Data field in the Get List for individual.

This is causing an issue were the icons cannot be set for a service based on the icon property in the Date column.

Add hierarchical categories

Add the ability to have hierarchical categories.

Should allow filtering based on the children

Example:

->Departments:
--->Public Works:
---|--->Roads:
---|---|--->Line Painting

Add "Assistant" service type

The assistant service type is link and information about assistant usage.

A assistant is Google Home, Siri, Amazon Alexa, etc.

Add default value for the new weight property.

The following error is thrown when attempting to create a new Service.
The same is probably the case with other entities.

{@context: "/app_dev.php/contexts/ConstraintViolationList", @type: "ConstraintViolationList",…}
@context
:
"/app_dev.php/contexts/ConstraintViolationList"
@type
:
"ConstraintViolationList"
hydra:description
:
"weight: This value should not be blank."
hydra:title
:
"An error occurred"
violations
:
[{propertyPath: "weight", message: "This value should not be blank."}]

Error occurs when creating new Submissions

Tested the Postman example with body:

{
	"scenario": "/scenarios/{SCENARIO_UUID}",
	"data": { 
		"test": "test" 
	},
	"version": 1
}

Error:

{
    "type": "https://tools.ietf.org/html/rfc2616#section-10",
    "title": "An error occurred",
    "detail": "",
    "violations": []
}

Add Channel field to Service Scenarios

Add Channel field to Service Scenarios.

Channels can be a string for now.

  • Exposed Channels in the Services Listing. When GET services each returned service should indicate what Channels are available.
  • Enable Services to be filtered by Channels

Error when saving an entity in a single language

PUT {{services}}{{environment}}/services/9ed44d24-b2e1-4882-82f9-7e4c2c8bf73d

Request body:

{
  "owner": "BusinessUnit",
  "ownerUuid": "8454c987-cbc5-4a24-ba1a-d420283caabd",
  "slug": "report-pothole",
  "title": {
    "fr": "Signaler un nids de poule"
  },
  "description": {
    "fr": "foobar"
  },
  "presentation": {
    "fr": "Presentation ..."
  },
  "data": {
    "fr": []
  },
  "enabled": true,
  "weight": 1,
  "version": 2
}

Resulting error:

{
    "type": "https://tools.ietf.org/html/rfc2616#section-10",
    "title": "An error occurred",
    "detail": "title[en]: This value should not be blank.\ndescription[en]: This value should not be blank.\npresentation[en]: This value should not be blank.",
    "violations": [
        {
            "propertyPath": "title[en]",
            "message": "This value should not be blank."
        },
        {
            "propertyPath": "description[en]",
            "message": "This value should not be blank."
        },
        {
            "propertyPath": "presentation[en]",
            "message": "This value should not be blank."
        }
    ]
}

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.