Service to create, update, and retrieve teacher information.
- Source:
Methods
(static) delete(id) → {Promise.<boolean>}
Deletes teacher with the provided ID.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
id |
*
|
The ID of the teacher 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 teacher was successfully deleted, or false otherwise.
(static) getAll(offset, limit) → {Promise.<{teachers: Array.<TeacherDTO>, count: number}>}
Retrieves a paginated list of teachers.
- 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 retrieval operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<{teachers: Array.<TeacherDTO>, count: number}>
- A promise that resolves to an object containing an array of TeacherDTO objects representing the teachers and the total count of teachers.
(static) getById(id) → {Promise.<(TeacherDTO|null)>}
Retrieves teacher details by their ID.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
id |
*
|
The ID of the teacher to retrieve. |
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<(TeacherDTO|null)>
- A promise that resolves to a TeacherDTO object representing the teacher if found, or null if not found.
(static) search(terms) → {Promise.<Array.<TeacherDTO>>}
Searches for teachers based on the provided search terms.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
terms |
*
|
The search terms to match against teacher first names, last names. |
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<Array.<TeacherDTO>>
A promise that resolves to an array of Teacher objects matching the search terms.
(static) update(id, teacherToUpdate) → {Promise.<boolean>}
Update a teacher with the provided data.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
id |
*
|
The ID of the teacher to update. |
teacherToUpdate |
*
|
The updated data for the teacher. |
Throws:
-
- If the operation fails or encounters an error.
- Type
-
Error
Returns:
- Type:
-
Promise.<boolean>
- A promise that resolves to true if the teacher was successfully updated, or false otherwise.