Controller module providing logic for managing Reset Token entries
- Source:
Example
import { resetTokens as resetTokensController } from '/src/controllers';
Methods
(async, static) createOne(request, response, next)
Create a reset token record.
Parameters:
| Name | Type | Description |
|---|---|---|
request |
Object | HTTP request object |
response |
Object | HTTP response object callback |
next |
Object | Call the next route handler |
Throws:
-
- Will throw an error if no request.body is present
-
- Will throw an error if no request.body.email is present
Returns:
- A http response body
(async, static) destroyExpired(request, response, next)
Will destroy reset tokens that are past now.
Parameters:
| Name | Type | Description |
|---|---|---|
request |
Object | HTTP request object. |
response |
Object | HTTP response object callback. |
next |
Object | Next route callback handler. |
Throws:
Will throw an error if no destroyedCount created.
Returns:
Will return a http response body.
(async, static) destroyOne(request, response, next) → {Object}
Destroy reset token record with primary key id
Parameters:
| Name | Type | Description |
|---|---|---|
request |
Object | HTTP request object. |
response |
Object | HTTP response object callback. |
next |
Object | Next route callback handler. |
Throws:
-
Will throw an error if no request.params are provided.
-
Will throw an error if no primary key id is provided in the request.params.
-
Will throw an error if no destroyedCount is created.
Returns:
Returns a http response object
- Type
- Object
(async, static) readAll(request, response, next)
Read all reset token records.
Parameters:
| Name | Type | Description |
|---|---|---|
request |
Object | HTTP request object. |
response |
Object | HTTP response object callback. |
next |
Object | Call the next route handler. |
Throws:
Will throw an error if no foundResetTokens is created.
Returns:
Returns a http response body.
(async, static) readOne(request, response, next)
Read all reset token records
Parameters:
| Name | Type | Description |
|---|---|---|
request |
Object | HTTP request object |
response |
Object | HTTP response object callback |
next |
Object | Call the next route handler |
Throws:
-
Will throw an error if no request.params are present.
-
Will throw an error if no request.params.id is present.
-
Will throw an error if foundResetToken is not created.
Returns:
Returns a http response body.
(async, static) updateOne(request, response, next)
Update a request token record.
Parameters:
| Name | Type | Description |
|---|---|---|
request |
Object | HTTP request object. |
response |
Object | HTTP response object callback. |
next |
Object | Call the next route callback handler. |
Throws:
-
Will throw an error if no request.params is passed in.
-
Will throw an error if no request.params.id is passed in.
-
Will throw an error if no request.body is passed in.
-
Will throw an error if no updatedResetToken is created.
Returns:
Will return a http response body