appview/db/db.go
appview/db/db.go
This file has not been changed.
+6
-5
appview/db/vouch.go
+6
-5
appview/db/vouch.go
···
7
7
"strings"
8
8
"time"
9
9
10
+
"github.com/bluesky-social/indigo/atproto/syntax"
10
11
"github.com/ipfs/go-cid"
11
12
"tangled.org/core/appview/models"
12
13
"tangled.org/core/appview/pagination"
···
169
170
return vouches, nil
170
171
}
171
172
172
-
func GetVouchRelationshipsBatch(e Execer, viewerDid string, subjectDids []string) (map[string]*models.VouchRelationship, error) {
173
+
func GetVouchRelationshipsBatch(e Execer, viewerDid syntax.DID, subjectDids []syntax.DID) (map[syntax.DID]*models.VouchRelationship, error) {
173
174
if viewerDid == "" {
174
175
return nil, fmt.Errorf("viewerDid cannot be empty")
175
176
}
176
177
177
-
result := make(map[string]*models.VouchRelationship)
178
+
result := make(map[syntax.DID]*models.VouchRelationship)
178
179
for _, subjectDid := range subjectDids {
179
180
result[subjectDid] = &models.VouchRelationship{
180
181
ViewerDid: viewerDid,
···
208
209
return nil, err
209
210
}
210
211
211
-
network := make([]string, 0, len(networkVouches))
212
+
network := make([]syntax.DID, 0, len(networkVouches))
212
213
for _, v := range networkVouches {
213
214
network = append(network, v.SubjectDid)
214
215
}
···
231
232
return result, nil
232
233
}
233
234
234
-
func GetVouchRelationship(e Execer, viewerDid, subjectDid string) (*models.VouchRelationship, error) {
235
-
batch, err := GetVouchRelationshipsBatch(e, viewerDid, []string{subjectDid})
235
+
func GetVouchRelationship(e Execer, viewerDid, subjectDid syntax.DID) (*models.VouchRelationship, error) {
236
+
batch, err := GetVouchRelationshipsBatch(e, viewerDid, []syntax.DID{subjectDid})
236
237
if err != nil {
237
238
return nil, err
238
239
}
+6
-5
appview/models/vouch.go
+6
-5
appview/models/vouch.go
···
4
4
"fmt"
5
5
"time"
6
6
7
+
"github.com/bluesky-social/indigo/atproto/syntax"
7
8
"github.com/ipfs/go-cid"
8
9
)
9
10
10
11
type VouchSuggestion struct {
11
-
Did string
12
+
Did syntax.DID
12
13
Reason string
13
14
VouchRelationship *VouchRelationship
14
15
}
···
32
33
}
33
34
34
35
type Vouch struct {
35
-
Did string
36
-
SubjectDid string
36
+
Did syntax.DID
37
+
SubjectDid syntax.DID
37
38
Cid cid.Cid
38
39
Kind VouchKind
39
40
Reason *string
···
54
55
}
55
56
56
57
type VouchRelationship struct {
57
-
ViewerDid string
58
-
SubjectDid string
58
+
ViewerDid syntax.DID
59
+
SubjectDid syntax.DID
59
60
60
61
NetworkVouches []Vouch
61
62
}