Work on notifications + custom logger

This commit is contained in:
viktorstrate
2020-02-21 20:51:50 +01:00
parent 2d15e7c41f
commit 935dc5b55e
8 changed files with 188 additions and 30 deletions

View File

@@ -4,17 +4,18 @@ import (
"context"
"github.com/viktorstrate/photoview/api/graphql/auth"
"github.com/viktorstrate/photoview/api/graphql/models"
"github.com/viktorstrate/photoview/api/graphql/notification"
)
func (r *subscriptionResolver) Notification(ctx context.Context) (notification.NotificationChannel, error) {
func (r *subscriptionResolver) Notification(ctx context.Context) (<-chan *models.Notification, error) {
user := auth.UserFromContext(ctx)
if user == nil {
return nil, auth.ErrUnauthorized
}
notificationChannel := make(notification.NotificationChannel, 1)
notificationChannel := make(chan *models.Notification, 1)
listenerID := notification.RegisterListener(user, notificationChannel)