Comments (6)
Since the posts endpoint will have pagination, should we just be getting the first page of posts here, somehow? Or maybe we should be getting just posts with status open?
Should the records be included, or just the relationships?
from deprecated-code-corps-rails-api.
@begedin is there a better way to do this on ember side probably? And API endpoint for /projects/:id/posts
or something would hit that anyway.
from deprecated-code-corps-rails-api.
I'm not sure exactly, but generally speaking, I don't think ember likes using nested routes on it's own.
There's a linking feature defined in JSON API, where you can specify links for related records in the parent record. This link would be an URL to the route that retrieves those related records.
I'm not sure if ember-data already supports this feature. If it does, then a nested route makes sense.
Assuming it doesn't, the default behavior is that it will check the relationships object on the project, figure out there's a posts relationship and then, if those posts aren't in the included
object, fetch them using the "GET /posts/"
route, using an array of ids as a parameter.
For us this means
- If ember data supports links, implement that feature on the API side, and expose the nested route
- If it doesn't, add support for filtering through an array of ids on the
GET /posts
endpoint - Either way, we need to decide how many records, if any, we include with the
project
record itself.
from deprecated-code-corps-rails-api.
@joshsmith The more I think about it, the more sense it makes to me not to include anything except maybe the relationships part (not actual include).
The way I see it, it's easier to fetch posts via GET /posts?filter[project_id]=x&page[number]=y&page[size]=z
, which is the standard way of doing it.
In the case of an RSpec get request, this would be equivalent to
get /posts, { filter: { project_id: x }, page: { number: y, size: z } }
Basically, I'm thinking most client apps will have a project page, with either special sections or subpages containing posts in general, or per category. We can add pagination to those subsections, which will then trigger requests to get the first page of posts for that specific project, with controls to switch pages.
In the case of an Ember app, it would be
The post list component would then fetch the first page of posts and have controls which fetch other pages, based on how we want to implement it.
This way, we don't need to include anything.
from deprecated-code-corps-rails-api.
Does this need to be closed?
from deprecated-code-corps-rails-api.
I believe so. Currently, we're fetching posts explicitly, after loading the project. As we discussed, we're avoiding having includes with the project. Relationships are fine, but includes are an issue.
from deprecated-code-corps-rails-api.
Related Issues (20)
- Document User Categories API HOT 1
- Document User Roles API
- Document User Skills API
- Document Users API HOT 1
- Clarify that bin/setup must be run in new terminal window
- Find a way to deploy branch commits HOT 2
- Add ability to assign tasks HOT 1
- Reference GitHub repositories in a project HOT 1
- Reference GitHub repositories in a post HOT 1
- Add project updates to projects HOT 1
- Add GitHub authentication HOT 1
- Connect GitHub repositories to projects HOT 1
- Add the ability to push to Apiary in Circle HOT 2
- Documentation - Issue with credential exchange
- RFC - API Documentation Guidelines HOT 9
- Change wording in role skills
- Make changes suggested by API Blueprint linter
- Find better way of documenting coalesced ids
- Rework User Skills and Role Skills to remove "join table" references
- Fix project#create to respond according to JSON API spec
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deprecated-code-corps-rails-api.