+1
-188
api/tangled/cbor_gen.go
+1
-188
api/tangled/cbor_gen.go
···
6944
6944
}
6945
6945
6946
6946
cw := cbg.NewCborWriter(w)
6947
-
fieldCount := 7
6948
6947
6949
-
if t.CommentId == nil {
6950
-
fieldCount--
6951
-
}
6952
-
6953
-
if t.Owner == nil {
6954
-
fieldCount--
6955
-
}
6956
-
6957
-
if t.Repo == nil {
6958
-
fieldCount--
6959
-
}
6960
-
6961
-
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
6948
+
if _, err := cw.Write([]byte{164}); err != nil {
6962
6949
return err
6963
6950
}
6964
6951
···
7008
6995
return err
7009
6996
}
7010
6997
7011
-
// t.Repo (string) (string)
7012
-
if t.Repo != nil {
7013
-
7014
-
if len("repo") > 1000000 {
7015
-
return xerrors.Errorf("Value in field \"repo\" was too long")
7016
-
}
7017
-
7018
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7019
-
return err
7020
-
}
7021
-
if _, err := cw.WriteString(string("repo")); err != nil {
7022
-
return err
7023
-
}
7024
-
7025
-
if t.Repo == nil {
7026
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7027
-
return err
7028
-
}
7029
-
} else {
7030
-
if len(*t.Repo) > 1000000 {
7031
-
return xerrors.Errorf("Value in field t.Repo was too long")
7032
-
}
7033
-
7034
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
7035
-
return err
7036
-
}
7037
-
if _, err := cw.WriteString(string(*t.Repo)); err != nil {
7038
-
return err
7039
-
}
7040
-
}
7041
-
}
7042
-
7043
6998
// t.LexiconTypeID (string) (string)
7044
6999
if len("$type") > 1000000 {
7045
7000
return xerrors.Errorf("Value in field \"$type\" was too long")
···
7059
7014
return err
7060
7015
}
7061
7016
7062
-
// t.Owner (string) (string)
7063
-
if t.Owner != nil {
7064
-
7065
-
if len("owner") > 1000000 {
7066
-
return xerrors.Errorf("Value in field \"owner\" was too long")
7067
-
}
7068
-
7069
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil {
7070
-
return err
7071
-
}
7072
-
if _, err := cw.WriteString(string("owner")); err != nil {
7073
-
return err
7074
-
}
7075
-
7076
-
if t.Owner == nil {
7077
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7078
-
return err
7079
-
}
7080
-
} else {
7081
-
if len(*t.Owner) > 1000000 {
7082
-
return xerrors.Errorf("Value in field t.Owner was too long")
7083
-
}
7084
-
7085
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Owner))); err != nil {
7086
-
return err
7087
-
}
7088
-
if _, err := cw.WriteString(string(*t.Owner)); err != nil {
7089
-
return err
7090
-
}
7091
-
}
7092
-
}
7093
-
7094
-
// t.CommentId (int64) (int64)
7095
-
if t.CommentId != nil {
7096
-
7097
-
if len("commentId") > 1000000 {
7098
-
return xerrors.Errorf("Value in field \"commentId\" was too long")
7099
-
}
7100
-
7101
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commentId"))); err != nil {
7102
-
return err
7103
-
}
7104
-
if _, err := cw.WriteString(string("commentId")); err != nil {
7105
-
return err
7106
-
}
7107
-
7108
-
if t.CommentId == nil {
7109
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7110
-
return err
7111
-
}
7112
-
} else {
7113
-
if *t.CommentId >= 0 {
7114
-
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.CommentId)); err != nil {
7115
-
return err
7116
-
}
7117
-
} else {
7118
-
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.CommentId-1)); err != nil {
7119
-
return err
7120
-
}
7121
-
}
7122
-
}
7123
-
7124
-
}
7125
-
7126
7017
// t.CreatedAt (string) (string)
7127
7018
if len("createdAt") > 1000000 {
7128
7019
return xerrors.Errorf("Value in field \"createdAt\" was too long")
···
7211
7102
7212
7103
t.Pull = string(sval)
7213
7104
}
7214
-
// t.Repo (string) (string)
7215
-
case "repo":
7216
-
7217
-
{
7218
-
b, err := cr.ReadByte()
7219
-
if err != nil {
7220
-
return err
7221
-
}
7222
-
if b != cbg.CborNull[0] {
7223
-
if err := cr.UnreadByte(); err != nil {
7224
-
return err
7225
-
}
7226
-
7227
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7228
-
if err != nil {
7229
-
return err
7230
-
}
7231
-
7232
-
t.Repo = (*string)(&sval)
7233
-
}
7234
-
}
7235
7105
// t.LexiconTypeID (string) (string)
7236
7106
case "$type":
7237
7107
···
7242
7112
}
7243
7113
7244
7114
t.LexiconTypeID = string(sval)
7245
-
}
7246
-
// t.Owner (string) (string)
7247
-
case "owner":
7248
-
7249
-
{
7250
-
b, err := cr.ReadByte()
7251
-
if err != nil {
7252
-
return err
7253
-
}
7254
-
if b != cbg.CborNull[0] {
7255
-
if err := cr.UnreadByte(); err != nil {
7256
-
return err
7257
-
}
7258
-
7259
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7260
-
if err != nil {
7261
-
return err
7262
-
}
7263
-
7264
-
t.Owner = (*string)(&sval)
7265
-
}
7266
-
}
7267
-
// t.CommentId (int64) (int64)
7268
-
case "commentId":
7269
-
{
7270
-
7271
-
b, err := cr.ReadByte()
7272
-
if err != nil {
7273
-
return err
7274
-
}
7275
-
if b != cbg.CborNull[0] {
7276
-
if err := cr.UnreadByte(); err != nil {
7277
-
return err
7278
-
}
7279
-
maj, extra, err := cr.ReadHeader()
7280
-
if err != nil {
7281
-
return err
7282
-
}
7283
-
var extraI int64
7284
-
switch maj {
7285
-
case cbg.MajUnsignedInt:
7286
-
extraI = int64(extra)
7287
-
if extraI < 0 {
7288
-
return fmt.Errorf("int64 positive overflow")
7289
-
}
7290
-
case cbg.MajNegativeInt:
7291
-
extraI = int64(extra)
7292
-
if extraI < 0 {
7293
-
return fmt.Errorf("int64 negative overflow")
7294
-
}
7295
-
extraI = -1 - extraI
7296
-
default:
7297
-
return fmt.Errorf("wrong type for int64 field: %d", maj)
7298
-
}
7299
-
7300
-
t.CommentId = (*int64)(&extraI)
7301
-
}
7302
7115
}
7303
7116
// t.CreatedAt (string) (string)
7304
7117
case "createdAt":
+4
-7
api/tangled/pullcomment.go
+4
-7
api/tangled/pullcomment.go
···
17
17
} //
18
18
// RECORDTYPE: RepoPullComment
19
19
type RepoPullComment struct {
20
-
LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull.comment" cborgen:"$type,const=sh.tangled.repo.pull.comment"`
21
-
Body string `json:"body" cborgen:"body"`
22
-
CommentId *int64 `json:"commentId,omitempty" cborgen:"commentId,omitempty"`
23
-
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
24
-
Owner *string `json:"owner,omitempty" cborgen:"owner,omitempty"`
25
-
Pull string `json:"pull" cborgen:"pull"`
26
-
Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
20
+
LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull.comment" cborgen:"$type,const=sh.tangled.repo.pull.comment"`
21
+
Body string `json:"body" cborgen:"body"`
22
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
23
+
Pull string `json:"pull" cborgen:"pull"`
27
24
}
-4
appview/pulls/pulls.go
-4
appview/pulls/pulls.go
···
605
605
defer tx.Rollback()
606
606
607
607
createdAt := time.Now().Format(time.RFC3339)
608
-
ownerDid := user.Did
609
608
610
609
pullAt, err := db.GetPullAt(s.db, f.RepoAt(), pull.PullId)
611
610
if err != nil {
···
614
613
return
615
614
}
616
615
617
-
atUri := f.RepoAt().String()
618
616
client, err := s.oauth.AuthorizedClient(r)
619
617
if err != nil {
620
618
log.Println("failed to get authorized client", err)
···
627
625
Rkey: tid.TID(),
628
626
Record: &lexutil.LexiconTypeDecoder{
629
627
Val: &tangled.RepoPullComment{
630
-
Repo: &atUri,
631
628
Pull: string(pullAt),
632
-
Owner: &ownerDid,
633
629
Body: body,
634
630
CreatedAt: createdAt,
635
631
},
-11
lexicons/pulls/comment.json
-11
lexicons/pulls/comment.json