mirror of
https://github.com/aljazceru/lspd.git
synced 2025-12-19 14:54:22 +01:00
feat: remove webhook subcription by url (#194)
* feat: added webhook unsubscription * test: adding unsubscribe tests
This commit is contained in:
@@ -76,6 +76,27 @@ func (s *NotificationsStore) GetRegistrations(
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (s *NotificationsStore) Unsubscribe(
|
||||
ctx context.Context,
|
||||
pubkey string,
|
||||
url string,
|
||||
) error {
|
||||
pk, err := hex.DecodeString(pubkey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = s.pool.Exec(
|
||||
ctx,
|
||||
`DELETE FROM public.notification_subscriptions
|
||||
WHERE pubkey = $1 AND url = $2`,
|
||||
pk,
|
||||
url,
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *NotificationsStore) RemoveExpired(
|
||||
ctx context.Context,
|
||||
before time.Time,
|
||||
|
||||
Reference in New Issue
Block a user