notifs

package
v0.0.0-...-efe2ce5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotifKindReply   = 1
	NotifKindMention = 2
	NotifKindUpVote  = 3
	NotifKindFollow  = 4
	NotifKindRepost  = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DBNotifMan

type DBNotifMan struct {
	// contains filtered or unexported fields
}

func NewNotificationManager

func NewNotificationManager(db *gorm.DB, getrec GetRecord) *DBNotifMan

func (*DBNotifMan) AddFollow

func (nm *DBNotifMan) AddFollow(ctx context.Context, follower, followed models.Uid, recid uint) error

func (*DBNotifMan) AddMention

func (nm *DBNotifMan) AddMention(ctx context.Context, user models.Uid, postid uint, mentioned models.Uid) error

func (*DBNotifMan) AddReplyTo

func (nm *DBNotifMan) AddReplyTo(ctx context.Context, user models.Uid, replyid uint, replyto *models.FeedPost) error

func (*DBNotifMan) AddRepost

func (nm *DBNotifMan) AddRepost(ctx context.Context, op models.Uid, repost uint, reposter models.Uid) error

func (*DBNotifMan) AddUpVote

func (nm *DBNotifMan) AddUpVote(ctx context.Context, voter models.Uid, postid uint, voteid uint, postauthor models.Uid) error

func (*DBNotifMan) GetCount

func (nm *DBNotifMan) GetCount(ctx context.Context, user models.Uid) (int64, error)

func (*DBNotifMan) GetNotifications

func (*DBNotifMan) UpdateSeen

func (nm *DBNotifMan) UpdateSeen(ctx context.Context, usr models.Uid, seen time.Time) error

type GetRecord

type GetRecord func(ctx context.Context, user models.Uid, collection string, rkey string, maybeCid cid.Cid) (cid.Cid, cbg.CBORMarshaler, error)

type HydratedNotification

type HydratedNotification struct {
	Record        any
	IsRead        bool
	IndexedAt     time.Time
	Uri           string
	Cid           string
	Author        *appbskytypes.ActorDefs_ProfileViewBasic
	Reason        string
	ReasonSubject *string
}

type NotifRecord

type NotifRecord struct {
	gorm.Model
	For     models.Uid
	Kind    int64
	Record  uint
	Who     models.Uid
	ReplyTo uint
}

type NotifSeen

type NotifSeen struct {
	ID       uint       `gorm:"primarykey"`
	Usr      models.Uid `gorm:"uniqueIndex"`
	LastSeen time.Time
}

type NotificationManager

type NotificationManager interface {
	GetNotifications(ctx context.Context, user models.Uid) ([]*appbskytypes.NotificationListNotifications_Notification, error)
	GetCount(ctx context.Context, user models.Uid) (int64, error)
	UpdateSeen(ctx context.Context, usr models.Uid, seen time.Time) error
	AddReplyTo(ctx context.Context, user models.Uid, replyid uint, replyto *models.FeedPost) error
	AddMention(ctx context.Context, user models.Uid, postid uint, mentioned models.Uid) error
	AddUpVote(ctx context.Context, voter models.Uid, postid uint, voteid uint, postauthor models.Uid) error
	AddFollow(ctx context.Context, follower, followed models.Uid, recid uint) error
	AddRepost(ctx context.Context, op models.Uid, repost uint, reposter models.Uid) error
}

type NullNotifs

type NullNotifs struct {
}

func (*NullNotifs) AddFollow

func (nn *NullNotifs) AddFollow(ctx context.Context, follower, followed models.Uid, recid uint) error

func (*NullNotifs) AddMention

func (nn *NullNotifs) AddMention(ctx context.Context, user models.Uid, postid uint, mentioned models.Uid) error

func (*NullNotifs) AddReplyTo

func (nn *NullNotifs) AddReplyTo(ctx context.Context, user models.Uid, replyid uint, replyto *models.FeedPost) error

func (*NullNotifs) AddRepost

func (nn *NullNotifs) AddRepost(ctx context.Context, op models.Uid, repost uint, reposter models.Uid) error

func (*NullNotifs) AddUpVote

func (nn *NullNotifs) AddUpVote(ctx context.Context, voter models.Uid, postid uint, voteid uint, postauthor models.Uid) error

func (*NullNotifs) GetCount

func (nn *NullNotifs) GetCount(ctx context.Context, user models.Uid) (int64, error)

func (*NullNotifs) GetNotifications

func (*NullNotifs) UpdateSeen

func (nn *NullNotifs) UpdateSeen(ctx context.Context, usr models.Uid, seen time.Time) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL