Blog changes + tests (#4)

* Blog changes + tests

* Fix build

* Fix

* Add back step

* Fix logger

* Fix test

* Typo

* Better test

* Changes to tests

* Update micro

* Fixing all them things

* Fixing even more things :))

* Bump micro

* Fix posts and tags by following micro changes

* Trying to pin workflow to correct micro version

* huh

* Bump go micro

* Add etcd replace

* Changing a bunch of things

* Denormalize to fix bug

* Fixes
This commit is contained in:
Janos Dobronszki
2020-10-15 15:09:59 +02:00
committed by GitHub
parent 4eb8479f9f
commit 6e8d7f4248
30 changed files with 1203 additions and 1449 deletions

View File

@@ -5,7 +5,7 @@ MODIFY=Mgithub.com/micro/go-micro/api/proto/api.proto=github.com/micro/go-micro/
.PHONY: proto
proto:
protoc --proto_path=. --micro_out=${MODIFY}:. --go_out=${MODIFY}:. proto/post/post.proto
protoc --proto_path=. --micro_out=${MODIFY}:. --go_out=${MODIFY}:. proto/posts/posts.proto
.PHONY: build

View File

@@ -8,7 +8,6 @@ import (
"time"
"github.com/micro/go-micro/v3/errors"
gostore "github.com/micro/go-micro/v3/store"
"github.com/micro/micro/v3/service/logger"
"github.com/micro/micro/v3/service/store"
@@ -32,7 +31,7 @@ type Post struct {
Content string `json:"content"`
CreateTimestamp int64 `json:"create_timestamp"`
UpdateTimestamp int64 `json:"update_timestamp"`
TagNames []string `json:"tagNames"`
Tags []string `json:"tags"`
}
type Posts struct {
@@ -40,23 +39,23 @@ type Posts struct {
}
func (p *Posts) Save(ctx context.Context, req *posts.SaveRequest, rsp *posts.SaveResponse) error {
if len(req.Post.Id) == 0 || len(req.Post.Title) == 0 || len(req.Post.Content) == 0 {
if len(req.Id) == 0 || len(req.Title) == 0 || len(req.Content) == 0 {
return errors.BadRequest("posts.save.input-check", "Id, title or content is missing")
}
// read by post
records, err := store.Read(fmt.Sprintf("%v:%v", idPrefix, req.Post.Id))
if err != nil && err != gostore.ErrNotFound {
records, err := store.Read(fmt.Sprintf("%v:%v", idPrefix, req.Id))
if err != nil && err != store.ErrNotFound {
return errors.InternalServerError("posts.save.store-id-read", "Failed to read post by id: %v", err.Error())
}
postSlug := slug.Make(req.Post.Title)
postSlug := slug.Make(req.Title)
// If no existing record is found, create a new one
if len(records) == 0 {
post := &Post{
ID: req.Post.Id,
Title: req.Post.Title,
Content: req.Post.Content,
TagNames: req.Post.TagNames,
ID: req.Id,
Title: req.Title,
Content: req.Content,
Tags: req.Tags,
Slug: postSlug,
CreateTimestamp: time.Now().Unix(),
}
@@ -73,18 +72,18 @@ func (p *Posts) Save(ctx context.Context, req *posts.SaveRequest, rsp *posts.Sav
return errors.InternalServerError("posts.save.unmarshal", "Failed to unmarshal old post: %v", err.Error())
}
post := &Post{
ID: req.Post.Id,
Title: req.Post.Title,
Content: req.Post.Content,
ID: req.Id,
Title: req.Title,
Content: req.Content,
Slug: postSlug,
TagNames: req.Post.TagNames,
Tags: req.Tags,
CreateTimestamp: oldPost.CreateTimestamp,
UpdateTimestamp: time.Now().Unix(),
}
// Check if slug exists
recordsBySlug, err := store.Read(fmt.Sprintf("%v:%v", slugPrefix, postSlug))
if err != nil && err != gostore.ErrNotFound {
if err != nil && err != store.ErrNotFound {
return errors.InternalServerError("posts.save.store-read", "Failed to read post by slug: %v", err.Error())
}
otherSlugPost := &Post{}
@@ -105,7 +104,7 @@ func (p *Posts) savePost(ctx context.Context, oldPost, post *Post) error {
return err
}
err = store.Write(&gostore.Record{
err = store.Write(&store.Record{
Key: fmt.Sprintf("%v:%v", idPrefix, post.ID),
Value: bytes,
})
@@ -119,14 +118,14 @@ func (p *Posts) savePost(ctx context.Context, oldPost, post *Post) error {
return err
}
}
err = store.Write(&gostore.Record{
err = store.Write(&store.Record{
Key: fmt.Sprintf("%v:%v", slugPrefix, post.Slug),
Value: bytes,
})
if err != nil {
return err
}
err = store.Write(&gostore.Record{
err = store.Write(&store.Record{
Key: fmt.Sprintf("%v:%v", timeStampPrefix, math.MaxInt64-post.CreateTimestamp),
Value: bytes,
})
@@ -134,8 +133,8 @@ func (p *Posts) savePost(ctx context.Context, oldPost, post *Post) error {
return err
}
if oldPost == nil {
for _, tagName := range post.TagNames {
_, err := p.Tags.IncreaseCount(ctx, &tags.IncreaseCountRequest{
for _, tagName := range post.Tags {
_, err := p.Tags.Add(ctx, &tags.AddRequest{
ParentID: post.ID,
Type: tagType,
Title: tagName,
@@ -146,7 +145,7 @@ func (p *Posts) savePost(ctx context.Context, oldPost, post *Post) error {
}
return nil
}
return p.diffTags(ctx, post.ID, oldPost.TagNames, post.TagNames)
return p.diffTags(ctx, post.ID, oldPost.Tags, post.Tags)
}
func (p *Posts) diffTags(ctx context.Context, parentID string, oldTagNames, newTagNames []string) error {
@@ -161,7 +160,7 @@ func (p *Posts) diffTags(ctx context.Context, parentID string, oldTagNames, newT
for i := range oldTags {
_, stillThere := newTags[i]
if !stillThere {
_, err := p.Tags.DecreaseCount(ctx, &tags.DecreaseCountRequest{
_, err := p.Tags.Remove(ctx, &tags.RemoveRequest{
ParentID: parentID,
Type: tagType,
Title: i,
@@ -174,13 +173,13 @@ func (p *Posts) diffTags(ctx context.Context, parentID string, oldTagNames, newT
for i := range newTags {
_, newlyAdded := oldTags[i]
if newlyAdded {
_, err := p.Tags.IncreaseCount(ctx, &tags.IncreaseCountRequest{
_, err := p.Tags.Add(ctx, &tags.AddRequest{
ParentID: parentID,
Type: tagType,
Title: i,
})
if err != nil {
logger.Errorf("Error increasing count for tag '%v' with type '%v' for parent '%v'", i, tagType, parentID)
logger.Errorf("Error increasing count for tag '%v' with type '%v' for parent '%v': %v", i, tagType, parentID, err)
}
}
}
@@ -188,7 +187,7 @@ func (p *Posts) diffTags(ctx context.Context, parentID string, oldTagNames, newT
}
func (p *Posts) Query(ctx context.Context, req *pb.QueryRequest, rsp *pb.QueryResponse) error {
var records []*gostore.Record
var records []*store.Record
var err error
if len(req.Slug) > 0 {
key := fmt.Sprintf("%v:%v", slugPrefix, req.Slug)
@@ -218,11 +217,11 @@ func (p *Posts) Query(ctx context.Context, req *pb.QueryRequest, rsp *pb.QueryRe
return errors.InternalServerError("posts.save.unmarshal", "Failed to unmarshal old post: %v", err.Error())
}
rsp.Posts[i] = &pb.Post{
Id: postRecord.ID,
Title: postRecord.Title,
Slug: postRecord.Slug,
Content: postRecord.Content,
TagNames: postRecord.TagNames,
Id: postRecord.ID,
Title: postRecord.Title,
Slug: postRecord.Slug,
Content: postRecord.Content,
Tags: postRecord.Tags,
}
}
return nil
@@ -231,7 +230,7 @@ func (p *Posts) Query(ctx context.Context, req *pb.QueryRequest, rsp *pb.QueryRe
func (p *Posts) Delete(ctx context.Context, req *pb.DeleteRequest, rsp *pb.DeleteResponse) error {
logger.Info("Received Post.Delete request")
records, err := store.Read(fmt.Sprintf("%v:%v", idPrefix, req.Id))
if err != nil && err != gostore.ErrNotFound {
if err != nil && err != store.ErrNotFound {
return err
}
if len(records) == 0 {

View File

@@ -1,5 +1,5 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: blog/posts/proto/posts/post.proto
// source: proto/posts/posts.proto
package posts
@@ -25,8 +25,10 @@ type Post struct {
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Slug string `protobuf:"bytes,3,opt,name=slug,proto3" json:"slug,omitempty"`
Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"`
Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
TagNames []string `protobuf:"bytes,6,rep,name=tagNames,proto3" json:"tagNames,omitempty"`
Created int64 `protobuf:"varint,5,opt,name=created,proto3" json:"created,omitempty"`
Updated int64 `protobuf:"varint,6,opt,name=updated,proto3" json:"updated,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"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -36,7 +38,7 @@ func (m *Post) Reset() { *m = Post{} }
func (m *Post) String() string { return proto.CompactTextString(m) }
func (*Post) ProtoMessage() {}
func (*Post) Descriptor() ([]byte, []int) {
return fileDescriptor_2d32cca1c2f74735, []int{0}
return fileDescriptor_a1e4efc789192621, []int{0}
}
func (m *Post) XXX_Unmarshal(b []byte) error {
@@ -85,16 +87,30 @@ func (m *Post) GetContent() string {
return ""
}
func (m *Post) GetTimestamp() int64 {
func (m *Post) GetCreated() int64 {
if m != nil {
return m.Timestamp
return m.Created
}
return 0
}
func (m *Post) GetTagNames() []string {
func (m *Post) GetUpdated() int64 {
if m != nil {
return m.TagNames
return m.Updated
}
return 0
}
func (m *Post) GetAuthor() string {
if m != nil {
return m.Author
}
return ""
}
func (m *Post) GetTags() []string {
if m != nil {
return m.Tags
}
return nil
}
@@ -112,7 +128,7 @@ func (m *QueryRequest) Reset() { *m = QueryRequest{} }
func (m *QueryRequest) String() string { return proto.CompactTextString(m) }
func (*QueryRequest) ProtoMessage() {}
func (*QueryRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2d32cca1c2f74735, []int{1}
return fileDescriptor_a1e4efc789192621, []int{1}
}
func (m *QueryRequest) XXX_Unmarshal(b []byte) error {
@@ -165,7 +181,7 @@ func (m *QueryResponse) Reset() { *m = QueryResponse{} }
func (m *QueryResponse) String() string { return proto.CompactTextString(m) }
func (*QueryResponse) ProtoMessage() {}
func (*QueryResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2d32cca1c2f74735, []int{2}
return fileDescriptor_a1e4efc789192621, []int{2}
}
func (m *QueryResponse) XXX_Unmarshal(b []byte) error {
@@ -194,7 +210,12 @@ func (m *QueryResponse) GetPosts() []*Post {
}
type SaveRequest struct {
Post *Post `protobuf:"bytes,1,opt,name=post,proto3" json:"post,omitempty"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Slug string `protobuf:"bytes,3,opt,name=slug,proto3" json:"slug,omitempty"`
Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"`
Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Tags []string `protobuf:"bytes,6,rep,name=tags,proto3" json:"tags,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -204,7 +225,7 @@ func (m *SaveRequest) Reset() { *m = SaveRequest{} }
func (m *SaveRequest) String() string { return proto.CompactTextString(m) }
func (*SaveRequest) ProtoMessage() {}
func (*SaveRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2d32cca1c2f74735, []int{3}
return fileDescriptor_a1e4efc789192621, []int{3}
}
func (m *SaveRequest) XXX_Unmarshal(b []byte) error {
@@ -225,15 +246,50 @@ func (m *SaveRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_SaveRequest proto.InternalMessageInfo
func (m *SaveRequest) GetPost() *Post {
func (m *SaveRequest) GetId() string {
if m != nil {
return m.Post
return m.Id
}
return ""
}
func (m *SaveRequest) GetTitle() string {
if m != nil {
return m.Title
}
return ""
}
func (m *SaveRequest) GetSlug() string {
if m != nil {
return m.Slug
}
return ""
}
func (m *SaveRequest) GetContent() string {
if m != nil {
return m.Content
}
return ""
}
func (m *SaveRequest) GetTimestamp() int64 {
if m != nil {
return m.Timestamp
}
return 0
}
func (m *SaveRequest) GetTags() []string {
if m != nil {
return m.Tags
}
return nil
}
type SaveResponse struct {
Post *Post `protobuf:"bytes,1,opt,name=post,proto3" json:"post,omitempty"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -243,7 +299,7 @@ func (m *SaveResponse) Reset() { *m = SaveResponse{} }
func (m *SaveResponse) String() string { return proto.CompactTextString(m) }
func (*SaveResponse) ProtoMessage() {}
func (*SaveResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2d32cca1c2f74735, []int{4}
return fileDescriptor_a1e4efc789192621, []int{4}
}
func (m *SaveResponse) XXX_Unmarshal(b []byte) error {
@@ -264,11 +320,11 @@ func (m *SaveResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_SaveResponse proto.InternalMessageInfo
func (m *SaveResponse) GetPost() *Post {
func (m *SaveResponse) GetId() string {
if m != nil {
return m.Post
return m.Id
}
return nil
return ""
}
type DeleteRequest struct {
@@ -282,7 +338,7 @@ func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
func (m *DeleteRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteRequest) ProtoMessage() {}
func (*DeleteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_2d32cca1c2f74735, []int{5}
return fileDescriptor_a1e4efc789192621, []int{5}
}
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
@@ -320,7 +376,7 @@ func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_2d32cca1c2f74735, []int{6}
return fileDescriptor_a1e4efc789192621, []int{6}
}
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
@@ -351,30 +407,33 @@ func init() {
proto.RegisterType((*DeleteResponse)(nil), "posts.DeleteResponse")
}
func init() { proto.RegisterFile("blog/posts/proto/posts/post.proto", fileDescriptor_2d32cca1c2f74735) }
var fileDescriptor_2d32cca1c2f74735 = []byte{
// 343 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x4d, 0x4e, 0xc3, 0x30,
0x10, 0x85, 0x71, 0xf3, 0x03, 0x9d, 0xfe, 0x08, 0x4d, 0x0b, 0xb2, 0x22, 0xa4, 0xa6, 0x59, 0x65,
0x95, 0x8a, 0x82, 0xc4, 0x05, 0x58, 0xa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c,
0x24, 0x46, 0x25, 0xd5, 0x32, 0x44, 0xbd, 0x9c, 0x04, 0x06, 0x6f, 0xe9, 0xa7, 0x6c, 0x42, 0xcc,
0xc0, 0xad, 0xb8, 0x09, 0xd1, 0x29, 0x30, 0x17, 0xd1, 0x02, 0x86, 0xf6, 0x7d, 0xdd, 0xe2, 0xdf,
0x82, 0x19, 0x8c, 0x9e, 0x65, 0x2e, 0xa9, 0x6d, 0xd1, 0xf9, 0x0a, 0xd1, 0x35, 0x8c, 0x9b, 0x07,
0xd6, 0x73, 0xf9, 0xc3, 0xc0, 0xab, 0x1c, 0x34, 0x3e, 0x82, 0x67, 0x26, 0xc2, 0x49, 0x6d, 0x7c,
0xba, 0xb1, 0x60, 0x7a, 0x0e, 0x6d, 0x75, 0x74, 0x81, 0xf7, 0xe0, 0x56, 0x19, 0x11, 0xeb, 0xfb,
0x93, 0x01, 0x83, 0xc9, 0x19, 0x6b, 0x4b, 0x9e, 0xc0, 0xb7, 0x21, 0xb0, 0x31, 0x3d, 0x0b, 0x1d,
0xdc, 0x74, 0x68, 0x53, 0xb8, 0xf6, 0xcd, 0xaf, 0xf6, 0xf0, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xd5,
0xd2, 0x06, 0xac, 0x8f, 0x02, 0x00, 0x00,
func init() {
proto.RegisterFile("proto/posts/posts.proto", fileDescriptor_a1e4efc789192621)
}
var fileDescriptor_a1e4efc789192621 = []byte{
// 363 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x52, 0x5d, 0x4e, 0xf3, 0x30,
0x10, 0xfc, 0xd2, 0xfc, 0xf4, 0xeb, 0xf6, 0x47, 0x68, 0x5b, 0xc0, 0xaa, 0x10, 0x94, 0x3c, 0xf5,
0xa9, 0x88, 0x82, 0xc4, 0x05, 0x38, 0x40, 0x09, 0x27, 0x08, 0xd4, 0x2d, 0x91, 0xd2, 0x26, 0xc4,
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0xa6, 0x43, 0x5d, 0x59, 0x62, 0x2b,
0xfc, 0xf0, 0xa0, 0xfb, 0x98, 0xbe, 0x71, 0xe7, 0xe2, 0x2f, 0x9a, 0x3c, 0x83, 0x8e, 0xcc, 0x36,
0x4a, 0x3d, 0xdd, 0x94, 0xb6, 0xcb, 0x1f, 0x62, 0xd7, 0x4d, 0xd4, 0xe8, 0xe6, 0x1c, 0x7a, 0xc6,
0x94, 0x0d, 0x72, 0xe0, 0x2a, 0xbe, 0x80, 0xfe, 0x3d, 0xcf, 0xb9, 0xfc, 0xcd, 0x76, 0x7c, 0x04,
0x03, 0xf7, 0x82, 0x91, 0x98, 0x7f, 0x7a, 0x10, 0xea, 0xe0, 0x02, 0x6f, 0x21, 0xa4, 0x9a, 0x70,
0x68, 0xfb, 0x68, 0x7e, 0x86, 0xf1, 0x68, 0x9f, 0x34, 0xa7, 0xe3, 0x7f, 0x78, 0x0d, 0x81, 0xb6,
0x84, 0x68, 0xf7, 0x8d, 0xd2, 0xc6, 0xc3, 0x3d, 0x6e, 0x77, 0xe4, 0x0e, 0x22, 0x63, 0x02, 0x9d,
0xe8, 0x9e, 0xe9, 0xf1, 0xf1, 0x01, 0xeb, 0x0e, 0x3e, 0x45, 0xf4, 0x97, 0xdf, 0x7c, 0x07, 0x00,
0x00, 0xff, 0xff, 0xed, 0x03, 0x8f, 0x37, 0x00, 0x03, 0x00, 0x00,
}

View File

@@ -1,5 +1,5 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: blog/posts/proto/posts/post.proto
// source: proto/posts/posts.proto
package posts
@@ -11,9 +11,9 @@ import (
import (
context "context"
api "github.com/micro/go-micro/v3/api"
client "github.com/micro/go-micro/v3/client"
server "github.com/micro/go-micro/v3/server"
api "github.com/micro/micro/v3/service/api"
client "github.com/micro/micro/v3/service/client"
server "github.com/micro/micro/v3/service/server"
)
// Reference imports to suppress errors if they are not otherwise used.

View File

@@ -14,8 +14,10 @@ message Post {
string title = 2;
string slug = 3;
string content = 4;
int64 timestamp = 5;
repeated string tagNames = 6;
int64 created = 5;
int64 updated = 6;
string author = 7;
repeated string tags = 8;
}
message QueryRequest {
@@ -29,17 +31,21 @@ message QueryResponse {
}
message SaveRequest {
Post post = 1;
string id = 1;
string title = 2;
string slug = 3;
string content = 4;
int64 timestamp = 5;
repeated string tags = 6;
}
message SaveResponse {
Post post = 1;
string id = 1;
}
message DeleteRequest {
string id = 1;
}
message DeleteResponse {
}
message DeleteResponse {}