diff --git a/posts/handler/posts.go b/posts/handler/posts.go index dedc380..8e970e7 100644 --- a/posts/handler/posts.go +++ b/posts/handler/posts.go @@ -197,23 +197,11 @@ func (p *Posts) Index(ctx context.Context, req *proto.IndexRequest, rsp *proto.I return err } - // model does not deal with limits yet - limit := int(req.Limit) - - // TODO: implement offset - if limit == 0 { - limit = 20 - } - // set the limit to length of posts - if v := len(posts); v < limit { - limit = v - } - // iterate and add - for i := 0; i < limit; i++ { + for _, post := range posts { // strip the content - posts[i].Content = "" - rsp.Posts = append(rsp.Posts, posts[i]) + post.Content = "" + rsp.Posts = append(rsp.Posts, post) } return nil @@ -247,19 +235,6 @@ func (p *Posts) Query(ctx context.Context, req *proto.QueryRequest, rsp *proto.Q return err } - // model does not deal with limits yet - limit := int(req.Limit) - - // set the limit to length of posts - if v := len(posts); v < limit { - limit = v - } - - // iterate and add - for i := 0; i < limit; i++ { - rsp.Posts = append(rsp.Posts, posts[i]) - } - return nil }