Skip to content

Latest commit

 

History

History
1670 lines (1300 loc) · 34.2 KB

api.md

File metadata and controls

1670 lines (1300 loc) · 34.2 KB

Course Service API

Table of Contents

Query

Field Argument Type Description
courses CoursePayload!

Get a list of courses. Can be filtered, sorted and paginated. Courses and their basic data can be queried by any user, even if they are not enrolled in the course.

filter CourseFilter
sortBy [String!]

The fields to sort by. Throws an error if no field with the given name exists.

sortDirection [SortDirection!]!

The sort direction for each field. If not specified, defaults to ASC.

pagination Pagination
coursesByIds [Course!]!

Returns the courses with the given ids. Courses and their basic data can be queried by any user, even if they are not enrolled in the course.

ids [UUID!]!
_internal_noauth_chaptersByIds [Chapter!]!

Returns the chapters with the given ids. ⚠️ This query is only accessible internally in the system and allows the caller to retrieve courseMemberships for any user and should not be called without any validation of the caller's permissions. ⚠️

ids [UUID!]!
_internal_noauth_courseMembershipsByUserId [CourseMembership!]!

Returns the list of courseMemberships for the specified user. ⚠️ This query is only accessible internally in the system and allows the caller to retrieve courseMemberships for any user and should not be called without any validation of the caller's permissions. ⚠️

userId UUID!

The id of the user to get the courseMemberships for.

availabilityFilter Boolean
    Filter field to filter for available or unavailable courses.
    If this field is true, only available courses are returned.
    If this field is false, only unavailable courses are returned.
    If this field is null, all courses are returned.

    A course is available if it is published, the start date is in the past and the end date is in the future.,

Mutation

Field Argument Type Description
createCourse Course!

Creates a new course with the given input and returns the created course.

input CreateCourseInput!
createChapter Chapter!

Creates a new chapter with the given input and returns the created chapter. The course id must be a course id of an existing course. 🔒 The user must be an admin in this course to perform this action.

input CreateChapterInput!
updateCourse Course!

Updates an existing course with the given input and returns the updated course. The course id must be a course id of an existing course. 🔒 The user must be an admin in this course to perform this action.

input UpdateCourseInput!
updateChapter Chapter!

Updates an existing chapter with the given input and returns the updated chapter. The chapter id must be a chapter id of an existing chapter. 🔒 The user must be an admin in this course to perform this action.

input UpdateChapterInput!
deleteCourse UUID!

Deletes an existing course, throws an error if no course with the given id exists. 🔒 The user must be an admin in this course to perform this action.

id UUID!
deleteChapter UUID!

Deletes an existing chapter, throws an error if no chapter with the given id exists. 🔒 The user must be an admin in this course to perform this action.

id UUID!
joinCourse CourseMembership!

Lets the current user join a course as a student.

courseId UUID!
leaveCourse CourseMembership!

Lets the current user leave a course. Returns the membership that was deleted.

courseId UUID!
createMembership CourseMembership!

Adds the specified user to the specified course with the specified role. 🔒 The calling user must be an admin in this course to perform this action.

input CourseMembershipInput!
updateMembership CourseMembership!

Updates a user's membership in a course with the given input. 🔒 The calling user must be an admin in this course to perform this action.

input CourseMembershipInput!
deleteMembership CourseMembership!

Removes the specified user's access to the specified course. 🔒 The calling user must be an admin in this course to perform this action.

input CourseMembershipInput!

Objects

Chapter

A chapter is a part of a course.

Field Argument Type Description
id UUID!

UUID of the chapter, generated automatically

title String!

Title of the chapter, maximum length is 255 characters.

description String!

Description of the chapter, maximum length is 3000 characters.

number Int!

Number of the chapter, determines the order of the chapters.

startDate DateTime!

Start date of the chapter, ISO 8601 format.

endDate DateTime!

End date of the chapter, ISO 8601 format.

suggestedStartDate DateTime

Suggested Start date to start the chapter, ISO 8601 format. Must be after Start Date and before the End dates.

suggestedEndDate DateTime

Suggested End date of the chapter, ISO 8601 format. Must be after the Start Dates and before the End dates.

course Course!

The course the chapter belongs to.

ChapterPayload

Return type of the chapters query, contains a list of chapters and pagination info.

Field Argument Type Description
elements [Chapter!]!
pagination PaginationInfo!

Course

Courses are the main entity of the application. They are the top level of the hierarchy and contain chapters.

Field Argument Type Description
id UUID!

UUID of the course. Generated automatically when creating a new course.

title String!

Title of the course. Maximal length is 255 characters, must not be blank.

description String!

Detailed description of the course. Maximal length is 3000 characters.

startDate DateTime!

Start date of the course, ISO 8601 format. Users can only access the course and work on course content after the start date. Must be before the end date.

endDate DateTime!

End date of the course, ISO 8601 format. Users can no longer access the course and work on course content after the end date. Must be after the start date.

published Boolean!

Published state of the course. If the course is published, it is visible to users.

startYear Int

The year in which the term starts.

yearDivision YearDivision

The division of the academic calendar in which the term takes place.

chapters ChapterPayload!

Chapters of the course. Can be filtered and sorted. 🔒 User needs to be enrolled in the course to access this field.

filter ChapterFilter
sortBy [String!]!

The fields to sort by. The default sort order is by chapter number. Throws an error if no field with the given name exists.

sortDirection [SortDirection!]!

The sort direction for each field. If not specified, defaults to ASC.

pagination Pagination
memberships [CourseMembership!]!

Course Memberships of this course. Contains information about which users are members of the course and what role they have in it. 🔒 User needs to be at least an admin of the course to access this field.

CourseMembership

Represents a course membership object of a user. Each user can be a member of set of courses and some users can also own courses

Field Argument Type Description
userId UUID!

Id of the user.

courseId UUID!

Id of the course the user is a member of.

role UserRoleInCourse!

The role of the user in the course.

course Course!

Course of the Course Membership

CoursePayload

Return type for the course query. Contains the course and the pagination info.

Field Argument Type Description
elements [Course!]!
pagination PaginationInfo!

PaginationInfo

Return type for information about paginated results.

Field Argument Type Description
page Int!

The current page number.

size Int!

The number of elements per page.

totalElements Int!

The total number of elements across all pages.

totalPages Int!

The total number of pages.

hasNext Boolean!

Whether there is a next page.

Inputs

ChapterFilter

Field Type Description
title StringFilter
description StringFilter
number IntFilter
startDate DateTimeFilter
endDate DateTimeFilter
suggestedStartDate DateTimeFilter
suggestedEndDate DateTimeFilter
and [ChapterFilter!]
or [ChapterFilter!]
not ChapterFilter

CourseFilter

Input type for filtering courses. All fields are optional. If multiple filters are specified, they are combined with AND (except for the or field).

Field Type Description
title StringFilter
description StringFilter
startDate DateTimeFilter
endDate DateTimeFilter
published Boolean
and [CourseFilter!]
or [CourseFilter!]
not CourseFilter

CourseMembershipInput

Represents a course membership input object of a user.

Field Type Description
userId UUID!

Id of the user.

courseId UUID!

Id of the course the user is a member of.

role UserRoleInCourse!

The role of the user in the course.

CreateChapterInput

Input type for creating chapters.

Field Type Description
title String!

Title of the chapter, maximum length is 255 characters, must not be blank.

description String!

Description of the chapter, maximum length is 3000 characters.

number Int!

Number of the chapter, determines the order of the chapters, must be positive.

startDate DateTime!

Start date of the chapter, ISO 8601 format. Must be before the end date.

endDate DateTime!

End date of the chapter, ISO 8601 format. Must be after the start date.

suggestedStartDate DateTime

Suggested Start date to start the chapter, ISO 8601 format. Must be after Start Date and before the End dates.

suggestedEndDate DateTime

Suggested End date of the chapter, ISO 8601 format. Must be after the Start Dates and before the End dates.

courseId UUID!

ID of the course the chapter belongs to. Must be a UUID of an existing course.

CreateCourseInput

Input type for creating a new course. See also on the course type for detailed field descriptions.

Field Type Description
title String!

Title of the course, max 255 characters, must not be blank.

description String!

Description of the course, max 3000 characters.

startDate DateTime!

Start date of the course, ISO 8601 format. Must be before the end date.

endDate DateTime!

End date of the course, ISO 8601 format. Must be after the start date.

published Boolean!

Published status of the course.

startYear Int

The year in which the term starts.

yearDivision YearDivision

The division of the academic calendar in which the term takes place.

DateTimeFilter

Filter for date values. If multiple filters are specified, they are combined with AND.

Field Type Description
after DateTime

If specified, filters for dates after the specified value.

before DateTime

If specified, filters for dates before the specified value.

IntFilter

Filter for integer values. If multiple filters are specified, they are combined with AND.

Field Type Description
equals Int

An integer value to match exactly.

greaterThan Int

If specified, filters for values greater than to the specified value.

lessThan Int

If specified, filters for values less than to the specified value.

Pagination

Specifies the page size and page number for paginated results.

Field Type Description
page Int!

The page number, starting at 0. If not specified, the default value is 0. For values greater than 0, the page size must be specified. If this value is larger than the number of pages, an empty page is returned.

size Int!

The number of elements per page.

StringFilter

Filter for string values. If multiple filters are specified, they are combined with AND.

Field Type Description
equals String

A string value to match exactly.

contains String

A string value that must be contained in the field that is being filtered.

ignoreCase Boolean!

If true, the filter is case-insensitive.

UpdateChapterInput

Input type for updating chapters. The ID field specifies which chapter should be updated, all other fields specify the new values.

Field Type Description
id UUID!

UUID of the chapter that should be updated.

title String!

Title of the chapter, maximum length is 255 characters, must not be blank.

description String!

Description of the chapter, maximum length is 3000 characters.

number Int!

Number of the chapter, determines the order of the chapters, must be positive.

startDate DateTime!

Start date of the chapter, ISO 8601 format. Must be before the end date.

endDate DateTime!

End date of the chapter, ISO 8601 format. Must be after the start date.

suggestedStartDate DateTime

Suggested Start date to start the chapter, ISO 8601 format. Must be after Start Date and before the End dates.

suggestedEndDate DateTime

Suggested End date of the chapter, ISO 8601 format. Must be after the Start Dates and before the End dates.

UpdateCourseInput

Input type for updating an existing course. See also on the course type for detailed field descriptions. The id specifies the course that should be updated, the other fields specify the new values.

Field Type Description
id UUID!

UUID of the course that should be updated. Must be an id of an existing course, otherwise an error is returned.

title String!

The new title of the course, max 255 characters, must not be blank.

description String!

The new description of the course, max 3000 characters.

startDate DateTime!

The new start date of the course, ISO 8601 format.

endDate DateTime!

The new end date of the course, ISO 8601 format.

published Boolean!

The new published status of the course.

startYear Int

The year in which the term starts.

yearDivision YearDivision

The division of the academic calendar in which the term takes place.

Enums

SortDirection

Specifies the sort direction, either ascending or descending.

Value Description
ASC
DESC

UserRoleInCourse

Enum containing all valid roles a user can have in a course.

Value Description
STUDENT
TUTOR
ADMINISTRATOR

YearDivision

The division of the academic year.

Value Description
FIRST_SEMESTER
SECOND_SEMESTER
FIRST_TRIMESTER
SECOND_TRIMESTER
THIRD_TRIMESTER
FIRST_QUARTER
SECOND_QUARTER
THIRD_QUARTER
FOURTH_QUARTER

Scalars

Boolean

Built-in Boolean

Date

An RFC-3339 compliant Full Date Scalar

DateTime

A slightly refined version of RFC-3339 compliant DateTime Scalar

Int

Built-in Int

LocalTime

24-hour clock time value string in the format hh:mm:ss or hh:mm:ss.sss.

String

Built-in String

Time

An RFC-3339 compliant Full Time Scalar

UUID

A universally unique identifier compliant UUID Scalar

Url

A Url scalar