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
··· 6748 6748 } 6749 6749 6750 6750 cw := cbg.NewCborWriter(w) 6751 - fieldCount := 9 6751 + fieldCount := 8 6752 6752 6753 6753 if t.Body == nil { 6754 6754 fieldCount-- ··· 6859 6859 return err 6860 6860 } 6861 6861 6862 - // t.PullId (int64) (int64) 6863 - if len("pullId") > 1000000 { 6864 - return xerrors.Errorf("Value in field \"pullId\" was too long") 6865 - } 6866 - 6867 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pullId"))); err != nil { 6868 - return err 6869 - } 6870 - if _, err := cw.WriteString(string("pullId")); err != nil { 6871 - return err 6872 - } 6873 - 6874 - if t.PullId >= 0 { 6875 - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.PullId)); err != nil { 6876 - return err 6877 - } 6878 - } else { 6879 - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.PullId-1)); err != nil { 6880 - return err 6881 - } 6882 - } 6883 - 6884 6862 // t.Source (tangled.RepoPull_Source) (struct) 6885 6863 if t.Source != nil { 6886 6864 ··· 7066 7044 7067 7045 t.Title = string(sval) 7068 7046 } 7069 - // t.PullId (int64) (int64) 7070 - case "pullId": 7071 - { 7072 - maj, extra, err := cr.ReadHeader() 7073 - if err != nil { 7074 - return err 7075 - } 7076 - var extraI int64 7077 - switch maj { 7078 - case cbg.MajUnsignedInt: 7079 - extraI = int64(extra) 7080 - if extraI < 0 { 7081 - return fmt.Errorf("int64 positive overflow") 7082 - } 7083 - case cbg.MajNegativeInt: 7084 - extraI = int64(extra) 7085 - if extraI < 0 { 7086 - return fmt.Errorf("int64 negative overflow") 7087 - } 7088 - extraI = -1 - extraI 7089 - default: 7090 - return fmt.Errorf("wrong type for int64 field: %d", maj) 7091 - } 7092 - 7093 - t.PullId = int64(extraI) 7094 - } 7095 7047 // t.Source (tangled.RepoPull_Source) (struct) 7096 7048 case "source": 7097 7049
-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
··· 1091 1091 Record: &lexutil.LexiconTypeDecoder{ 1092 1092 Val: &tangled.RepoPull{ 1093 1093 Title: title, 1094 - PullId: int64(pullId), 1095 1094 TargetRepo: string(f.RepoAt), 1096 1095 TargetBranch: targetBranch, 1097 1096 Patch: patch, ··· 1653 1652 Record: &lexutil.LexiconTypeDecoder{ 1654 1653 Val: &tangled.RepoPull{ 1655 1654 Title: pull.Title, 1656 - PullId: int64(pull.PullId), 1657 1655 TargetRepo: string(f.RepoAt), 1658 1656 TargetBranch: pull.TargetBranch, 1659 1657 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 },