diff --git a/doc/source/architecture.rst b/doc/source/architecture.rst index a3300b242..184fdfc7d 100644 --- a/doc/source/architecture.rst +++ b/doc/source/architecture.rst @@ -210,6 +210,14 @@ view (Goals, Audits, Action Plans, ...): .. image:: ./images/functional_data_model.svg :width: 100% +Here below is a class diagram representing the main objects in Watcher from a +database perspective: + +.. image:: ./images/watcher_class_diagram.png + :width: 100% + + + .. _sequence_diagrams: Sequence diagrams diff --git a/doc/source/image_src/plantuml/watcher_class_diagram.txt b/doc/source/image_src/plantuml/watcher_class_diagram.txt new file mode 100644 index 000000000..3a1e801a7 --- /dev/null +++ b/doc/source/image_src/plantuml/watcher_class_diagram.txt @@ -0,0 +1,87 @@ +@startuml + +abstract class Base { + // Timestamp mixin + DateTime created_at + DateTime updated_at + + // Soft Delete mixin + DateTime deleted_at + Integer deleted // default = 0 +} + +class Strategy { + **Integer id** // primary_key + String uuid // length = 36 + String name // length = 63, nullable = false + String display_name // length = 63, nullable = false + Integer goal_id // ForeignKey('goals.id'), nullable = false +} + + +class Goal { + **Integer id** // primary_key + String uuid // length = 36 + String name // length = 63, nullable = false + String display_name // length = 63, nullable=False +} + + +class AuditTemplate { + **Integer id** // primary_key + String uuid // length = 36 + String name // length = 63, nullable = true + String description // length = 255, nullable = true + Integer host_aggregate // nullable = true + Integer goal_id // ForeignKey('goals.id'), nullable = false + Integer strategy_id // ForeignKey('strategies.id'), nullable = true + JsonString extra + String version // length = 15, nullable = true +} + + +class Audit { + **Integer id** // primary_key + String uuid // length = 36 + String type // length = 20 + String state // length = 20, nullable = true + DateTime deadline // nullable = true + Integer audit_template_id // ForeignKey('audit_templates.id') \ +nullable = false +} + + +class Action { + **Integer id** // primary_key + String uuid // length = 36, nullable = false + Integer action_plan_id // ForeignKey('action_plans.id'), nullable = false + String action_type // length = 255, nullable = false + JsonString input_parameters // nullable = true + String state // length = 20, nullable = true + String next // length = 36, nullable = true +} + + +class ActionPlan { + **Integer id** // primary_key + String uuid // length = 36 + Integer first_action_id // + Integer audit_id // ForeignKey('audits.id'), nullable = true + String state // length = 20, nullable = true +} + +"Base" <|-- "Strategy" +"Base" <|-- "Goal" +"Base" <|-- "AuditTemplate" +"Base" <|-- "Audit" +"Base" <|-- "Action" +"Base" <|-- "ActionPlan" + + "Goal" <.. "Strategy" : Foreign Key + "Goal" <.. "AuditTemplate" : Foreign Key + "Strategy" <.. "AuditTemplate" : Foreign Key + "AuditTemplate" <.. "Audit" : Foreign Key + "ActionPlan" <.. "Action" : Foreign Key + "Audit" <.. "ActionPlan" : Foreign Key + +@enduml diff --git a/doc/source/images/watcher_class_diagram.png b/doc/source/images/watcher_class_diagram.png new file mode 100644 index 000000000..95bb7feb7 Binary files /dev/null and b/doc/source/images/watcher_class_diagram.png differ