Pluvo Developers Docs


Code Docs


Back to website: www.pluvo.com

Request training Model

<aside> 💡 See  schema for more information about the schema.

</aside>

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 organization.

query paginatedTrainings {
    paginatedTrainings {
        edges {
            node {
                ref
                title
            }
        }
    }
}

Get training

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

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

Get trainings for user

Get a list of all trainings for a specific userId in your organisation. Only managers, planner or group manager can view this information. You can filter on trainingUserRoles to only get trainings where the user has a specific role (PARTICIPANTTRAINER or MENTOR).

query paginatedTrainings {
    paginatedTrainings(userId: "00000000-0000-0000-0000-000000000000", trainingUserRoles: [PARTICIPANT]) {
        edges {
            node {
                ref
                title
                userData {
                    progress
                }
            }
        }
    }
}

Mutations

Create training

Create a new training in your organization, 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: PARTICIPANTTRAINERMENTOR

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: PARTICIPANTTRAINERMENTOR

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
  }
}