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