an app.bsky.* indexer
1package models 2 3import ( 4 "bytes" 5 "log/slog" 6 "time" 7 8 appbsky "github.com/bluesky-social/indigo/api/bsky" 9 "github.com/bluesky-social/indigo/atproto/syntax" 10) 11 12type StrongRef struct { 13 Uri string 14 Cid string 15} 16 17type ActorProfile struct { 18 ID string `gorm:"primaryKey"` 19 20 // Avatar 21 // Banner 22 CreatedAt *string 23 Description *string 24 DisplayName *string 25 JoinedViaStarterPack StrongRef `gorm:"embedded;embeddedPrefix:joinedviastarterpack_"` 26 // Labels 27 // PinnedPost StrongRef 28 29 AutoCreatedAt time.Time `gorm:"autoCreateTime"` 30 AutoUpdatedAt time.Time `gorm:"autoUpdateTime"` 31} 32 33func NewActorProfile(uri syntax.ATURI, rec []byte) *ActorProfile { 34 var out appbsky.ActorProfile 35 if err := out.UnmarshalCBOR(bytes.NewReader(rec)); err != nil { 36 slog.Error("could not unmarshal profile CBOR", "err", err) 37 return nil 38 } 39 40 profile := ActorProfile{ 41 ID: string(uri), 42 CreatedAt: out.CreatedAt, 43 Description: out.Description, 44 DisplayName: out.DisplayName, 45 } 46 47 if out.JoinedViaStarterPack != nil { 48 profile.JoinedViaStarterPack = StrongRef{ 49 Uri: out.JoinedViaStarterPack.Uri, 50 Cid: out.JoinedViaStarterPack.Cid, 51 } 52 } 53 54 return &profile 55} 56 57// ActorStatus 58// FeedGenerator 59// FeedLike 60// FeedPost 61// FeedPostgate 62// FeedRepost 63// FeedThreadgate 64// GraphBlock 65// GraphFollow 66// GraphList 67// GraphListblock 68// GraphListitem 69// GraphStarterpack 70// GraphVerification 71// LabelerService 72// ActorDeclaration 73// LexiconSchema