AssignmentStoreMixin

Properties

3

Class hierarchy

isAssignmentStoreMixin: Boolean= truereadonly
Identifies an object as an instance of AssignmentStoreMixin class, or subclass thereof.
isAssignmentStoreMixin: Boolean= truereadonlystatic
Identifies an object as an instance of AssignmentStoreMixin class, or subclass thereof.

Records

Applies a new dataset to the AssignmentStore. Use it to plug externally fetched data into the store.

NOTE: References (assignments, resources) on the assignments are determined async by a calculation engine. Thus they cannot be directly accessed after assigning the new dataset.

For example:

assignmentStore.data = [{ eventId, resourceId }];
// assignmentStore.first.event is not yet available

To guarantee references are available, wait for calculations for finish:

assignmentStore.data = [{ eventId, resourceId  }];
await assignmentStore.project.commitAsync();
// assignmentStore.first.event is available

Alternatively use loadDataAsync() instead:

await assignmentStore.loadDataAsync([{ eventId, resourceId }]);
// assignmentStore.first.event is available

Functions

14

Assign

Creates and adds assignment record(s) for a given event and resource(s).

ParameterTypeDescription
eventTimeSpan
resourcesResourceModel | ResourceModel[]

The resource(s) to assign to the event

assignmentSetupFnfunction

A hook function which takes an assignment as its argument and must return an assignment.

removeExistingAssignmentsBoolean

true to remove assignments for other resources

Returns: AssignmentModel[] -

An array with the created assignment(s)

Removes assignment record for a given event and resource.

ParameterTypeDescription
eventTimeSpan | String | Number
resourcesResourceModel | String | Number

The resource to unassign the event from. If omitted, all resources of the events will be unassigned

Assignments

Returns an assignment record for a given event and resource

ParameterTypeDescription
eventEventModel | String | Number

The event or its id

resourceResourceModel | String | Number

The resource or its id

Returns all assignments for a given resource.

ParameterTypeDescription
resourceResourceModel
Returns: AssignmentModel[]

Returns all events assigned to a resource

ParameterTypeDescription
resourceResourceModel | String | Number
Returns: TimeSpan[]

Returns all resources assigned to an event.

ParameterTypeDescription
eventEventModel
Returns: ResourceModel[]

Checks whether an event is assigned to a resource.

ParameterTypeDescription
eventEventModel | String | Number

Event record or id

resourceResourceModel | String | Number

Resource record or id

Returns: Boolean

Maps over event assignments.

ParameterTypeDescription
eventEventModel
fnfunction
filterFnfunction
Returns: EventModel[] | Array

Maps over resource assignments.

ParameterTypeDescription
resourceResourceModel | Number | String
fnfunction
filterFnfunction
Returns: ResourceModel[] | Array

Removes all assignments for given event

ParameterTypeDescription
eventTimeSpan

Removes all assignments for given resource

ParameterTypeDescription
resourceResourceModel | *

CRUD

Add assignments to the store.

NOTE: References (event, resource) on the assignments are determined async by a calculation engine. Thus they cannot be directly accessed after using this function.

For example:

const [assignment] = assignmentStore.add({ eventId, resourceId });
// assignment.event is not yet available

To guarantee references are set up, wait for calculations for finish:

const [assignment] = assignmentStore.add({ eventId, resourceId });
await assignmentStore.project.commitAsync();
// assignment.event is available (assuming EventStore is loaded and so on)

Alternatively use addAsync() instead:

const [assignment] = await assignmentStore.addAsync({ eventId, resourceId });
// assignment.event is available (assuming EventStore is loaded and so on)
ParameterTypeDescription
recordsAssignmentModel | AssignmentModel[] | AssignmentModelConfig | AssignmentModelConfig[]

Array of records/data or a single record/data to add to store

silentBoolean

Specify true to suppress events

Returns: AssignmentModel[] -

Added records

Add assignments to the store and triggers calculations directly after. Await this function to have up to date references on the added assignments.

const [assignment] = await assignmentStore.addAsync({ eventId, resourceId });
// assignment.event is available (assuming EventStore is loaded and so on)
ParameterTypeDescription
recordsAssignmentModel | AssignmentModel[] | AssignmentModelConfig | AssignmentModelConfig[]

Array of records/data or a single record/data to add to store

silentBoolean

Specify true to suppress events

Returns: AssignmentModel[] -

Added records

Applies a new dataset to the AssignmentStore and triggers calculations directly after. Use it to plug externally fetched data into the store.

await assignmentStore.loadDataAsync([{ eventId, resourceId }]);
// assignmentStore.first.event is available
ParameterTypeDescription
dataAssignmentModelConfig[]

Array of AssignmentModel data objects