-3
cmd/monarch/handlers.go
-3
cmd/monarch/handlers.go
···
3
3
import (
4
4
"context"
5
5
"fmt"
6
-
"log/slog"
7
6
8
7
"github.com/bluesky-social/indigo/atproto/syntax"
9
8
"github.com/ipfs/go-cid"
···
20
19
// app.bsky.*
21
20
&models.ActorProfile{},
22
21
&models.ActorProfile_Label{},
23
-
&models.ActorProfile_JoinedViaStarterPack{},
24
-
&models.ActorProfile_PinnedPost{},
25
22
&models.ActorStatus{},
26
23
&models.ActorStatus_Embed{},
27
24
+10
-26
models/actor_profile.go
+10
-26
models/actor_profile.go
···
17
17
CreatedAt *string
18
18
Description *string
19
19
DisplayName *string
20
-
JoinedViaStarterPack []ActorProfile_JoinedViaStarterPack
20
+
JoinedViaStarterPack *StrongRef `gorm:"embedded;embeddedPrefix:starterpack_"`
21
21
Labels []ActorProfile_Label
22
-
PinnedPost []ActorProfile_PinnedPost
22
+
PinnedPost *StrongRef `gorm:"embedded;embeddedPrefix:pinnedpost_"`
23
23
24
24
AutoCreatedAt time.Time `gorm:"autoCreateTime"`
25
25
AutoUpdatedAt time.Time `gorm:"autoUpdateTime"`
···
30
30
Value string
31
31
}
32
32
33
-
type ActorProfile_JoinedViaStarterPack struct {
34
-
ActorProfileID string
35
-
StrongRef
36
-
}
37
-
38
-
type ActorProfile_PinnedPost struct {
39
-
ActorProfileID string
40
-
StrongRef
41
-
}
42
-
43
33
func NewActorProfile(uri syntax.ATURI, rec []byte) *ActorProfile {
44
34
var out appbsky.ActorProfile
45
35
if err := out.UnmarshalCBOR(bytes.NewReader(rec)); err != nil {
···
55
45
}
56
46
57
47
if out.JoinedViaStarterPack != nil {
58
-
profile.JoinedViaStarterPack = append(profile.JoinedViaStarterPack, ActorProfile_JoinedViaStarterPack{
59
-
ActorProfileID: profile.ID,
60
-
StrongRef: StrongRef{
61
-
Uri: out.JoinedViaStarterPack.Uri,
62
-
Cid: out.JoinedViaStarterPack.Cid,
63
-
},
64
-
})
48
+
profile.JoinedViaStarterPack = &StrongRef{
49
+
Uri: out.JoinedViaStarterPack.Uri,
50
+
Cid: out.JoinedViaStarterPack.Cid,
51
+
}
65
52
}
66
53
67
54
if out.PinnedPost != nil {
68
-
profile.PinnedPost = append(profile.PinnedPost, ActorProfile_PinnedPost{
69
-
ActorProfileID: profile.ID,
70
-
StrongRef: StrongRef{
71
-
Uri: out.PinnedPost.Uri,
72
-
Cid: out.PinnedPost.Cid,
73
-
},
74
-
})
55
+
profile.PinnedPost = &StrongRef{
56
+
Uri: out.PinnedPost.Uri,
57
+
Cid: out.PinnedPost.Cid,
58
+
}
75
59
}
76
60
77
61
if out.Labels != nil && out.Labels.LabelDefs_SelfLabels != nil && out.Labels.LabelDefs_SelfLabels.Values != nil {