You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 24, 2022. It is now read-only.
// ContextKeyRead is the context key to use for the read action
ContextKeyRead ContextKey = "read"
)
// Read is a many to many model describing a user who read a book. Because GORM does weird things with foreign keys we need to do it manually, unfortunately.
type Read struct {
gormuuid.UUID
Created time.Time
Updated time.Time
Deleted time.Time
BookID string `gorm:"not null"`
Book *Book `gorm:"-"`
UserID string `gorm:"not null"`
User *User `gorm:"-"`
}
// ToType returns a representation of a read activity as an ActivityPub object.
func (r *Read) ToType() vocab.Type {
read := streams.NewActivityStreamsRead()
if r.User != nil {
u, err := url.Parse(fmt.Sprintf("https://%s/%s", r.User.ID, r.ID))
if err == nil {
id := streams.NewJSONLDIdProperty()
id.SetIRI(u)
read.SetJSONLDId(id)
}
actor := streams.NewActivityStreamsActorProperty()