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