feat(webhook_listeners): Add mapper method to remove all registrations from a given AppAPI id

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/47855/head
Côme Chilliet 2024-09-09 14:39:41 +07:00 committed by backportbot[bot]
parent 8f6620d552
commit 6c1a6d17c2
1 changed files with 15 additions and 0 deletions

@ -159,6 +159,21 @@ class WebhookListenerMapper extends QBMapper {
return ($qb->executeStatement() > 0);
}
/**
* Delete all registrations made by the given appId
*
* @throws Exception
* @return int number of registration deleted
*/
public function deleteByAppId(string $appId): int {
$qb = $this->db->getQueryBuilder();
$qb->delete($this->getTableName())
->where($qb->expr()->eq('app_id', $qb->createNamedParameter($appId, IQueryBuilder::PARAM_STR)));
return $qb->executeStatement();
}
/**
* @throws Exception
* @return list<string>