Signed-off-by: nelind nel.n.lindberg@gmail.com
+1
-188
api/tangled/cbor_gen.go
+1
-188
api/tangled/cbor_gen.go
···
6814
}
6815
6816
cw := cbg.NewCborWriter(w)
6817
-
fieldCount := 7
6818
-
6819
-
if t.CommentId == nil {
6820
-
fieldCount--
6821
-
}
6822
-
6823
-
if t.Owner == nil {
6824
-
fieldCount--
6825
-
}
6826
-
6827
-
if t.Repo == nil {
6828
-
fieldCount--
6829
-
}
6830
6831
-
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
6832
return err
6833
}
6834
···
6878
return err
6879
}
6880
6881
-
// t.Repo (string) (string)
6882
-
if t.Repo != nil {
6883
-
6884
-
if len("repo") > 1000000 {
6885
-
return xerrors.Errorf("Value in field \"repo\" was too long")
6886
-
}
6887
-
6888
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
6889
-
return err
6890
-
}
6891
-
if _, err := cw.WriteString(string("repo")); err != nil {
6892
-
return err
6893
-
}
6894
-
6895
-
if t.Repo == nil {
6896
-
if _, err := cw.Write(cbg.CborNull); err != nil {
6897
-
return err
6898
-
}
6899
-
} else {
6900
-
if len(*t.Repo) > 1000000 {
6901
-
return xerrors.Errorf("Value in field t.Repo was too long")
6902
-
}
6903
-
6904
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Repo))); err != nil {
6905
-
return err
6906
-
}
6907
-
if _, err := cw.WriteString(string(*t.Repo)); err != nil {
6908
-
return err
6909
-
}
6910
-
}
6911
-
}
6912
-
6913
// t.LexiconTypeID (string) (string)
6914
if len("$type") > 1000000 {
6915
return xerrors.Errorf("Value in field \"$type\" was too long")
···
6929
return err
6930
}
6931
6932
-
// t.Owner (string) (string)
6933
-
if t.Owner != nil {
6934
-
6935
-
if len("owner") > 1000000 {
6936
-
return xerrors.Errorf("Value in field \"owner\" was too long")
6937
-
}
6938
-
6939
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("owner"))); err != nil {
6940
-
return err
6941
-
}
6942
-
if _, err := cw.WriteString(string("owner")); err != nil {
6943
-
return err
6944
-
}
6945
-
6946
-
if t.Owner == nil {
6947
-
if _, err := cw.Write(cbg.CborNull); err != nil {
6948
-
return err
6949
-
}
6950
-
} else {
6951
-
if len(*t.Owner) > 1000000 {
6952
-
return xerrors.Errorf("Value in field t.Owner was too long")
6953
-
}
6954
-
6955
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Owner))); err != nil {
6956
-
return err
6957
-
}
6958
-
if _, err := cw.WriteString(string(*t.Owner)); err != nil {
6959
-
return err
6960
-
}
6961
-
}
6962
-
}
6963
-
6964
-
// t.CommentId (int64) (int64)
6965
-
if t.CommentId != nil {
6966
-
6967
-
if len("commentId") > 1000000 {
6968
-
return xerrors.Errorf("Value in field \"commentId\" was too long")
6969
-
}
6970
-
6971
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commentId"))); err != nil {
6972
-
return err
6973
-
}
6974
-
if _, err := cw.WriteString(string("commentId")); err != nil {
6975
-
return err
6976
-
}
6977
-
6978
-
if t.CommentId == nil {
6979
-
if _, err := cw.Write(cbg.CborNull); err != nil {
6980
-
return err
6981
-
}
6982
-
} else {
6983
-
if *t.CommentId >= 0 {
6984
-
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.CommentId)); err != nil {
6985
-
return err
6986
-
}
6987
-
} else {
6988
-
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.CommentId-1)); err != nil {
6989
-
return err
6990
-
}
6991
-
}
6992
-
}
6993
-
6994
-
}
6995
-
6996
// t.CreatedAt (string) (string)
6997
if len("createdAt") > 1000000 {
6998
return xerrors.Errorf("Value in field \"createdAt\" was too long")
···
7081
7082
t.Pull = string(sval)
7083
}
7084
-
// t.Repo (string) (string)
7085
-
case "repo":
7086
-
7087
-
{
7088
-
b, err := cr.ReadByte()
7089
-
if err != nil {
7090
-
return err
7091
-
}
7092
-
if b != cbg.CborNull[0] {
7093
-
if err := cr.UnreadByte(); err != nil {
7094
-
return err
7095
-
}
7096
-
7097
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7098
-
if err != nil {
7099
-
return err
7100
-
}
7101
-
7102
-
t.Repo = (*string)(&sval)
7103
-
}
7104
-
}
7105
// t.LexiconTypeID (string) (string)
7106
case "$type":
7107
···
7113
7114
t.LexiconTypeID = string(sval)
7115
}
7116
-
// t.Owner (string) (string)
7117
-
case "owner":
7118
-
7119
-
{
7120
-
b, err := cr.ReadByte()
7121
-
if err != nil {
7122
-
return err
7123
-
}
7124
-
if b != cbg.CborNull[0] {
7125
-
if err := cr.UnreadByte(); err != nil {
7126
-
return err
7127
-
}
7128
-
7129
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7130
-
if err != nil {
7131
-
return err
7132
-
}
7133
-
7134
-
t.Owner = (*string)(&sval)
7135
-
}
7136
-
}
7137
-
// t.CommentId (int64) (int64)
7138
-
case "commentId":
7139
-
{
7140
-
7141
-
b, err := cr.ReadByte()
7142
-
if err != nil {
7143
-
return err
7144
-
}
7145
-
if b != cbg.CborNull[0] {
7146
-
if err := cr.UnreadByte(); err != nil {
7147
-
return err
7148
-
}
7149
-
maj, extra, err := cr.ReadHeader()
7150
-
if err != nil {
7151
-
return err
7152
-
}
7153
-
var extraI int64
7154
-
switch maj {
7155
-
case cbg.MajUnsignedInt:
7156
-
extraI = int64(extra)
7157
-
if extraI < 0 {
7158
-
return fmt.Errorf("int64 positive overflow")
7159
-
}
7160
-
case cbg.MajNegativeInt:
7161
-
extraI = int64(extra)
7162
-
if extraI < 0 {
7163
-
return fmt.Errorf("int64 negative overflow")
7164
-
}
7165
-
extraI = -1 - extraI
7166
-
default:
7167
-
return fmt.Errorf("wrong type for int64 field: %d", maj)
7168
-
}
7169
-
7170
-
t.CommentId = (*int64)(&extraI)
7171
-
}
7172
-
}
7173
// t.CreatedAt (string) (string)
7174
case "createdAt":
7175
···
6814
}
6815
6816
cw := cbg.NewCborWriter(w)
6817
6818
+
if _, err := cw.Write([]byte{164}); err != nil {
6819
return err
6820
}
6821
···
6865
return err
6866
}
6867
6868
// t.LexiconTypeID (string) (string)
6869
if len("$type") > 1000000 {
6870
return xerrors.Errorf("Value in field \"$type\" was too long")
···
6884
return err
6885
}
6886
6887
// t.CreatedAt (string) (string)
6888
if len("createdAt") > 1000000 {
6889
return xerrors.Errorf("Value in field \"createdAt\" was too long")
···
6972
6973
t.Pull = string(sval)
6974
}
6975
// t.LexiconTypeID (string) (string)
6976
case "$type":
6977
···
6983
6984
t.LexiconTypeID = string(sval)
6985
}
6986
// t.CreatedAt (string) (string)
6987
case "createdAt":
6988
+4
-7
api/tangled/pullcomment.go
+4
-7
api/tangled/pullcomment.go
···
17
} //
18
// RECORDTYPE: RepoPullComment
19
type RepoPullComment struct {
20
-
LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull.comment" cborgen:"$type,const=sh.tangled.repo.pull.comment"`
21
-
Body string `json:"body" cborgen:"body"`
22
-
CommentId *int64 `json:"commentId,omitempty" cborgen:"commentId,omitempty"`
23
-
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
24
-
Owner *string `json:"owner,omitempty" cborgen:"owner,omitempty"`
25
-
Pull string `json:"pull" cborgen:"pull"`
26
-
Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"`
27
}
···
17
} //
18
// RECORDTYPE: RepoPullComment
19
type RepoPullComment struct {
20
+
LexiconTypeID string `json:"$type,const=sh.tangled.repo.pull.comment" cborgen:"$type,const=sh.tangled.repo.pull.comment"`
21
+
Body string `json:"body" cborgen:"body"`
22
+
CreatedAt string `json:"createdAt" cborgen:"createdAt"`
23
+
Pull string `json:"pull" cborgen:"pull"`
24
}
-4
appview/pulls/pulls.go
-4
appview/pulls/pulls.go
···
608
defer tx.Rollback()
609
610
createdAt := time.Now().Format(time.RFC3339)
611
-
ownerDid := user.Did
612
613
pullAt, err := db.GetPullAt(s.db, f.RepoAt(), pull.PullId)
614
if err != nil {
···
617
return
618
}
619
620
-
atUri := f.RepoAt().String()
621
client, err := s.oauth.AuthorizedClient(r)
622
if err != nil {
623
log.Println("failed to get authorized client", err)
···
630
Rkey: tid.TID(),
631
Record: &lexutil.LexiconTypeDecoder{
632
Val: &tangled.RepoPullComment{
633
-
Repo: &atUri,
634
Pull: string(pullAt),
635
-
Owner: &ownerDid,
636
Body: body,
637
CreatedAt: createdAt,
638
},
···
608
defer tx.Rollback()
609
610
createdAt := time.Now().Format(time.RFC3339)
611
612
pullAt, err := db.GetPullAt(s.db, f.RepoAt(), pull.PullId)
613
if err != nil {
···
616
return
617
}
618
619
client, err := s.oauth.AuthorizedClient(r)
620
if err != nil {
621
log.Println("failed to get authorized client", err)
···
628
Rkey: tid.TID(),
629
Record: &lexutil.LexiconTypeDecoder{
630
Val: &tangled.RepoPullComment{
631
Pull: string(pullAt),
632
Body: body,
633
CreatedAt: createdAt,
634
},
-11
lexicons/pulls/comment.json
-11
lexicons/pulls/comment.json