Add a role (processing step)
The official role (processing step) is a piece of part b flow. Actually you can think of part b as a collection of processing steps.
Every processing step is associated with at least one service. Each processing step has its own application (a directory in
While the system is configured to support any type of official application / processing step there are some predefined types supported by the generator. The name of the generated app determines the template used. Use the following convention to get a specific type of app:
official-revision- will generate application tailored for revision of business processes. Use
official-revision-*to use this template for multiple revisions (for example for different services).
official-front-desk- generates front desk (single window) applications. Also supports
official-*- generic type of official application / processing step.
Processing steps models are defined for a given service. There is a good reference point available which shows how a processing step is configured.
I will reference it in the steps below:
- At the root of your project type:
node node_modules/eregistrations/bin/generate-app official-<your-step-name>(be sure not to make a typo, especially in “official”). This will create most of the files needed by your step. You can check here to see what files should be created at this point: (A) Official Processing app & role.
- Open file
- Add new role; one entry in
db.Role.meta.get('official<YourStepName>').label. You can see how it’s done here.
- Create a file
- Define a model for a step in the file you created. You can check an example here. If generating a revision type of app use RevisionProcessingStep as base type. For front desk, use FrontDeskProcessingStep.
- Setup paths for meta and map file. See here for reference.
- Ensure binding with Demo service. See here for reference.
- Register controllers for your app. See here for reference.
- Your processing step will most likely have a form, which needs to be filled and submitted. So we need to configure it (provide controller, view, and form section definition). See here for reference.
- Some processing steps need to add status-log entries. See here for how-to configure such status-log
Most of the processing steps are, by default, used in the flow for the associated services. Sometimes, however, we want the processing step to be in the flow conditionally.
We call such condition “applicability condition” and we express it in the
isApplicable property of the step. The
isApplicable is a boolean getter.
The processing step is taking part in the given file’s flow only if its
In the branch “add-a-role-processing-step” of eregistrations-demo :
Add a new processing step.
- The step will be called “Social Security”.
- The step should be included in the part b flow after
- The step has a form with two fields which needs to be filled before approval of the step is possible.
- The fields of the form are:
isSealConfirmed(Boolean, required, label: “Are the seals of the certificates confirmed?”).
sealDate(DateType, required, label: “What is the date of sealing the last certificate?”).
- The form will be created via section (
FormSectionlabeled “Seals confirmation”).
- The sections form will be submitted under this route:
- The fields of the form are:
- After the form is completed (sections
statusequals 1), the “Approve” button appears.
- When the button is clicked the step becomes approved.
- After the step is approved a status log entry should be added and the flow will proceed to
- The status log entry will be triggered only once (after the step is approved).
- The status log entry will have the label “Social Security” and the following text: “Approved by social security”.