Service to create, update, and retrieve course information.
- Source:
Methods
(static) create(courseToAdd) → {Promise.<(CourseDTO|null)>}
Create a course with the provided data.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
courseToAdd |
*
|
The course data to be added. |
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<(CourseDTO|null)>
A promise that resolves to a new CourseDTO instance representing the created course, or null if creation fails.
(static) delete(courseId) → {Promise.<boolean>}
Delete course with the provided ID.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
courseId |
*
|
The ID of the course to delete. |
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<boolean>
- A promise that resolves to true if the course was successfully deleted, or false otherwise.
(static) getAll(offset, limit) → {Promise.<{dates: Array.<CourseDateDTO>, count: number}>}
Retrieve a paginated list of course-date.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
offset |
number
|
The number of items to skip before starting to return results. |
limit |
number
|
The maximum number of items to return. |
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<{dates: Array.<CourseDateDTO>, count: number}>
- A promise that resolves to an object containing an array of CourseDateDTO objects representing the retrieved course-date and the total count of course-dates.
(static) getAll(offset, limit) → {Promise.<{students: Array.<CourseDTO>, count: number}>}
Retrieve a paginated list of course.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
offset |
number
|
The number of items to skip before starting to return results. |
limit |
number
|
The maximum number of items to return. |
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<{students: Array.<CourseDTO>, count: number}>
- A promise that resolves to an object containing an array of CourseDateDTO objects representing the course-date and the total count of teachers.
(static) getById(id) → {Promise.<(CourseDTO|null)>}
Retrieve the course details with the provided ID.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
id |
*
|
The ID of the course to retrieve. |
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<(CourseDTO|null)>
A promise that resolves to a CourseDTO instance representing the retrieved course, or null if the course is not found.
(static) getDates(courseId) → {Promise.<any>}
Returns an array of dates on which a course is scheduled.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
courseId |
string
|
The ID of the course to retrieve the schedule for. |
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<any>
(static) getMaterials(courseId) → {Promise.<CourseDTO>}
Retrieve a list of material for a course.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
courseId |
*
|
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<CourseDTO>
(static) search(terms, offset, limit) → {Promise.<Array.<CourseDTO>>}
Search for courses based on the provided search terms.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
terms |
*
|
The search terms to match against training name. |
offset |
number
|
The number of items to skip before starting to return results. |
limit |
number
|
The maximum number of items to return. |
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<Array.<CourseDTO>>
A promise that resolves to an array of CourseDTO objects matching the search terms.
(static) update(id, courseDTO) → {Promise.<boolean>}
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
id |
*
|
The ID of the course to update |
courseDTO |
*
|
The detail of the course to update |
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<boolean>
- A promise that resolves to true if the course was successfully deleted, or false otherwise.