mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-21 15:05:01 +00:00
Add Image field to posts.Posts (#26)
This commit is contained in:
@@ -65,6 +65,7 @@ func (p *Posts) Save(ctx context.Context, req *proto.SaveRequest, rsp *proto.Sav
|
|||||||
Slug: postSlug,
|
Slug: postSlug,
|
||||||
Created: time.Now().Unix(),
|
Created: time.Now().Unix(),
|
||||||
Metadata: req.Metadata,
|
Metadata: req.Metadata,
|
||||||
|
Image: req.Image,
|
||||||
}
|
}
|
||||||
err := p.savePost(ctx, nil, post)
|
err := p.savePost(ctx, nil, post)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -83,6 +84,7 @@ func (p *Posts) Save(ctx context.Context, req *proto.SaveRequest, rsp *proto.Sav
|
|||||||
Created: oldPost.Created,
|
Created: oldPost.Created,
|
||||||
Updated: time.Now().Unix(),
|
Updated: time.Now().Unix(),
|
||||||
Metadata: req.Metadata,
|
Metadata: req.Metadata,
|
||||||
|
Image: req.Image,
|
||||||
}
|
}
|
||||||
if len(req.Title) > 0 {
|
if len(req.Title) > 0 {
|
||||||
post.Title = req.Title
|
post.Title = req.Title
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ type Post struct {
|
|||||||
Author string `protobuf:"bytes,7,opt,name=author,proto3" json:"author,omitempty"`
|
Author string `protobuf:"bytes,7,opt,name=author,proto3" json:"author,omitempty"`
|
||||||
Tags []string `protobuf:"bytes,8,rep,name=tags,proto3" json:"tags,omitempty"`
|
Tags []string `protobuf:"bytes,8,rep,name=tags,proto3" json:"tags,omitempty"`
|
||||||
Metadata map[string]string `protobuf:"bytes,9,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
Metadata map[string]string `protobuf:"bytes,9,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||||
|
Image string `protobuf:"bytes,19,opt,name=image,proto3" json:"image,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
XXX_sizecache int32 `json:"-"`
|
XXX_sizecache int32 `json:"-"`
|
||||||
@@ -123,6 +124,13 @@ func (m *Post) GetMetadata() map[string]string {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Post) GetImage() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Image
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// Query posts. Acts as a listing when no id or slug provided.
|
// Query posts. Acts as a listing when no id or slug provided.
|
||||||
// Gets a single post by id or slug if any of them provided.
|
// Gets a single post by id or slug if any of them provided.
|
||||||
type QueryRequest struct {
|
type QueryRequest struct {
|
||||||
@@ -245,6 +253,7 @@ type SaveRequest struct {
|
|||||||
// send a list of tags with only one member being an empty string [""]
|
// send a list of tags with only one member being an empty string [""]
|
||||||
Tags []string `protobuf:"bytes,6,rep,name=tags,proto3" json:"tags,omitempty"`
|
Tags []string `protobuf:"bytes,6,rep,name=tags,proto3" json:"tags,omitempty"`
|
||||||
Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||||
|
Image string `protobuf:"bytes,8,opt,name=image,proto3" json:"image,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
XXX_sizecache int32 `json:"-"`
|
XXX_sizecache int32 `json:"-"`
|
||||||
@@ -324,6 +333,13 @@ func (m *SaveRequest) GetMetadata() map[string]string {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *SaveRequest) GetImage() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Image
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type SaveResponse struct {
|
type SaveResponse struct {
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
@@ -450,32 +466,33 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptor_e93dc7d934d9dc10 = []byte{
|
var fileDescriptor_e93dc7d934d9dc10 = []byte{
|
||||||
// 430 bytes of a gzipped FileDescriptorProto
|
// 447 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x53, 0x4b, 0x0f, 0xd2, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x54, 0xcb, 0xae, 0xd3, 0x40,
|
||||||
0x10, 0xb6, 0x4f, 0x60, 0x78, 0x04, 0x07, 0x34, 0x6b, 0x63, 0x14, 0x7b, 0xf2, 0x84, 0x11, 0x35,
|
0x0c, 0x25, 0xcf, 0xb6, 0xee, 0xed, 0x55, 0x71, 0x0b, 0x1a, 0x22, 0x04, 0x25, 0x2b, 0x56, 0x45,
|
||||||
0x1a, 0xf5, 0xa8, 0x47, 0x13, 0xad, 0xbf, 0x60, 0x95, 0x05, 0x1b, 0xfb, 0xb2, 0xbb, 0x25, 0xe1,
|
0x14, 0x10, 0x08, 0x58, 0xc2, 0x12, 0x09, 0xc2, 0x17, 0x0c, 0x74, 0x5a, 0x22, 0xf2, 0x22, 0x33,
|
||||||
0x4f, 0xf8, 0x3f, 0xbc, 0xf8, 0x1b, 0xdd, 0x57, 0x6b, 0x8b, 0x72, 0xd3, 0xdb, 0x7c, 0x33, 0xdd,
|
0xa9, 0xd4, 0xff, 0x61, 0xc3, 0x7f, 0xf0, 0x61, 0xcc, 0x2b, 0x21, 0x29, 0x54, 0x77, 0xd3, 0x9d,
|
||||||
0x99, 0xef, 0x01, 0x70, 0xb3, 0xaa, 0x4b, 0x51, 0x3e, 0xaa, 0x4a, 0x2e, 0xf8, 0x56, 0xd7, 0x18,
|
0x8f, 0x3d, 0xb6, 0x8f, 0xcf, 0x89, 0x02, 0xb7, 0xab, 0xba, 0x14, 0xe5, 0x93, 0xaa, 0xe4, 0x82,
|
||||||
0x68, 0x10, 0xff, 0x74, 0xc1, 0x7f, 0x2f, 0x2b, 0x5c, 0x80, 0x9b, 0xee, 0x89, 0xb3, 0x71, 0x1e,
|
0xaf, 0x75, 0x8c, 0x81, 0x06, 0xf1, 0x6f, 0x17, 0xfc, 0x8f, 0x32, 0xc2, 0x6b, 0x70, 0xd3, 0x2d,
|
||||||
0x4e, 0x12, 0x59, 0xe1, 0x1a, 0x02, 0x91, 0x8a, 0x8c, 0x11, 0x57, 0xb7, 0x0c, 0x40, 0x04, 0x9f,
|
0x71, 0x56, 0xce, 0xe3, 0x49, 0x22, 0x23, 0x5c, 0x42, 0x20, 0x52, 0x91, 0x31, 0xe2, 0xea, 0x94,
|
||||||
0x67, 0xcd, 0x91, 0x78, 0xba, 0xa9, 0x6b, 0x24, 0x30, 0xfa, 0x5c, 0x16, 0x82, 0x15, 0x82, 0xf8,
|
0x01, 0x88, 0xe0, 0xf3, 0xac, 0xd9, 0x13, 0x4f, 0x27, 0x75, 0x8c, 0x04, 0x46, 0x5f, 0xcb, 0x42,
|
||||||
0xba, 0xdd, 0x42, 0x3d, 0xa9, 0x19, 0x15, 0x6c, 0x4f, 0x02, 0x39, 0xf1, 0x92, 0x16, 0xaa, 0x49,
|
0xb0, 0x42, 0x10, 0x5f, 0xa7, 0x5b, 0xa8, 0x2b, 0x35, 0xa3, 0x82, 0x6d, 0x49, 0x20, 0x2b, 0x5e,
|
||||||
0x53, 0xed, 0xf5, 0x24, 0x34, 0x13, 0x0b, 0xf1, 0x36, 0x84, 0xb4, 0x11, 0x5f, 0xca, 0x9a, 0x8c,
|
0xd2, 0x42, 0x55, 0x69, 0xaa, 0xad, 0xae, 0x84, 0xa6, 0x62, 0x21, 0xde, 0x85, 0x90, 0x36, 0xe2,
|
||||||
0xf4, 0x32, 0x8b, 0xd4, 0x65, 0x41, 0x8f, 0x9c, 0x8c, 0x37, 0x9e, 0xba, 0xac, 0x6a, 0x7c, 0x06,
|
0x5b, 0x59, 0x93, 0x91, 0x1e, 0x66, 0x91, 0xda, 0x2c, 0xe8, 0x9e, 0x93, 0xf1, 0xca, 0x53, 0x9b,
|
||||||
0xe3, 0x9c, 0x09, 0x2a, 0x1f, 0x52, 0x32, 0x91, 0xfd, 0xe9, 0xee, 0xce, 0xd6, 0x68, 0x54, 0x92,
|
0x55, 0x8c, 0x2f, 0x60, 0x9c, 0x33, 0x41, 0x65, 0x23, 0x25, 0x13, 0x99, 0x9f, 0x6e, 0xee, 0xad,
|
||||||
0xb6, 0xef, 0xec, 0xec, 0x6d, 0x21, 0xea, 0x73, 0xd2, 0x7d, 0x1a, 0xbd, 0x82, 0xf9, 0x60, 0x84,
|
0xcd, 0x8d, 0xea, 0xa4, 0xf5, 0x07, 0x5b, 0x7b, 0x5f, 0x88, 0xfa, 0x98, 0x74, 0x4f, 0xd5, 0x69,
|
||||||
0x4b, 0xf0, 0xbe, 0xb2, 0xb3, 0x15, 0xaf, 0x4a, 0xa5, 0xfe, 0x44, 0xb3, 0xa6, 0x53, 0xaf, 0xc1,
|
0x69, 0x4e, 0xf7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4, 0x6f, 0xb8, 0xb0, 0x47, 0xf6, 0xbf, 0x9c, 0x68, 0x39, 0x4c, 0x9a, 0xee, 0xf8,
|
||||||
0x04, 0xb6, 0x4b, 0x07, 0xa4, 0xa3, 0x5b, 0x17, 0xdd, 0xf6, 0xe1, 0xa7, 0x50, 0xff, 0xed, 0x9f,
|
0x16, 0x3e, 0x05, 0x5f, 0x51, 0x42, 0xfc, 0x57, 0x99, 0x68, 0x31, 0xc8, 0x75, 0x2d, 0x2f, 0x21,
|
||||||
0xfc, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x50, 0xbf, 0x89, 0x8b, 0x0b, 0x04, 0x00, 0x00,
|
0x34, 0x24, 0xb0, 0x1d, 0x3a, 0x20, 0x1d, 0xdd, 0x39, 0xc9, 0xb6, 0x8d, 0x5f, 0x42, 0xfd, 0x8b,
|
||||||
|
0x78, 0xf6, 0x27, 0x00, 0x00, 0xff, 0xff, 0x17, 0x84, 0x7a, 0xa4, 0x37, 0x04, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ message Post {
|
|||||||
string author = 7;
|
string author = 7;
|
||||||
repeated string tags = 8;
|
repeated string tags = 8;
|
||||||
map<string,string> metadata = 9;
|
map<string,string> metadata = 9;
|
||||||
|
string image = 19;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query posts. Acts as a listing when no id or slug provided.
|
// Query posts. Acts as a listing when no id or slug provided.
|
||||||
@@ -45,6 +46,7 @@ message SaveRequest {
|
|||||||
// send a list of tags with only one member being an empty string [""]
|
// send a list of tags with only one member being an empty string [""]
|
||||||
repeated string tags = 6;
|
repeated string tags = 6;
|
||||||
map<string,string> metadata = 7;
|
map<string,string> metadata = 7;
|
||||||
|
string image = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SaveResponse {
|
message SaveResponse {
|
||||||
|
|||||||
Reference in New Issue
Block a user