Training

Model

See schema for more information about the schema.

type Training {
id: UUID!
isActive: Boolean!
title: String!
subtitle: String!
introduction: String!
image: File
startDate: Date @deprecated(reason: "Replaced by the AbsoluteDateCondition")
endDate: Date @deprecated(reason: "Replaced by the AbsoluteDateCondition")
users: [User!]!
groups: [Group!]!
showParticipants: Boolean!
showSharedFiles: Boolean!
enableChat: Boolean!
ref: String
rolesForCurrentUser: [TrainingRole!]
allConditionsFulfilled: Boolean!
conditions: [Condition!]!
nextEvent: DateTime
progress: Float
}

Queries

Get trainings

Get a list of all trainings in your organisation

query trainings {
trainings {
ref
title
}
}

Get training

Get a single training in your organisation. You can use the ref of the training to get it.

query training {
training(ref: "training-ref") {
ref
title
}
}

Mutations

Create training

Create a new training in your organisation, you can pass your own custom ref.

mutation createTraining {
createTraining(training: {ref: "training-ref", title: "Test Training", startDate: "2020-01-01"}) {
training {
ref
title
}
}
}

Update training

Update a training using ref.

mutation updateTraining {
updateTraining(ref: "training-ref", training: {title: "New title"}) {
training {
ref
title
}
}
}

Archive training

To disable a training we can archive it. This can be done via the updateTraining mutation.

mutation updateTraining {
updateTraining(ref: "training-ref", training: {isActive: false}) {
training {
ref
title
isActive
}
}
}

Add users to training

You can add multiple users to a training by using refs.

Possible roles you can pass: PARTICIPANT, TRAINER, MENTOR

Note: This action isn't done instant, so it can take a few minutes to be done

mutation addUsersToTraining {
addUsersToTraining(role: PARTICIPANT, sendInvites: true, trainingRef: "training-ref", userRefs: ["user-ref", "user-2-ref"]) {
addedRefs # Refs of users that are added
alreadyAddedRefs # Refs of users that are already in the training
failedRefs # Refs of users that are incorrect
}
}

Remove users from training

You can add remove users from a training by using refs.

Possible roles you can pass: PARTICIPANT, TRAINER, MENTOR

Note: This action isn't done instant, so it can take a few minutes to be done

mutation removeUsersFromTraining {
removeUsersFromTraining(role: PARTICIPANT, trainingRef: "training-ref", userRefs: ["user-ref", "user-2-ref"]) {
removedRefs # Refs of users that are removed
alreadyRemovedRefs # Refs of users that are not in the training
failedRefs # Refs of users that are incorrect
}
}