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 (
Foo
from now on) to theItemType
enum. - Create its class named
TemplateFooItem
, inherit fromTemplateItem
and add the new specific (if has) properties. - Create another class named
InspectionFooItem
that is basically the clone ofTemplateFooItem
and inherit fromInspectionItem
. - We need to add the corresponding
Visit
method for the new Item in theIBaseNodeVisitor
interface, 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
CreationInspectionMessage
interface, namedFooItemInspectionCreation
and inherit fromItemInspectionCreation
. In that record add the properties that should be mapped to the Inspection counterpart. - We need to add another
Visit
method in theIInspectionCreationVisitor
interface, 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
ItemInspectionCreationJsonConverter
class, 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
FooItemGrade
and inherit fromItemGrade
. - Create the DTOs and its mappings.
- Go to
Application.Contracts.DataTransfer.V1.ItemGrade.Serialization
folder and create a class namedFooItemGradeData
and inherit fromItemGradeData
. The generic is the type of the Grade, for example:string
is the grade type ofTextItem
andIEnumerable<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
Visit
method in theIGradeDataVisitor
interface, 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
ItemGradeJsonConverter
class. For example: