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
··· 6946 6946 } 6947 6947 6948 6948 cw := cbg.NewCborWriter(w) 6949 - fieldCount := 9 6949 + fieldCount := 8 6950 6950 6951 6951 if t.Body == nil { 6952 6952 fieldCount-- ··· 7057 7057 return err 7058 7058 } 7059 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 7060 // t.Source (tangled.RepoPull_Source) (struct) 7083 7061 if t.Source != nil { 7084 7062 ··· 7264 7242 7265 7243 t.Title = string(sval) 7266 7244 } 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 7245 // t.Source (tangled.RepoPull_Source) (struct) 7294 7246 case "source": 7295 7247
-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 },