forked from tangled.org/core
this repo has no description

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>

nel.pet d987a38c f5338509

verified
Changed files
+1 -57
api
appview
db
pulls
lexicons
pulls
+1 -49
api/tangled/cbor_gen.go
··· 6946 } 6947 6948 cw := cbg.NewCborWriter(w) 6949 - fieldCount := 9 6950 6951 if t.Body == nil { 6952 fieldCount-- ··· 7055 } 7056 if _, err := cw.WriteString(string(t.Title)); err != nil { 7057 return err 7058 - } 7059 - 7060 - // t.PullId (int64) (int64) 7061 - if len("pullId") > 1000000 { 7062 - return xerrors.Errorf("Value in field \"pullId\" was too long") 7063 - } 7064 - 7065 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pullId"))); err != nil { 7066 - return err 7067 - } 7068 - if _, err := cw.WriteString(string("pullId")); err != nil { 7069 - return err 7070 - } 7071 - 7072 - if t.PullId >= 0 { 7073 - if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.PullId)); err != nil { 7074 - return err 7075 - } 7076 - } else { 7077 - if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.PullId-1)); err != nil { 7078 - return err 7079 - } 7080 } 7081 7082 // t.Source (tangled.RepoPull_Source) (struct) ··· 7263 } 7264 7265 t.Title = string(sval) 7266 - } 7267 - // t.PullId (int64) (int64) 7268 - case "pullId": 7269 - { 7270 - maj, extra, err := cr.ReadHeader() 7271 - if err != nil { 7272 - return err 7273 - } 7274 - var extraI int64 7275 - switch maj { 7276 - case cbg.MajUnsignedInt: 7277 - extraI = int64(extra) 7278 - if extraI < 0 { 7279 - return fmt.Errorf("int64 positive overflow") 7280 - } 7281 - case cbg.MajNegativeInt: 7282 - extraI = int64(extra) 7283 - if extraI < 0 { 7284 - return fmt.Errorf("int64 negative overflow") 7285 - } 7286 - extraI = -1 - extraI 7287 - default: 7288 - return fmt.Errorf("wrong type for int64 field: %d", maj) 7289 - } 7290 - 7291 - t.PullId = int64(extraI) 7292 } 7293 // t.Source (tangled.RepoPull_Source) (struct) 7294 case "source":
··· 6946 } 6947 6948 cw := cbg.NewCborWriter(w) 6949 + fieldCount := 8 6950 6951 if t.Body == nil { 6952 fieldCount-- ··· 7055 } 7056 if _, err := cw.WriteString(string(t.Title)); err != nil { 7057 return err 7058 } 7059 7060 // t.Source (tangled.RepoPull_Source) (struct) ··· 7241 } 7242 7243 t.Title = string(sval) 7244 } 7245 // t.Source (tangled.RepoPull_Source) (struct) 7246 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
··· 1030 Record: &lexutil.LexiconTypeDecoder{ 1031 Val: &tangled.RepoPull{ 1032 Title: title, 1033 - PullId: int64(pullId), 1034 TargetRepo: string(f.RepoAt), 1035 TargetBranch: targetBranch, 1036 Patch: patch, ··· 1592 Record: &lexutil.LexiconTypeDecoder{ 1593 Val: &tangled.RepoPull{ 1594 Title: pull.Title, 1595 - PullId: int64(pull.PullId), 1596 TargetRepo: string(f.RepoAt), 1597 TargetBranch: pull.TargetBranch, 1598 Patch: patch, // new patch
··· 1030 Record: &lexutil.LexiconTypeDecoder{ 1031 Val: &tangled.RepoPull{ 1032 Title: title, 1033 TargetRepo: string(f.RepoAt), 1034 TargetBranch: targetBranch, 1035 Patch: patch, ··· 1591 Record: &lexutil.LexiconTypeDecoder{ 1592 Val: &tangled.RepoPull{ 1593 Title: pull.Title, 1594 TargetRepo: string(f.RepoAt), 1595 TargetBranch: pull.TargetBranch, 1596 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"