set_status

Description
GET - Change the status of an entity

Methods


start( data )

Description
Called at route start
Parameters
Name Type Description
data object
Name Type Attributes Default Description
req object Request - See expressjs definition
res object Response - See expressjs definition
transaction object <optional>
Database transaction. undefined by default, provide your own when necessary
redirect number Redirection route when status is set
idEntity number Id of source entity
idNewStatus number Id of target status
statusName string Status's name
isAllowed boolean false Boolean to block status change. Set it to true to skip default verifications

beforeAllowedCheck( data )

Description
Called before calling `helpers.status.isAllowed()`
Parameters
Name Type Description
data object
Name Type Attributes Default Description
req object Request - See expressjs definition
res object Response - See expressjs definition
transaction object <optional>
Database transaction. undefined by default, provide your own when necessary
redirect number Redirection route when status is set
idEntity number Id of source entity
idNewStatus number Id of target status
statusName string Status's name
isAllowed boolean false Boolean to block status change. Set it to true to skip default verifications
entity object Entity on which status is to be set, with its current status included

beforeActionsExecution( data )

Description
Called before executing target status actions. Alter `data.actions` to add/remove actions
Parameters
Name Type Description
data object
Name Type Attributes Default Description
req object Request - See expressjs definition
res object Response - See expressjs definition
transaction object <optional>
Database transaction. undefined by default, provide your own when necessary
redirect number Redirection route when status is set
idEntity number Id of source entity
idNewStatus number Id of target status
statusName string Status's name
isAllowed boolean false Boolean to block status change. Set it to true to skip default verifications
entity object Entity on which status is to be set, with its current status included
actions Array.<object> Target status actions fetched from `helpers.status.getActions()`

beforeSetStatus( data )

Description
Called before setting target status using `helpers.status.setStatus()`
Parameters
Name Type Description
data object
Name Type Attributes Default Description
req object Request - See expressjs definition
res object Response - See expressjs definition
transaction object <optional>
Database transaction. undefined by default, provide your own when necessary
redirect number Redirection route when status is set
idEntity number Id of source entity
idNewStatus number Id of target status
statusName string Status's name
isAllowed boolean false Boolean to block status change. Set it to true to skip default verifications
entity object Entity on which status is to be set, with its current status included
actions Array.<object> Target status actions fetched from `helpers.status.getActions()`

beforeRedirect( data )

Description
Called before redirecting to `data.redirect`
Parameters
Name Type Description
data object
Name Type Attributes Default Description
req object Request - See expressjs definition
res object Response - See expressjs definition
transaction object <optional>
Database transaction. undefined by default, provide your own when necessary
redirect number Redirection route when status is set
idEntity number Id of source entity
idNewStatus number Id of target status
statusName string Status's name
isAllowed boolean false Boolean to block status change. Set it to true to skip default verifications
entity object Entity on which status is to be set, with its current status included
actions Array.<object> Target status actions fetched from `helpers.status.getActions()`