Signed-off-by: nelind nel.n.lindberg@gmail.com
+1
-188
api/tangled/cbor_gen.go
+1
-188
api/tangled/cbor_gen.go
···
7163
}
7164
7165
cw := cbg.NewCborWriter(w)
7166
-
fieldCount := 7
7167
-
7168
-
if t.CommentId == nil {
7169
-
fieldCount--
7170
-
}
7171
-
7172
-
if t.Owner == nil {
7173
-
fieldCount--
7174
-
}
7175
-
7176
-
if t.Repo == nil {
7177
-
fieldCount--
7178
-
}
7179
7180
-
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
7181
return err
7182
}
7183
···
7227
return err
7228
}
7229
7230
-
// t.Repo (string) (string)
7231
-
if t.Repo != nil {
7232
-
7233
-
if len("repo") > 1000000 {
7234
-
return xerrors.Errorf("Value in field \"repo\" was too long")
7235
-
}
7236
-
7237
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7238
-
return err
7239
-
}
7240
-
if _, err := cw.WriteString(string("repo")); err != nil {
7241
-
return err
7242
-
}
7243
-
7244
-
if t.Repo == nil {
7245
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7246
-
return err
7247
-
}
7248
-
} else {
7249
-
if len(*t.Repo) > 1000000 {
7250
-
return xerrors.Errorf("Value in field t.Repo was too long")
7251
-
}
7252
-
7253
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
7254
-
return err
7255
-
}
7256
-
if _, err := cw.WriteString(string(*t.Repo)); err != nil {
7257
-
return err
7258
-
}
7259
-
}
7260
-
}
7261
-
7262
// t.LexiconTypeID (string) (string)
7263
if len("$type") > 1000000 {
7264
return xerrors.Errorf("Value in field \"$type\" was too long")
···
7278
return err
7279
}
7280
7281
-
// t.Owner (string) (string)
7282
-
if t.Owner != nil {
7283
-
7284
-
if len("owner") > 1000000 {
7285
-
return xerrors.Errorf("Value in field \"owner\" was too long")
7286
-
}
7287
-
7288
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil {
7289
-
return err
7290
-
}
7291
-
if _, err := cw.WriteString(string("owner")); err != nil {
7292
-
return err
7293
-
}
7294
-
7295
-
if t.Owner == nil {
7296
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7297
-
return err
7298
-
}
7299
-
} else {
7300
-
if len(*t.Owner) > 1000000 {
7301
-
return xerrors.Errorf("Value in field t.Owner was too long")
7302
-
}
7303
-
7304
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Owner))); err != nil {
7305
-
return err
7306
-
}
7307
-
if _, err := cw.WriteString(string(*t.Owner)); err != nil {
7308
-
return err
7309
-
}
7310
-
}
7311
-
}
7312
-
7313
-
// t.CommentId (int64) (int64)
7314
-
if t.CommentId != nil {
7315
-
7316
-
if len("commentId") > 1000000 {
7317
-
return xerrors.Errorf("Value in field \"commentId\" was too long")
7318
-
}
7319
-
7320
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commentId"))); err != nil {
7321
-
return err
7322
-
}
7323
-
if _, err := cw.WriteString(string("commentId")); err != nil {
7324
-
return err
7325
-
}
7326
-
7327
-
if t.CommentId == nil {
7328
-
if _, err := cw.Write(cbg.CborNull); err != nil {
7329
-
return err
7330
-
}
7331
-
} else {
7332
-
if *t.CommentId >= 0 {
7333
-
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.CommentId)); err != nil {
7334
-
return err
7335
-
}
7336
-
} else {
7337
-
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.CommentId-1)); err != nil {
7338
-
return err
7339
-
}
7340
-
}
7341
-
}
7342
-
7343
-
}
7344
-
7345
// t.CreatedAt (string) (string)
7346
if len("createdAt") > 1000000 {
7347
return xerrors.Errorf("Value in field \"createdAt\" was too long")
···
7430
7431
t.Pull = string(sval)
7432
}
7433
-
// t.Repo (string) (string)
7434
-
case "repo":
7435
-
7436
-
{
7437
-
b, err := cr.ReadByte()
7438
-
if err != nil {
7439
-
return err
7440
-
}
7441
-
if b != cbg.CborNull[0] {
7442
-
if err := cr.UnreadByte(); err != nil {
7443
-
return err
7444
-
}
7445
-
7446
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7447
-
if err != nil {
7448
-
return err
7449
-
}
7450
-
7451
-
t.Repo = (*string)(&sval)
7452
-
}
7453
-
}
7454
// t.LexiconTypeID (string) (string)
7455
case "$type":
7456
···
7462
7463
t.LexiconTypeID = string(sval)
7464
}
7465
-
// t.Owner (string) (string)
7466
-
case "owner":
7467
-
7468
-
{
7469
-
b, err := cr.ReadByte()
7470
-
if err != nil {
7471
-
return err
7472
-
}
7473
-
if b != cbg.CborNull[0] {
7474
-
if err := cr.UnreadByte(); err != nil {
7475
-
return err
7476
-
}
7477
-
7478
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7479
-
if err != nil {
7480
-
return err
7481
-
}
7482
-
7483
-
t.Owner = (*string)(&sval)
7484
-
}
7485
-
}
7486
-
// t.CommentId (int64) (int64)
7487
-
case "commentId":
7488
-
{
7489
-
7490
-
b, err := cr.ReadByte()
7491
-
if err != nil {
7492
-
return err
7493
-
}
7494
-
if b != cbg.CborNull[0] {
7495
-
if err := cr.UnreadByte(); err != nil {
7496
-
return err
7497
-
}
7498
-
maj, extra, err := cr.ReadHeader()
7499
-
if err != nil {
7500
-
return err
7501
-
}
7502
-
var extraI int64
7503
-
switch maj {
7504
-
case cbg.MajUnsignedInt:
7505
-
extraI = int64(extra)
7506
-
if extraI < 0 {
7507
-
return fmt.Errorf("int64 positive overflow")
7508
-
}
7509
-
case cbg.MajNegativeInt:
7510
-
extraI = int64(extra)
7511
-
if extraI < 0 {
7512
-
return fmt.Errorf("int64 negative overflow")
7513
-
}
7514
-
extraI = -1 - extraI
7515
-
default:
7516
-
return fmt.Errorf("wrong type for int64 field: %d", maj)
7517
-
}
7518
-
7519
-
t.CommentId = (*int64)(&extraI)
7520
-
}
7521
-
}
7522
// t.CreatedAt (string) (string)
7523
case "createdAt":
7524
···
7163
}
7164
7165
cw := cbg.NewCborWriter(w)
7166
7167
+
if _, err := cw.Write([]byte{164}); err != nil {
7168
return err
7169
}
7170
···
7214
return err
7215
}
7216
7217
// t.LexiconTypeID (string) (string)
7218
if len("$type") > 1000000 {
7219
return xerrors.Errorf("Value in field \"$type\" was too long")
···
7233
return err
7234
}
7235
7236
// t.CreatedAt (string) (string)
7237
if len("createdAt") > 1000000 {
7238
return xerrors.Errorf("Value in field \"createdAt\" was too long")
···
7321
7322
t.Pull = string(sval)
7323
}
7324
// t.LexiconTypeID (string) (string)
7325
case "$type":
7326
···
7332
7333
t.LexiconTypeID = string(sval)
7334
}
7335
// t.CreatedAt (string) (string)
7336
case "createdAt":
7337
+4
-7
api/tangled/pullcomment.go
+4
-7
api/tangled/pullcomment.go
···
17
} //
18
// RECORDTYPE: RepoPullComment
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"`
27
}
···
17
} //
18
// RECORDTYPE: RepoPullComment
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
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
23
+
Pull string `json:"pull" cborgen:"pull"`
24
}
-4
appview/pulls/pulls.go
-4
appview/pulls/pulls.go
···
669
defer tx.Rollback()
670
671
createdAt := time.Now().Format(time.RFC3339)
672
-
ownerDid := user.Did
673
674
pullAt, err := db.GetPullAt(s.db, f.RepoAt, pull.PullId)
675
if err != nil {
···
678
return
679
}
680
681
-
atUri := f.RepoAt.String()
682
client, err := s.oauth.AuthorizedClient(r)
683
if err != nil {
684
log.Println("failed to get authorized client", err)
···
691
Rkey: tid.TID(),
692
Record: &lexutil.LexiconTypeDecoder{
693
Val: &tangled.RepoPullComment{
694
-
Repo: &atUri,
695
Pull: string(pullAt),
696
-
Owner: &ownerDid,
697
Body: body,
698
CreatedAt: createdAt,
699
},
···
669
defer tx.Rollback()
670
671
createdAt := time.Now().Format(time.RFC3339)
672
673
pullAt, err := db.GetPullAt(s.db, f.RepoAt, pull.PullId)
674
if err != nil {
···
677
return
678
}
679
680
client, err := s.oauth.AuthorizedClient(r)
681
if err != nil {
682
log.Println("failed to get authorized client", err)
···
689
Rkey: tid.TID(),
690
Record: &lexutil.LexiconTypeDecoder{
691
Val: &tangled.RepoPullComment{
692
Pull: string(pullAt),
693
Body: body,
694
CreatedAt: createdAt,
695
},
-11
lexicons/pulls/comment.json
-11
lexicons/pulls/comment.json