package models import ( "bytes" "log/slog" "time" appbsky "github.com/bluesky-social/indigo/api/bsky" "github.com/bluesky-social/indigo/atproto/syntax" ) type GraphFollow struct { ID string `gorm:"primaryKey"` CreatedAt string Subject string AutoCreatedAt time.Time `gorm:"autoCreateTime"` AutoUpdatedAt time.Time `gorm:"autoUpdateTime"` } func NewGraphFollow(uri syntax.ATURI, rec []byte) *GraphFollow { var out appbsky.GraphFollow if err := out.UnmarshalCBOR(bytes.NewReader(rec)); err != nil { slog.Error("could not unmarshal graph follow CBOR", "err", err) return nil } return &GraphFollow{ ID: string(uri), CreatedAt: out.CreatedAt, Subject: out.Subject, } }