Store Web Push subscriptions in DB

This commit is contained in:
Vyr Cossont 2024-11-30 12:24:13 -08:00
commit 0cffb8784e
25 changed files with 546 additions and 69 deletions

View file

@ -19,6 +19,7 @@ package testrig
import (
"context"
webpushgo "github.com/SherClockHolmes/webpush-go"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/db/bundb"
@ -61,6 +62,8 @@ var testModels = []interface{}{
&gtsmodel.ThreadToStatus{},
&gtsmodel.User{},
&gtsmodel.UserMute{},
&gtsmodel.VAPIDKeyPair{},
&gtsmodel.WebPushSubscription{},
&gtsmodel.Emoji{},
&gtsmodel.Instance{},
&gtsmodel.Notification{},
@ -348,6 +351,12 @@ func StandardDBSetup(db db.DB, accounts map[string]*gtsmodel.Account) {
}
}
for _, v := range NewTestWebPushSubscriptions() {
if err := db.Put(ctx, v); err != nil {
log.Panic(nil, err)
}
}
for _, v := range NewTestInteractionRequests() {
if err := db.Put(ctx, v); err != nil {
log.Panic(ctx, err)