forked from tangled.org/core
Monorepo for Tangled

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

Signed-off-by: nelind <nel.n.lindberg@gmail.com>

authored by nel.pet and committed by Tangled 7147495e 93607be8

Changed files
+1 -57
api
appview
db
pulls
lexicons
pulls
+1 -49
api/tangled/cbor_gen.go
··· 6529 } 6530 6531 cw := cbg.NewCborWriter(w) 6532 - fieldCount := 9 6533 6534 if t.Body == nil { 6535 fieldCount-- ··· 6638 } 6639 if _, err := cw.WriteString(string(t.Title)); err != nil { 6640 return err 6641 - } 6642 - 6643 - // t.PullId (int64) (int64) 6644 - if len("pullId") > 1000000 { 6645 - return xerrors.Errorf("Value in field \"pullId\" was too long") 6646 - } 6647 - 6648 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pullId"))); err != nil { 6649 - return err 6650 - } 6651 - if _, err := cw.WriteString(string("pullId")); err != nil { 6652 - return err 6653 - } 6654 - 6655 - if t.PullId >= 0 { 6656 - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.PullId)); err != nil { 6657 - return err 6658 - } 6659 - } else { 6660 - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.PullId-1)); err != nil { 6661 - return err 6662 - } 6663 } 6664 6665 // t.Source (tangled.RepoPull_Source) (struct) ··· 6846 } 6847 6848 t.Title = string(sval) 6849 - } 6850 - // t.PullId (int64) (int64) 6851 - case "pullId": 6852 - { 6853 - maj, extra, err := cr.ReadHeader() 6854 - if err != nil { 6855 - return err 6856 - } 6857 - var extraI int64 6858 - switch maj { 6859 - case cbg.MajUnsignedInt: 6860 - extraI = int64(extra) 6861 - if extraI < 0 { 6862 - return fmt.Errorf("int64 positive overflow") 6863 - } 6864 - case cbg.MajNegativeInt: 6865 - extraI = int64(extra) 6866 - if extraI < 0 { 6867 - return fmt.Errorf("int64 negative overflow") 6868 - } 6869 - extraI = -1 - extraI 6870 - default: 6871 - return fmt.Errorf("wrong type for int64 field: %d", maj) 6872 - } 6873 - 6874 - t.PullId = int64(extraI) 6875 } 6876 // t.Source (tangled.RepoPull_Source) (struct) 6877 case "source":
··· 6529 } 6530 6531 cw := cbg.NewCborWriter(w) 6532 + fieldCount := 8 6533 6534 if t.Body == nil { 6535 fieldCount-- ··· 6638 } 6639 if _, err := cw.WriteString(string(t.Title)); err != nil { 6640 return err 6641 } 6642 6643 // t.Source (tangled.RepoPull_Source) (struct) ··· 6824 } 6825 6826 t.Title = string(sval) 6827 } 6828 // t.Source (tangled.RepoPull_Source) (struct) 6829 case "source":
-1
api/tangled/repopull.go
··· 21 Body *string `json:"body,omitempty" cborgen:"body,omitempty"` 22 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 23 Patch string `json:"patch" cborgen:"patch"` 24 - PullId int64 `json:"pullId" cborgen:"pullId"` 25 Source *RepoPull_Source `json:"source,omitempty" cborgen:"source,omitempty"` 26 TargetBranch string `json:"targetBranch" cborgen:"targetBranch"` 27 TargetRepo string `json:"targetRepo" cborgen:"targetRepo"`
··· 21 Body *string `json:"body,omitempty" cborgen:"body,omitempty"` 22 CreatedAt string `json:"createdAt" cborgen:"createdAt"` 23 Patch string `json:"patch" cborgen:"patch"` 24 Source *RepoPull_Source `json:"source,omitempty" cborgen:"source,omitempty"` 25 TargetBranch string `json:"targetBranch" cborgen:"targetBranch"` 26 TargetRepo string `json:"targetRepo" cborgen:"targetRepo"`
-1
appview/db/pulls.go
··· 94 Title: p.Title, 95 Body: &p.Body, 96 CreatedAt: p.Created.Format(time.RFC3339), 97 - PullId: int64(p.PullId), 98 TargetRepo: p.RepoAt.String(), 99 TargetBranch: p.TargetBranch, 100 Patch: p.LatestPatch(),
··· 94 Title: p.Title, 95 Body: &p.Body, 96 CreatedAt: p.Created.Format(time.RFC3339), 97 TargetRepo: p.RepoAt.String(), 98 TargetBranch: p.TargetBranch, 99 Patch: p.LatestPatch(),
-2
appview/pulls/pulls.go
··· 1035 Record: &lexutil.LexiconTypeDecoder{ 1036 Val: &tangled.RepoPull{ 1037 Title: title, 1038 - PullId: int64(pullId), 1039 TargetRepo: string(f.RepoAt()), 1040 TargetBranch: targetBranch, 1041 Patch: patch, ··· 1606 Record: &lexutil.LexiconTypeDecoder{ 1607 Val: &tangled.RepoPull{ 1608 Title: pull.Title, 1609 - PullId: int64(pull.PullId), 1610 TargetRepo: string(f.RepoAt()), 1611 TargetBranch: pull.TargetBranch, 1612 Patch: patch, // new patch
··· 1035 Record: &lexutil.LexiconTypeDecoder{ 1036 Val: &tangled.RepoPull{ 1037 Title: title, 1038 TargetRepo: string(f.RepoAt()), 1039 TargetBranch: targetBranch, 1040 Patch: patch, ··· 1605 Record: &lexutil.LexiconTypeDecoder{ 1606 Val: &tangled.RepoPull{ 1607 Title: pull.Title, 1608 TargetRepo: string(f.RepoAt()), 1609 TargetBranch: pull.TargetBranch, 1610 Patch: patch, // new patch
-4
lexicons/pulls/pull.json
··· 12 "required": [ 13 "targetRepo", 14 "targetBranch", 15 - "pullId", 16 "title", 17 "patch", 18 "createdAt" ··· 24 }, 25 "targetBranch": { 26 "type": "string" 27 - }, 28 - "pullId": { 29 - "type": "integer" 30 }, 31 "title": { 32 "type": "string"
··· 12 "required": [ 13 "targetRepo", 14 "targetBranch", 15 "title", 16 "patch", 17 "createdAt" ··· 23 }, 24 "targetBranch": { 25 "type": "string" 26 }, 27 "title": { 28 "type": "string"