Signed-off-by: nelind nel.n.lindberg@gmail.com
+1
-188
api/tangled/cbor_gen.go
+1
-188
api/tangled/cbor_gen.go
···
7361
7361
}
7362
7362
7363
7363
cw := cbg.NewCborWriter(w)
7364
-
fieldCount := 7
7365
-
7366
-
if t.CommentId == nil {
7367
-
fieldCount--
7368
-
}
7369
-
7370
-
if t.Owner == nil {
7371
-
fieldCount--
7372
-
}
7373
-
7374
-
if t.Repo == nil {
7375
-
fieldCount--
7376
-
}
7377
7364
7378
-
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
7365
+
if _, err := cw.Write([]byte{164}); err != nil {
7379
7366
return err
7380
7367
}
7381
7368
···
7425
7412
return err
7426
7413
}
7427
7414
7428
-
// t.Repo (string) (string)
7429
-
if t.Repo != nil {
7430
-
7431
-
if len("repo") > 1000000 {
7432
-
return xerrors.Errorf("Value in field \"repo\" was too long")
7433
-
}
7434
-
7435
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7436
-
return err
7437
-
}
7438
-
if _, err := cw.WriteString(string("repo")); err != nil {
7439
-
return err
7440
-
}
7441
-
7442
-
if t.Repo == nil {
7443
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7444
-
return err
7445
-
}
7446
-
} else {
7447
-
if len(*t.Repo) > 1000000 {
7448
-
return xerrors.Errorf("Value in field t.Repo was too long")
7449
-
}
7450
-
7451
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
7452
-
return err
7453
-
}
7454
-
if _, err := cw.WriteString(string(*t.Repo)); err != nil {
7455
-
return err
7456
-
}
7457
-
}
7458
-
}
7459
-
7460
7415
// t.LexiconTypeID (string) (string)
7461
7416
if len("$type") > 1000000 {
7462
7417
return xerrors.Errorf("Value in field \"$type\" was too long")
···
7476
7431
return err
7477
7432
}
7478
7433
7479
-
// t.Owner (string) (string)
7480
-
if t.Owner != nil {
7481
-
7482
-
if len("owner") > 1000000 {
7483
-
return xerrors.Errorf("Value in field \"owner\" was too long")
7484
-
}
7485
-
7486
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil {
7487
-
return err
7488
-
}
7489
-
if _, err := cw.WriteString(string("owner")); err != nil {
7490
-
return err
7491
-
}
7492
-
7493
-
if t.Owner == nil {
7494
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7495
-
return err
7496
-
}
7497
-
} else {
7498
-
if len(*t.Owner) > 1000000 {
7499
-
return xerrors.Errorf("Value in field t.Owner was too long")
7500
-
}
7501
-
7502
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Owner))); err != nil {
7503
-
return err
7504
-
}
7505
-
if _, err := cw.WriteString(string(*t.Owner)); err != nil {
7506
-
return err
7507
-
}
7508
-
}
7509
-
}
7510
-
7511
-
// t.CommentId (int64) (int64)
7512
-
if t.CommentId != nil {
7513
-
7514
-
if len("commentId") > 1000000 {
7515
-
return xerrors.Errorf("Value in field \"commentId\" was too long")
7516
-
}
7517
-
7518
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commentId"))); err != nil {
7519
-
return err
7520
-
}
7521
-
if _, err := cw.WriteString(string("commentId")); err != nil {
7522
-
return err
7523
-
}
7524
-
7525
-
if t.CommentId == nil {
7526
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7527
-
return err
7528
-
}
7529
-
} else {
7530
-
if *t.CommentId >= 0 {
7531
-
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.CommentId)); err != nil {
7532
-
return err
7533
-
}
7534
-
} else {
7535
-
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.CommentId-1)); err != nil {
7536
-
return err
7537
-
}
7538
-
}
7539
-
}
7540
-
7541
-
}
7542
-
7543
7434
// t.CreatedAt (string) (string)
7544
7435
if len("createdAt") > 1000000 {
7545
7436
return xerrors.Errorf("Value in field \"createdAt\" was too long")
···
7628
7519
7629
7520
t.Pull = string(sval)
7630
7521
}
7631
-
// t.Repo (string) (string)
7632
-
case "repo":
7633
-
7634
-
{
7635
-
b, err := cr.ReadByte()
7636
-
if err != nil {
7637
-
return err
7638
-
}
7639
-
if b != cbg.CborNull[0] {
7640
-
if err := cr.UnreadByte(); err != nil {
7641
-
return err
7642
-
}
7643
-
7644
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7645
-
if err != nil {
7646
-
return err
7647
-
}
7648
-
7649
-
t.Repo = (*string)(&sval)
7650
-
}
7651
-
}
7652
7522
// t.LexiconTypeID (string) (string)
7653
7523
case "$type":
7654
7524
···
7660
7530
7661
7531
t.LexiconTypeID = string(sval)
7662
7532
}
7663
-
// t.Owner (string) (string)
7664
-
case "owner":
7665
-
7666
-
{
7667
-
b, err := cr.ReadByte()
7668
-
if err != nil {
7669
-
return err
7670
-
}
7671
-
if b != cbg.CborNull[0] {
7672
-
if err := cr.UnreadByte(); err != nil {
7673
-
return err
7674
-
}
7675
-
7676
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7677
-
if err != nil {
7678
-
return err
7679
-
}
7680
-
7681
-
t.Owner = (*string)(&sval)
7682
-
}
7683
-
}
7684
-
// t.CommentId (int64) (int64)
7685
-
case "commentId":
7686
-
{
7687
-
7688
-
b, err := cr.ReadByte()
7689
-
if err != nil {
7690
-
return err
7691
-
}
7692
-
if b != cbg.CborNull[0] {
7693
-
if err := cr.UnreadByte(); err != nil {
7694
-
return err
7695
-
}
7696
-
maj, extra, err := cr.ReadHeader()
7697
-
if err != nil {
7698
-
return err
7699
-
}
7700
-
var extraI int64
7701
-
switch maj {
7702
-
case cbg.MajUnsignedInt:
7703
-
extraI = int64(extra)
7704
-
if extraI < 0 {
7705
-
return fmt.Errorf("int64 positive overflow")
7706
-
}
7707
-
case cbg.MajNegativeInt:
7708
-
extraI = int64(extra)
7709
-
if extraI < 0 {
7710
-
return fmt.Errorf("int64 negative overflow")
7711
-
}
7712
-
extraI = -1 - extraI
7713
-
default:
7714
-
return fmt.Errorf("wrong type for int64 field: %d", maj)
7715
-
}
7716
-
7717
-
t.CommentId = (*int64)(&extraI)
7718
-
}
7719
-
}
7720
7533
// t.CreatedAt (string) (string)
7721
7534
case "createdAt":
7722
7535
+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
···
669
669
defer tx.Rollback()
670
670
671
671
createdAt := time.Now().Format(time.RFC3339)
672
-
ownerDid := user.Did
673
672
674
673
pullAt, err := db.GetPullAt(s.db, f.RepoAt, pull.PullId)
675
674
if err != nil {
···
678
677
return
679
678
}
680
679
681
-
atUri := f.RepoAt.String()
682
680
client, err := s.oauth.AuthorizedClient(r)
683
681
if err != nil {
684
682
log.Println("failed to get authorized client", err)
···
691
689
Rkey: tid.TID(),
692
690
Record: &lexutil.LexiconTypeDecoder{
693
691
Val: &tangled.RepoPullComment{
694
-
Repo: &atUri,
695
692
Pull: string(pullAt),
696
-
Owner: &ownerDid,
697
693
Body: body,
698
694
CreatedAt: createdAt,
699
695
},
-11
lexicons/pulls/comment.json
-11
lexicons/pulls/comment.json