Skip to content

web-backend


Class: GraphModelController

Defined in: packages/web-backend/src/graphModels/graphModel.controller.ts:14

Controller for graph model operations and updates. Stores and retrieves graph states for event sequence, fault tree, and event tree diagrams.

Constructors

Constructor

new GraphModelController(graphModelService): GraphModelController

Defined in: packages/web-backend/src/graphModels/graphModel.controller.ts:20

Instantiate the Graph Model controller.

Parameters

graphModelService

GraphModelService

Service for persisting and querying diagram graphs.

Returns

GraphModelController

Methods

createEventTreeGraph()

createEventTreeGraph(data): Promise<boolean>

Defined in: packages/web-backend/src/graphModels/graphModel.controller.ts:44

stores/creates a event tree diagram graph

Parameters

data

Partial<EventTreeGraph>

takes in a partial of a event tree diagram model as well as the eventTreeId, if the id is missing - a new graph document will be created.

Returns

Promise<boolean>

a promise with the newly created graph model


createFaultTreeGraph()

createFaultTreeGraph(data): Promise<boolean>

Defined in: packages/web-backend/src/graphModels/graphModel.controller.ts:29

stores/creates a fault tree diagram graph

Parameters

data

Partial<FaultTreeGraph>

takes in a partial of a fault tree diagram model as well as the faultTreeId, if the id is missing - a new graph document will be created.

Returns

Promise<boolean>

a promise with the newly created graph model


getEventSequenceDiagramGraph()

getEventSequenceDiagramGraph(eventSequenceId): Promise<EventSequenceDiagramGraph>

Defined in: packages/web-backend/src/graphModels/graphModel.controller.ts:58

fetches the event sequence graph model for a particular diagram, based on its id

Parameters

eventSequenceId

string

the id of the event sequence diagram

Returns

Promise<EventSequenceDiagramGraph>

a promise with an object of the event sequence diagram graph


getEventTreeGraph()

getEventTreeGraph(eventTreeId): Promise<EventTreeGraph>

Defined in: packages/web-backend/src/graphModels/graphModel.controller.ts:121

fetches the event tree graph model for a particular diagram, based on its id

Parameters

eventTreeId

string

the id of the event tree diagram

Returns

Promise<EventTreeGraph>

a promise with an object of the event tree diagram graph


getFaultTreeGraph()

getFaultTreeGraph(faultTreeId): Promise<FaultTreeGraph>

Defined in: packages/web-backend/src/graphModels/graphModel.controller.ts:70

fetches the fault tree graph model for a particular diagram, based on its id

Parameters

faultTreeId

string

the id of the fault tree diagram

Returns

Promise<FaultTreeGraph>

a promise with an object of the fault tree diagram graph


updateESNodeLabel()

updateESNodeLabel(id, type, label): Promise<boolean>

Defined in: packages/web-backend/src/graphModels/graphModel.controller.ts:82

Update the label of node/edge of an event sequence diagram

Parameters

id

string

Node/Edge ID

type

string

'node' or 'edge'

label

string

New label for the node/edge

Returns

Promise<boolean>

a promise with boolean confirmation whether update was successful or not


updateESSubgraph()

updateESSubgraph(eventSequenceId, updatedSubgraph, deletedSubgraph): Promise<boolean>

Defined in: packages/web-backend/src/graphModels/graphModel.controller.ts:103

Update parts of an event sequence diagram graph.

Parameters

eventSequenceId

string

The diagram identifier whose graph should be updated.

updatedSubgraph

Partial<BaseGraph>

Nodes/edges to upsert into the graph.

deletedSubgraph

Partial<BaseGraph>

Nodes/edges to remove from the graph.

Returns

Promise<boolean>

true when the update succeeds; otherwise throws.