-
-
Notifications
You must be signed in to change notification settings - Fork 57
Closed
Labels
Description
GitHub
What
Given the following model declarations:
const db = factory({
user: {
id: primaryKey(String),
posts: manyOf('post')
},
post: {
slug: primaryKey(String)
}
})And called db.user.toHandlers, the following relation handlers must be created in addition to the default CRUD handlers:
GET /users/:id/posts, returns all posts that belong to the user.GET /users/:id/posts/:slug, returns a post by a slug that belongs to the user.
I'd say that PUT and DELETE methods shouldn't be nested in this way, forcing you to update/delete a post instance directly (i.e. PUT /posts/:slug).
Questions
- Should
oneOfrelations pluralize the model name in the handler URL?