feat(platform): add the notification inbox and deterministic match search
This commit is contained in:
1 parent
5edff21d2d
commit
0b11021b16
169 files changed
+17083
-443
No files matched your search
@@ -12,6 +12,7 @@ import (
|
||||
"errors"
|
||||
"io"
|
||||
"log"
|
||||
"log/slog"
|
||||
"mime"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -45,6 +46,7 @@ type membershipRevoker func(context.Context, uuid.UUID, uuid.UUID, uuid.UUID) er
|
||||
type fixtureHandler struct {
|
||||
token string
|
||||
revoke membershipRevoker
|
||||
notices *noticeFixture
|
||||
requests atomic.Uint32
|
||||
}
|
||||
|
||||
@@ -98,6 +100,20 @@ func serve() error {
|
||||
revoke: func(ctx context.Context, organizationID, userID, successorUserID uuid.UUID) error {
|
||||
return postgres.RevokeCompanyFixtureMembership(ctx, pool, organizationID, userID, successorUserID)
|
||||
},
|
||||
notices: newNoticeFixture(
|
||||
postgres.NewTransactor(pool),
|
||||
postgres.NewEventConsumerStore(pool, requestTimeout),
|
||||
func(ctx context.Context, recipientID, organizationID uuid.UUID) error {
|
||||
return postgres.CheckNotificationFixtureScope(ctx, pool, recipientID, organizationID)
|
||||
},
|
||||
func(ctx context.Context, eventID uuid.UUID) (outbound.ConsumedEvent, error) {
|
||||
return postgres.NotificationFixtureEvent(ctx, pool, eventID)
|
||||
},
|
||||
func(ctx context.Context, recipientID, organizationID uuid.UUID) error {
|
||||
return postgres.HideNotificationFixtureOrganization(ctx, pool, recipientID, organizationID)
|
||||
},
|
||||
slog.New(slog.DiscardHandler),
|
||||
),
|
||||
},
|
||||
ReadHeaderTimeout: readHeaderTimeout,
|
||||
ReadTimeout: readTimeout,
|
||||
@@ -142,6 +158,8 @@ func (handler *fixtureHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
|
||||
handler.serveHealthcheck(w, r)
|
||||
case fixtureEndpoint:
|
||||
handler.serveMembershipRevocation(w, r)
|
||||
case noticeEndpoint, noticeReplayEndpoint, noticeHideEndpoint:
|
||||
handler.serveNotice(w, r)
|
||||
default:
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user