Adding Item Types¶
In this section we will explain the steps to add a new Item Type in the Suite Inspections service.
Template and Inspection¶
- Add the Item name (Foofrom now on) to theItemTypeenum.
- Create its class named TemplateFooItem, inherit fromTemplateItemand add the new specific (if has) properties.
- Create another class named InspectionFooItemthat is basically the clone ofTemplateFooItemand inherit fromInspectionItem.
- We need to add the corresponding Visitmethod for the new Item in theIBaseNodeVisitorinterface, for example:
| C# | |
|---|---|
Important
Create the implementation in the InspectionCreationDataBuilderVisitor class.
You can check the already done implementations to have an idea on
how to do it.
- Add a new record in the CreationInspectionMessageinterface, namedFooItemInspectionCreationand inherit fromItemInspectionCreation. In that record add the properties that should be mapped to the Inspection counterpart.
- We need to add another Visitmethod in theIInspectionCreationVisitorinterface, for example:
| C# | |
|---|---|
Important
Create the implementation in the InspectionCreationVisitor class.
You can check the already done implementations to have an idea on
how to do it.
- Add a new entry to the dictionary in the
    ItemInspectionCreationJsonConverterclass, for example:
| C# | |
|---|---|
- 
Add the Visit for the Template Item Creation Visitor : TBD. 
- 
Create the DTOs and its mappings. 
Grading¶
- Create the class for grading, named FooItemGradeand inherit fromItemGrade.
- Create the DTOs and its mappings.
- Go to Application.Contracts.DataTransfer.V1.ItemGrade.Serializationfolder and create a class namedFooItemGradeDataand inherit fromItemGradeData. The generic is the type of the Grade, for example:stringis the grade type ofTextItemandIEnumerable<ResponseDto>forQuestionItem.
Note
In this abstraction layer we are using the Dto version of the grade entity.
For example: IEnumerable<ResponseDto> for QuestionItem.
- We need to add another Visitmethod in theIGradeDataVisitorinterface, for example:
| C# | |
|---|---|
Important
Create the implementation in the GradingVisitor class.
You can check the already done implementations to have an idea on
how to do it. In this visitor we have DI available
if we need to inject something, a repository for example.
- Add a new entry to the dictionary in the ItemGradeJsonConverterclass. For example: