Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

EMDRIA PathLMS GraphQL Query Request

The goal of this document is to articulate and spec out a GraphQL query that would allow a GraphQL query to:

  1. Get a list of all of the certificates awarded for a course or list of courses
  2. Allow query filtering by startDate and endDate which would only show certificates granted between those two dates
  3. Allow query filtering by userIds to limit the returned certificates to only those awarded to those specific users

GraphQL Query Schema

The proposed schema is very similar to the existing CourseUserVisits query, but instead of returning CourseUsers based on visit count, the new CourserUserCertificates query would return certificates filtered by startDate, endDate, and userIds for all courses or the courses specified in the courseIds argument.

{
	"name": "courseCertificates",
	"description": "This query will get back course user certificates data for specfied courses.",
	"args": [
		{
			"name": "courseIds",
			"description": null,
			"type": {
				"kind": "LIST",
				"name": null,
				"ofType": {
					"kind": "NON_NULL",
					"name": null,
					"ofType": {
						"kind": "SCALAR",
						"name": "Int",
						"ofType": null
					}
				}
			},
			"defaultValue": null
		},
		{
			"name": "limit",
			"description": null,
			"type": {
				"kind": "SCALAR",
				"name": "Int",
				"ofType": null
			},
			"defaultValue": null
		},
		{
			"name": "offset",
			"description": null,
			"type": {
				"kind": "SCALAR",
				"name": "Int",
				"ofType": null
			},
			"defaultValue": null
		}
	],
	"fields": [
		{
			"name": "id",
			"description": null,
			"args": [],
			"type": {
				"kind": "NON_NULL",
				"name": null,
				"ofType": {
					"kind": "SCALAR",
					"name": "ID",
					"ofType": null
				}
			},
			"isDeprecated": false,
			"deprecationReason": null
		},
		{
			"name": "courseId",
			"description": null,
			"args": [],
			"type": {
				"kind": "NON_NULL",
				"name": null,
				"ofType": {
					"kind": "SCALAR",
					"name": "Int",
					"ofType": null
				}
			},
			"isDeprecated": false,
			"deprecationReason": null
		},
		{
			"name": "certificates",
			"description": "A list of the course granted certificated",
			"args": [
				{
					"name": "userIds",
					"description": null,
					"type": {
						"kind": "LIST",
						"name": null,
						"ofType": {
							"kind": "NON_NULL",
							"name": null,
							"ofType": {
								"kind": "SCALAR",
								"name": "Int",
								"ofType": null
							}
						}
					},
					"defaultValue": null
				},
				{
					"name": "uid",
					"description": null,
					"type": {
						"kind": "SCALAR",
						"name": "String",
						"ofType": null
					},
					"defaultValue": null
				},
				{
					"name": "startDate",
					"description": null,
					"type": {
						"kind": "SCALAR",
						"name": "Date",
						"ofType": null
					},
					"defaultValue": null
				},
				{
					"name": "endDate",
					"description": null,
					"type": {
						"kind": "SCALAR",
						"name": "Date",
						"ofType": null
					},
					"defaultValue": null
				},
				{
					"name": "limit",
					"description": null,
					"type": {
						"kind": "SCALAR",
						"name": "Int",
						"ofType": null
					},
					"defaultValue": null
				},
				{
					"name": "offset",
					"description": null,
					"type": {
						"kind": "SCALAR",
						"name": "Int",
						"ofType": null
					},
					"defaultValue": null
				}
			],
			"type": {
				"kind": "LIST",
				"name": null,
				"ofType": {
					"kind": "OBJECT",
					"name": "UserCertificate",
					"ofType": null
				}
			}
		}
	],
	"isDeprecated": false,
	"deprecationReason": null
}

Sample Queries

Below is an example of the three queries that would accomplish the above 3 objectives.

All three examples would use the same query, but with a different set of variable values:

query CourseCertificates(
	$courseIds: [Int],
	$limit: Int,
	$offset: Int,
	$startDate: Date,
	$endDate: Date,
	$userIds: [Int]
) {
  courseCertificates(
	courseIds: $courseIds,
	limit: $limit,
	offset: $offset
  ) {
    courseId
    certificates(
		userIds: $userIds,
		startDate: $startDate,
		endDate: $endDate
	) {
      awardedAt
	  userId
    }
  }
}

List of all Certificates awarded for a list of courses

Omitting all values other than courseIds would return the certificates for all of the courses.

{
	"limit": null,
	"offset": null,
	"courseIds": [555555],
	"startDate": null,
	"endDate": null
}

List of all Certificates awarded in a certain date range

Setting the startDate and endDate would filter the certificates to only show those that have an awardedAt date between the two date values.

{
	"limit": null,
	"offset": null,
	"courseIds": [555555],
	"startDate": "2025-12-18",
	"endDate": "2025-12-17"
}

List of all Certificates awarded to particular users

Settings the userIds value would allow for the certificates to be filter only to users with matching userIds in the courses matching the coursesIds.

{
	"limit": null,
	"offset": null,
	"courseIds": [555555],
	"userIds": [10000021]
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors