Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notification ¶
type Notification struct { ID NotificationID `json:"id"` Title string `json:"title"` Description string `json:"description"` Link string `json:"link"` Read bool `json:"read"` CreatedAt time.Time `json:"createdAt"` Subscription Subscription `json:"subscription"` }
func FromModel ¶
func FromModel(m *model.Notification) *Notification
func FromModelMany ¶
func FromModelMany(m []*model.Notification) []Notification
type NotificationID ¶
type NotificationType ¶
type NotificationType string
type Repository ¶
type Repository interface { Subscribe(ctx context.Context, userID account.AccountID, refersType NotificationType, refersTo string) (*Subscription, error) Unsubscribe(ctx context.Context, userID account.AccountID, subID SubscriptionID) (int, error) GetSubscriptionsForUser(ctx context.Context, userID account.AccountID) ([]Subscription, error) GetSubscriptionsForItem(ctx context.Context, refersType NotificationType, refersTo string) ([]Subscription, error) GetNotifications(ctx context.Context, userID account.AccountID, read bool, after time.Time) ([]Notification, error) Notify(ctx context.Context, refersType NotificationType, refersTo string, title, desc, link string) (int, error) SetReadState(ctx context.Context, userID account.AccountID, notificationID NotificationID, read bool) (*Notification, error) Delete(ctx context.Context, userID account.AccountID, notificationID NotificationID) (*Notification, error) }
func New ¶
func New(db *model.Client) Repository
type Subscription ¶
type Subscription struct { ID SubscriptionID `json:"id"` RefersType NotificationType `json:"refersType"` RefersTo string `json:"refersTo"` CreatedAt time.Time `json:"createdAt"` }
func SubFromModel ¶
func SubFromModel(m *model.Subscription) *Subscription
func SubFromModelMany ¶
func SubFromModelMany(m []*model.Subscription) []Subscription
type SubscriptionID ¶
Click to show internal directories.
Click to hide internal directories.