Add method to find all webhooks of a certain type for a user
This commit is contained in:
parent
03f29b2225
commit
b6755dcc95
|
@ -68,4 +68,16 @@ namespace controllers\internals;
|
|||
|
||||
return $this->get_model()->update_for_user($id_user, $id, $datas);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find all webhooks for a user and for a type of webhook
|
||||
* @param int $id_user : User id
|
||||
* @param string $type : Webhook type
|
||||
* @return array
|
||||
*/
|
||||
public function gets_for_type_and_user (int $id_user, string $type)
|
||||
{
|
||||
return $this->get_model()->gets_for_type_and_user($id_user, $type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,4 +18,16 @@ namespace models;
|
|||
* @return string
|
||||
*/
|
||||
protected function get_table_name() : string { return 'webhook'; }
|
||||
|
||||
|
||||
/**
|
||||
* Find all webhooks for a user and for a type of webhook
|
||||
* @param int $id_user : User id
|
||||
* @param string $type : Webhook type
|
||||
* @return array
|
||||
*/
|
||||
public function gets_for_type_and_user (int $id_user, string $type)
|
||||
{
|
||||
return $this->_select($this->get_table_name(), ['id_user' => $id_user, 'type' => $type]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue