lexicons: pulls: remove pull id from the pull record and instead generate ids purely appview side #403

merged
opened by nel.pet targeting master from nel.pet/core: push-kyupnpkvqmsy
Changed files
+1 -57
api
appview
db
pulls
lexicons
pulls
+1 -49
api/tangled/cbor_gen.go
··· 6399 6399 } 6400 6400 6401 6401 cw := cbg.NewCborWriter(w) 6402 - fieldCount := 9 6402 + fieldCount := 8 6403 6403 6404 6404 if t.Body == nil { 6405 6405 fieldCount-- ··· 6510 6510 return err 6511 6511 } 6512 6512 6513 - // t.PullId (int64) (int64) 6514 - if len("pullId") > 1000000 { 6515 - return xerrors.Errorf("Value in field \"pullId\" was too long") 6516 - } 6517 - 6518 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pullId"))); err != nil { 6519 - return err 6520 - } 6521 - if _, err := cw.WriteString(string("pullId")); err != nil { 6522 - return err 6523 - } 6524 - 6525 - if t.PullId >= 0 { 6526 - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.PullId)); err != nil { 6527 - return err 6528 - } 6529 - } else { 6530 - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.PullId-1)); err != nil { 6531 - return err 6532 - } 6533 - } 6534 - 6535 6513 // t.Source (tangled.RepoPull_Source) (struct) 6536 6514 if t.Source != nil { 6537 6515 ··· 6717 6695 6718 6696 t.Title = string(sval) 6719 6697 } 6720 - // t.PullId (int64) (int64) 6721 - case "pullId": 6722 - { 6723 - maj, extra, err := cr.ReadHeader() 6724 - if err != nil { 6725 - return err 6726 - } 6727 - var extraI int64 6728 - switch maj { 6729 - case cbg.MajUnsignedInt: 6730 - extraI = int64(extra) 6731 - if extraI < 0 { 6732 - return fmt.Errorf("int64 positive overflow") 6733 - } 6734 - case cbg.MajNegativeInt: 6735 - extraI = int64(extra) 6736 - if extraI < 0 { 6737 - return fmt.Errorf("int64 negative overflow") 6738 - } 6739 - extraI = -1 - extraI 6740 - default: 6741 - return fmt.Errorf("wrong type for int64 field: %d", maj) 6742 - } 6743 - 6744 - t.PullId = int64(extraI) 6745 - } 6746 6698 // t.Source (tangled.RepoPull_Source) (struct) 6747 6699 case "source": 6748 6700
-1
api/tangled/repopull.go
··· 21 21 Body *string `json:"body,omitempty" cborgen:"body,omitempty"` 22 22 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 23 23 Patch string `json:"patch" cborgen:"patch"` 24 - PullId int64 `json:"pullId" cborgen:"pullId"` 25 24 Source *RepoPull_Source `json:"source,omitempty" cborgen:"source,omitempty"` 26 25 TargetBranch string `json:"targetBranch" cborgen:"targetBranch"` 27 26 TargetRepo string `json:"targetRepo" cborgen:"targetRepo"`
-1
appview/db/pulls.go
··· 94 94 Title: p.Title, 95 95 Body: &p.Body, 96 96 CreatedAt: p.Created.Format(time.RFC3339), 97 - PullId: int64(p.PullId), 98 97 TargetRepo: p.RepoAt.String(), 99 98 TargetBranch: p.TargetBranch, 100 99 Patch: p.LatestPatch(),
-2
appview/pulls/pulls.go
··· 1031 1031 Record: &lexutil.LexiconTypeDecoder{ 1032 1032 Val: &tangled.RepoPull{ 1033 1033 Title: title, 1034 - PullId: int64(pullId), 1035 1034 TargetRepo: string(f.RepoAt()), 1036 1035 TargetBranch: targetBranch, 1037 1036 Patch: patch, ··· 1593 1592 Record: &lexutil.LexiconTypeDecoder{ 1594 1593 Val: &tangled.RepoPull{ 1595 1594 Title: pull.Title, 1596 - PullId: int64(pull.PullId), 1597 1595 TargetRepo: string(f.RepoAt()), 1598 1596 TargetBranch: pull.TargetBranch, 1599 1597 Patch: patch, // new patch
-4
lexicons/pulls/pull.json
··· 12 12 "required": [ 13 13 "targetRepo", 14 14 "targetBranch", 15 - "pullId", 16 15 "title", 17 16 "patch", 18 17 "createdAt" ··· 25 24 "targetBranch": { 26 25 "type": "string" 27 26 }, 28 - "pullId": { 29 - "type": "integer" 30 - }, 31 27 "title": { 32 28 "type": "string" 33 29 },