Skip to content

web-backend


Class: InitiatingEventsService ​

Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/initiating-events.service.ts:15

Service for Initiating Event nested models. Supports listing, single retrieval, creation and label updates.

Constructors ​

Constructor ​

new InitiatingEventsService(initiatingEventModel, nestedModelService, nestedModelHelperService): InitiatingEventsService

Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/initiating-events.service.ts:22

Construct the service with persistence and helper dependencies.

Parameters ​

initiatingEventModel ​

Model<InitiatingEventDocument>

Mongoose model for InitiatingEvent collection

nestedModelService ​

NestedModelService

Service to allocate IDs and shared nested model ops

nestedModelHelperService ​

NestedModelHelperService

Helper to link/unlink nested models to typed models

Returns ​

InitiatingEventsService

Methods ​

createInitiatingEvent() ​

createInitiatingEvent(body, typedModel): Promise<NestedModel>

Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/initiating-events.service.ts:72

creates the type of nested model defined in the function name

Parameters ​

body ​

Partial<NestedModel>

a nested model, that needs to contain its parent id (easier to grab on frontend with getCurrentModel) and a label object with a name string and optional description string

typedModel ​

TypedModelType

is the typed model to be updated

Returns ​

Promise<NestedModel>

a promise with a nested model in it, which contains the basic data all the nested models have


deleteInitiatingEvent() ​

deleteInitiatingEvent(modelId, typedModel): Promise<void>

Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/initiating-events.service.ts:103

finds and deletes the nested model in this collection with the give model id

Parameters ​

modelId ​

string

the id of the model we want to delete

typedModel ​

TypedModelType

is the typed model that this nested model belongs to

Returns ​

Promise<void>

a promise with the deleted model


getInitiatingEvents() ​

getInitiatingEvents(parentId): Promise<InitiatingEvent[]>

Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/initiating-events.service.ts:34

gets the collection of the nested model as defined by the function name (bayesian estimations, etc.)

Parameters ​

parentId ​

number

id of the parent model the nested model is number

Returns ​

Promise<InitiatingEvent[]>

a promise with an array of the nested model of the type in the function name


getInitiatingEventsString() ​

getInitiatingEventsString(parentId): Promise<InitiatingEvent[]>

Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/initiating-events.service.ts:43

Retrieves Initiating Events by parent id (string form).

Parameters ​

parentId ​

string

Parent identifier as a string (ObjectId)

Returns ​

Promise<InitiatingEvent[]>

Array of Initiating Event documents for the given parent


getSingleInitiatingEvent() ​

getSingleInitiatingEvent(modelId): Promise<InitiatingEvent>

Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/initiating-events.service.ts:52

gets a single model from the collection based on the id

Parameters ​

modelId ​

number

the id of the model to be retrieved

Returns ​

Promise<InitiatingEvent>

the model which has the associated id


getSingleInitiatingEventString() ​

getSingleInitiatingEventString(modelId): Promise<InitiatingEvent>

Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/initiating-events.service.ts:61

Retrieves a single Initiating Event by string id.

Parameters ​

modelId ​

string

Document _id as a string (ObjectId)

Returns ​

Promise<InitiatingEvent>

The matching Initiating Event document


updateInitiatingEventLabel() ​

updateInitiatingEventLabel(id, body): Promise<NestedModel>

Defined in: packages/web-backend/src/nestedModels/NestedModelsHelpers/initiating-events.service.ts:93

updates the label in the nested model

Parameters ​

id ​

string

the id of the nested model to be updated

body ​

Label

a label with a name and description

Returns ​

Promise<NestedModel>

a promise with the updated model with an updated label