server/general: rename _fields to fields
This commit is contained in:
parent
9e13c05517
commit
e9fb93d5c8
4 changed files with 6 additions and 6 deletions
4
API.md
4
API.md
|
@ -129,14 +129,14 @@ For performance considerations, sometimes the client might want to choose the
|
|||
fields the server sends to it in order to improve the query speed. This
|
||||
customization is available for top-level fields of most of the
|
||||
[resources](#resources). To choose the fields, the client should pass
|
||||
`?_fields=field1,field2,...` suffix to the query. This works regardless of the
|
||||
`?fields=field1,field2,...` suffix to the query. This works regardless of the
|
||||
requesttype (`GET`, `PUT` etc.).
|
||||
|
||||
For example, to list posts while getting only their IDs and tags, the client
|
||||
should send a `GET` query like this:
|
||||
|
||||
```
|
||||
GET /posts/?_fields=id,tags
|
||||
GET /posts/?fields=id,tags
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class PostsController {
|
|||
requestPage: page => {
|
||||
const text = this._decorateSearchQuery(ctx.searchQuery.text);
|
||||
return api.get(
|
||||
`/posts/?query=${text}&page=${page}&pageSize=40&_fields=` +
|
||||
`/posts/?query=${text}&page=${page}&pageSize=40&fields=` +
|
||||
`id,type,tags,score,favoriteCount,` +
|
||||
`commentCount,thumbnailUrl`);
|
||||
},
|
||||
|
@ -64,7 +64,7 @@ class PostsController {
|
|||
topNavController.activate('posts');
|
||||
Promise.all([
|
||||
api.get('/post/' + id),
|
||||
api.get(`/post/${id}/around?_fields=id&query=`
|
||||
api.get(`/post/${id}/around?fields=id&query=`
|
||||
+ this._decorateSearchQuery('')),
|
||||
]).then(responses => {
|
||||
const [postResponse, aroundResponse] = responses;
|
||||
|
|
|
@ -208,7 +208,7 @@ class TagsController {
|
|||
requestPage: page => {
|
||||
const text = ctx.searchQuery.text;
|
||||
return api.get(
|
||||
`/tags/?query=${text}&page=${page}&pageSize=50&_fields=` +
|
||||
`/tags/?query=${text}&page=${page}&pageSize=50&fields=` +
|
||||
`names,suggestions,implications,lastEditTime,usages`);
|
||||
},
|
||||
headerRenderer: this._tagsHeaderView,
|
||||
|
|
|
@ -7,7 +7,7 @@ from contextlib import contextmanager
|
|||
from szurubooru import errors
|
||||
|
||||
def get_serialization_options(ctx):
|
||||
return ctx.get_param_as_list('_fields', required=False, default=None)
|
||||
return ctx.get_param_as_list('fields', required=False, default=None)
|
||||
|
||||
def serialize_entity(entity, field_factories, options):
|
||||
if not entity:
|
||||
|
|
Loading…
Reference in a new issue