diff --git a/public_html/js/Controls/TagInput.js b/public_html/js/Controls/TagInput.js
index 601c38fc..4b107fa1 100644
--- a/public_html/js/Controls/TagInput.js
+++ b/public_html/js/Controls/TagInput.js
@@ -387,7 +387,7 @@ App.Controls.TagInput = function($underlyingInput) {
return promise.make(function(resolve, reject) {
promise.wait(api.get('/tags/' + tagName + '/siblings'))
.then(function(response) {
- resolve(response.json.data);
+ resolve(response.json.tags);
}).fail(function() {
reject();
});
diff --git a/public_html/js/Pager.js b/public_html/js/Pager.js
index 2b15dcc0..08f4cd48 100644
--- a/public_html/js/Pager.js
+++ b/public_html/js/Pager.js
@@ -71,10 +71,7 @@ App.Pager = function(
var totalRecords = response.json.totalRecords;
totalPages = Math.ceil(totalRecords / pageSize);
- resolve({
- entities: response.json.data,
- totalRecords: totalRecords,
- totalPages: totalPages});
+ resolve(response);
}).fail(function(response) {
reject(response);
diff --git a/public_html/js/Presenters/CommentListPresenter.js b/public_html/js/Presenters/CommentListPresenter.js
index dbab4543..ab17278e 100644
--- a/public_html/js/Presenters/CommentListPresenter.js
+++ b/public_html/js/Presenters/CommentListPresenter.js
@@ -53,7 +53,7 @@ App.Presenters.CommentListPresenter = function(
if (comments.length === 0) {
promise.wait(api.get('/comments/' + params.post.id))
.then(function(response) {
- comments = response.json.data;
+ comments = response.json.comments;
render();
}).fail(function() {
console.log(arguments);
@@ -176,7 +176,7 @@ App.Presenters.CommentListPresenter = function(
p.then(function(response) {
$textarea.val('');
- var comment = response.json;
+ var comment = response.json.comment;
if (commentToEdit) {
$form.slideUp(function() {
diff --git a/public_html/js/Presenters/GlobalCommentListPresenter.js b/public_html/js/Presenters/GlobalCommentListPresenter.js
index acb2895f..b5143d2d 100644
--- a/public_html/js/Presenters/GlobalCommentListPresenter.js
+++ b/public_html/js/Presenters/GlobalCommentListPresenter.js
@@ -38,8 +38,8 @@ App.Presenters.GlobalCommentListPresenter = function(
baseUri: '#/comments',
backendUri: '/comments',
$target: $el.find('.pagination-target'),
- updateCallback: function($page, data) {
- renderComments($page, data.entities);
+ updateCallback: function($page, response) {
+ renderComments($page, response.json.comments);
},
},
function() {
@@ -65,12 +65,11 @@ App.Presenters.GlobalCommentListPresenter = function(
$el.html(templates.list());
}
- function renderComments($page, data) {
+ function renderComments($page, postComments) {
var $target = $page.find('.posts');
- _.each(data, function(data) {
- var post = data.post;
- var comments = data.comments;
-
+ _.each(postComments, function(postComments) {
+ var post = postComments.post;
+ var comments = postComments.comments;
var $post = jQuery('
' + templates.listItem({
util: util,
post: post,
diff --git a/public_html/js/Presenters/HistoryPresenter.js b/public_html/js/Presenters/HistoryPresenter.js
index ad20a710..3285114b 100644
--- a/public_html/js/Presenters/HistoryPresenter.js
+++ b/public_html/js/Presenters/HistoryPresenter.js
@@ -31,8 +31,8 @@ App.Presenters.HistoryPresenter = function(
baseUri: '#/history',
backendUri: '/history',
$target: $el.find('.pagination-target'),
- updateCallback: function($page, data) {
- renderHistory($page, data.entities);
+ updateCallback: function($page, response) {
+ renderHistory($page, response.json.history);
},
},
function() {
diff --git a/public_html/js/Presenters/PagerPresenter.js b/public_html/js/Presenters/PagerPresenter.js
index c9ca4cf8..93c06187 100644
--- a/public_html/js/Presenters/PagerPresenter.js
+++ b/public_html/js/Presenters/PagerPresenter.js
@@ -114,7 +114,14 @@ App.Presenters.PagerPresenter = function(
updateCallback($page, response);
refreshPageList();
- if (!response.entities.length) {
+
+ var entities =
+ response.json.posts ||
+ response.json.users ||
+ response.json.comments ||
+ response.json.tags;
+
+ if (!entities.length) {
messagePresenter.showInfo($messages, 'No data to show');
if (pager.getVisiblePages().length === 1) {
hidePageList();
@@ -125,7 +132,7 @@ App.Presenters.PagerPresenter = function(
showPageList();
}
- if (pager.getPage() < response.totalPages) {
+ if (pager.getPage() < pager.getTotalPages()) {
attachNextPageLoader();
}
diff --git a/public_html/js/Presenters/PostEditPresenter.js b/public_html/js/Presenters/PostEditPresenter.js
index 7acf32c5..ff68189e 100644
--- a/public_html/js/Presenters/PostEditPresenter.js
+++ b/public_html/js/Presenters/PostEditPresenter.js
@@ -151,8 +151,9 @@ App.Presenters.PostEditPresenter = function(
promise.wait(api.post('/posts/' + post.id, formData))
.then(function(response) {
tagList.refreshTags();
+ post = response.json.post;
if (typeof(updateCallback) !== 'undefined') {
- updateCallback(post = response.json);
+ updateCallback(post);
}
}).fail(function(response) {
showEditError(response);
diff --git a/public_html/js/Presenters/PostListPresenter.js b/public_html/js/Presenters/PostListPresenter.js
index 14de971e..ca63a0fb 100644
--- a/public_html/js/Presenters/PostListPresenter.js
+++ b/public_html/js/Presenters/PostListPresenter.js
@@ -45,8 +45,8 @@ App.Presenters.PostListPresenter = function(
baseUri: '#/posts',
backendUri: '/posts',
$target: $el.find('.pagination-target'),
- updateCallback: function($page, data) {
- renderPosts($page, data.entities);
+ updateCallback: function($page, response) {
+ renderPosts($page, response.json.posts);
},
},
function() {
@@ -221,7 +221,7 @@ App.Presenters.PostListPresenter = function(
formData.tags = tags.join(' ');
promise.wait(api.post('/posts/' + post.id, formData))
.then(function(response) {
- post = response.json;
+ post = response.json.post;
$post.data('post', post);
softRenderPost($post);
}).fail(function(response) {
diff --git a/public_html/js/Presenters/PostPresenter.js b/public_html/js/Presenters/PostPresenter.js
index d313c232..ef395a47 100644
--- a/public_html/js/Presenters/PostPresenter.js
+++ b/public_html/js/Presenters/PostPresenter.js
@@ -120,7 +120,7 @@ App.Presenters.PostPresenter = function(
return promise.make(function(resolve, reject) {
promise.wait(api.get('/posts/' + postNameOrId))
.then(function(postResponse) {
- post = postResponse.json;
+ post = postResponse.json.post;
resolve();
}).fail(function(response) {
showGenericError(response);
diff --git a/public_html/js/Presenters/RegistrationPresenter.js b/public_html/js/Presenters/RegistrationPresenter.js
index 2c900068..febfa45d 100644
--- a/public_html/js/Presenters/RegistrationPresenter.js
+++ b/public_html/js/Presenters/RegistrationPresenter.js
@@ -60,7 +60,7 @@ App.Presenters.RegistrationPresenter = function(
function registrationSuccess(apiResponse) {
$el.find('form').slideUp(function() {
var message = 'Registration complete! ';
- if (!apiResponse.json.confirmed) {
+ if (!apiResponse.json.user.confirmed) {
message += '
Check your inbox for activation e-mail.
If e-mail doesn\'t show up, check your spam folder.';
} else {
message += 'Click here to login.';
diff --git a/public_html/js/Presenters/TagListPresenter.js b/public_html/js/Presenters/TagListPresenter.js
index fa9cc4aa..a952f2fc 100644
--- a/public_html/js/Presenters/TagListPresenter.js
+++ b/public_html/js/Presenters/TagListPresenter.js
@@ -36,8 +36,8 @@ App.Presenters.TagListPresenter = function(
baseUri: '#/tags',
backendUri: '/tags',
$target: $el.find('.pagination-target'),
- updateCallback: function($page, data) {
- renderTags($page, data.entities);
+ updateCallback: function($page, response) {
+ renderTags($page, response.json.tags);
},
},
function() {
diff --git a/public_html/js/Presenters/TagPresenter.js b/public_html/js/Presenters/TagPresenter.js
index 0776b253..2ceec353 100644
--- a/public_html/js/Presenters/TagPresenter.js
+++ b/public_html/js/Presenters/TagPresenter.js
@@ -66,9 +66,9 @@ App.Presenters.TagPresenter = function(
api.get('tags/' + tagName + '/siblings'),
api.get('posts', {query: tagName}))
.then(function(tagResponse, siblingsResponse, postsResponse) {
- tag = tagResponse.json;
- siblings = siblingsResponse.json.data;
- posts = postsResponse.json.data;
+ tag = tagResponse.json.tag;
+ siblings = siblingsResponse.json.tags;
+ posts = postsResponse.json.posts;
posts = posts.slice(0, 8);
render();
diff --git a/public_html/js/Presenters/UserAccountSettingsPresenter.js b/public_html/js/Presenters/UserAccountSettingsPresenter.js
index ea5f7a37..901b262e 100644
--- a/public_html/js/Presenters/UserAccountSettingsPresenter.js
+++ b/public_html/js/Presenters/UserAccountSettingsPresenter.js
@@ -133,7 +133,7 @@ App.Presenters.UserAccountSettingsPresenter = function(
function editSuccess(apiResponse) {
var wasLoggedIn = auth.isLoggedIn(user.name);
- user = apiResponse.json;
+ user = apiResponse.json.user;
if (wasLoggedIn) {
auth.updateCurrentUser(user);
}
@@ -142,7 +142,7 @@ App.Presenters.UserAccountSettingsPresenter = function(
var $messages = jQuery(target).find('.messages');
var message = 'Account settings updated!';
- if (!apiResponse.json.confirmed) {
+ if (!apiResponse.json.user.confirmed) {
message += '
Check your inbox for activation e-mail.
If e-mail doesn\'t show up, check your spam folder.';
}
messagePresenter.showInfo($messages, message);
diff --git a/public_html/js/Presenters/UserListPresenter.js b/public_html/js/Presenters/UserListPresenter.js
index a395c5d1..064882d1 100644
--- a/public_html/js/Presenters/UserListPresenter.js
+++ b/public_html/js/Presenters/UserListPresenter.js
@@ -35,8 +35,8 @@ App.Presenters.UserListPresenter = function(
baseUri: '#/users',
backendUri: '/users',
$target: $el.find('.pagination-target'),
- updateCallback: function($page, data) {
- renderUsers($page, data.entities);
+ updateCallback: function($page, response) {
+ renderUsers($page, response.json.users);
},
},
function() {
diff --git a/public_html/js/Presenters/UserPresenter.js b/public_html/js/Presenters/UserPresenter.js
index dd3fdfc5..526808f5 100644
--- a/public_html/js/Presenters/UserPresenter.js
+++ b/public_html/js/Presenters/UserPresenter.js
@@ -41,7 +41,7 @@ App.Presenters.UserPresenter = function(
promise.wait(api.get('/users/' + userName))
.then(function(response) {
- user = response.json;
+ user = response.json.user;
var extendedContext = _.extend(params, {user: user});
presenterManager.initPresenters([
diff --git a/public_html/js/Services/PostsAroundCalculator.js b/public_html/js/Services/PostsAroundCalculator.js
index 1fa640ab..a07891e2 100644
--- a/public_html/js/Services/PostsAroundCalculator.js
+++ b/public_html/js/Services/PostsAroundCalculator.js
@@ -15,7 +15,7 @@ App.Services.PostsAroundCalculator = function(_, promise, util, pager) {
pager.setPage(query.page);
promise.wait(pager.retrieveCached())
.then(function(response) {
- var postIds = _.pluck(response.entities, 'id');
+ var postIds = _.pluck(response.json.posts, 'id');
var position = _.indexOf(postIds, postId);
if (position === -1) {
@@ -51,10 +51,10 @@ App.Services.PostsAroundCalculator = function(_, promise, util, pager) {
pager.setPage(page + direction);
promise.wait(pager.retrieveCached())
.then(function(response) {
- if (response.entities.length) {
+ if (response.json.posts.length) {
var post = direction === - 1 ?
- _.last(response.entities) :
- _.first(response.entities);
+ _.last(response.json.posts) :
+ _.first(response.json.posts);
var url = util.appendComplexRouteParam(
'#/post/' + post.id,
diff --git a/src/Routes/Comments/AddComment.php b/src/Routes/Comments/AddComment.php
index 4d013ae3..dd88b758 100644
--- a/src/Routes/Comments/AddComment.php
+++ b/src/Routes/Comments/AddComment.php
@@ -49,6 +49,6 @@ class AddComment extends AbstractCommentRoute
$post = $this->postService->getByNameOrId($args['postNameOrId']);
$comment = $this->commentService->createComment($post, $this->inputReader->text);
- return $this->commentViewProxy->fromEntity($comment, $this->getCommentsFetchConfig());
+ return ['comment' => $this->commentViewProxy->fromEntity($comment, $this->getCommentsFetchConfig())];
}
}
diff --git a/src/Routes/Comments/DeleteComment.php b/src/Routes/Comments/DeleteComment.php
index c6701a6f..8ff1462b 100644
--- a/src/Routes/Comments/DeleteComment.php
+++ b/src/Routes/Comments/DeleteComment.php
@@ -52,6 +52,6 @@ class DeleteComment extends AbstractCommentRoute
? Privilege::DELETE_OWN_COMMENTS
: Privilege::DELETE_ALL_COMMENTS);
- return $this->commentService->deleteComment($comment);
+ $this->commentService->deleteComment($comment);
}
}
diff --git a/src/Routes/Comments/EditComment.php b/src/Routes/Comments/EditComment.php
index 96ea52a1..b68ccd5d 100644
--- a/src/Routes/Comments/EditComment.php
+++ b/src/Routes/Comments/EditComment.php
@@ -53,6 +53,6 @@ class EditComment extends AbstractCommentRoute
: Privilege::EDIT_ALL_COMMENTS);
$comment = $this->commentService->updateComment($comment, $this->inputReader->text);
- return $this->commentViewProxy->fromEntity($comment, $this->getCommentsFetchConfig());
+ return ['comment' => $this->commentViewProxy->fromEntity($comment, $this->getCommentsFetchConfig())];
}
}
diff --git a/src/Routes/Comments/GetComments.php b/src/Routes/Comments/GetComments.php
index be3c4f40..9730e95d 100644
--- a/src/Routes/Comments/GetComments.php
+++ b/src/Routes/Comments/GetComments.php
@@ -80,7 +80,7 @@ class GetComments extends AbstractCommentRoute
}
return [
- 'data' => $data,
+ 'comments' => $data,
'pageSize' => $result->getPageSize(),
'totalRecords' => $result->getTotalRecords()];
}
diff --git a/src/Routes/Comments/GetPostComments.php b/src/Routes/Comments/GetPostComments.php
index 5052cdf2..f0a4c7f7 100644
--- a/src/Routes/Comments/GetPostComments.php
+++ b/src/Routes/Comments/GetPostComments.php
@@ -63,6 +63,6 @@ class GetPostComments extends AbstractCommentRoute
$result = $this->commentService->getFiltered($filter);
$entities = $this->commentViewProxy->fromArray($result->getEntities(), $this->getCommentsFetchConfig());
- return ['data' => $entities];
+ return ['comments' => $entities];
}
}
diff --git a/src/Routes/Favorites/AddToFavorites.php b/src/Routes/Favorites/AddToFavorites.php
index a6c8ef0c..ad231dc2 100644
--- a/src/Routes/Favorites/AddToFavorites.php
+++ b/src/Routes/Favorites/AddToFavorites.php
@@ -47,6 +47,6 @@ class AddToFavorites extends AbstractRoute
$this->favoritesService->addFavorite($user, $post);
$users = $this->favoritesService->getFavoriteUsers($post);
- return ['data' => $this->userViewProxy->fromArray($users)];
+ return ['users' => $this->userViewProxy->fromArray($users)];
}
}
diff --git a/src/Routes/Favorites/GetFavoriteUsers.php b/src/Routes/Favorites/GetFavoriteUsers.php
index 9064b4f3..05e2ae9f 100644
--- a/src/Routes/Favorites/GetFavoriteUsers.php
+++ b/src/Routes/Favorites/GetFavoriteUsers.php
@@ -43,6 +43,6 @@ class GetFavoriteUsers extends AbstractRoute
{
$post = $this->postService->getByNameOrId($args['postNameOrId']);
$users = $this->favoritesService->getFavoriteUsers($post);
- return ['data' => $this->userViewProxy->fromArray($users)];
+ return ['users' => $this->userViewProxy->fromArray($users)];
}
}
diff --git a/src/Routes/Favorites/RemoveFromFavorites.php b/src/Routes/Favorites/RemoveFromFavorites.php
index 2cd84a6e..402162e3 100644
--- a/src/Routes/Favorites/RemoveFromFavorites.php
+++ b/src/Routes/Favorites/RemoveFromFavorites.php
@@ -47,6 +47,6 @@ class RemoveFromFavorites extends AbstractRoute
$this->favoritesService->deleteFavorite($user, $post);
$users = $this->favoritesService->getFavoriteUsers($post);
- return ['data' => $this->userViewProxy->fromArray($users)];
+ return ['users' => $this->userViewProxy->fromArray($users)];
}
}
diff --git a/src/Routes/GetHistory.php b/src/Routes/GetHistory.php
index 684ea246..407c1e90 100644
--- a/src/Routes/GetHistory.php
+++ b/src/Routes/GetHistory.php
@@ -49,7 +49,7 @@ class GetHistory extends AbstractRoute
$result = $this->historyService->getFiltered($filter);
$entities = $this->snapshotViewProxy->fromArray($result->getEntities());
return [
- 'data' => $entities,
+ 'history' => $entities,
'pageSize' => $result->getPageSize(),
'totalRecords' => $result->getTotalRecords()];
}
diff --git a/src/Routes/Login.php b/src/Routes/Login.php
index ff4e1c1e..05ce076d 100644
--- a/src/Routes/Login.php
+++ b/src/Routes/Login.php
@@ -78,8 +78,7 @@ class Login extends AbstractRoute
$user = $this->authService->getLoggedInUser();
}
- return
- [
+ return [
'token' => $this->tokenViewProxy->fromEntity($this->authService->getLoginToken()),
'user' => $this->userViewProxy->fromEntity($user),
'privileges' => $this->privilegeService->getCurrentPrivileges(),
diff --git a/src/Routes/Posts/CreatePost.php b/src/Routes/Posts/CreatePost.php
index de757cf4..a14bb4cc 100644
--- a/src/Routes/Posts/CreatePost.php
+++ b/src/Routes/Posts/CreatePost.php
@@ -47,6 +47,6 @@ class CreatePost extends AbstractPostRoute
$this->privilegeService->assertPrivilege(Privilege::UPLOAD_POSTS_ANONYMOUSLY);
$post = $this->postService->createPost($formData);
- return $this->postViewProxy->fromEntity($post, $this->getFullFetchConfig());
+ return ['post' => $this->postViewProxy->fromEntity($post, $this->getFullFetchConfig())];
}
}
diff --git a/src/Routes/Posts/GetFeaturedPost.php b/src/Routes/Posts/GetFeaturedPost.php
index 160e4922..a2a436ac 100644
--- a/src/Routes/Posts/GetFeaturedPost.php
+++ b/src/Routes/Posts/GetFeaturedPost.php
@@ -36,7 +36,6 @@ class GetFeaturedPost extends AbstractPostRoute
$user = $this->postFeatureService->getFeaturedPostUser();
return [
'user' => $this->userViewProxy->fromEntity($user),
- 'post' => $this->postViewProxy->fromEntity($post, $this->getFullFetchConfig()),
- ];
+ 'post' => $this->postViewProxy->fromEntity($post, $this->getFullFetchConfig())];
}
}
diff --git a/src/Routes/Posts/GetPost.php b/src/Routes/Posts/GetPost.php
index 91f4f612..4b02ab5d 100644
--- a/src/Routes/Posts/GetPost.php
+++ b/src/Routes/Posts/GetPost.php
@@ -36,6 +36,6 @@ class GetPost extends AbstractPostRoute
$this->privilegeService->assertPrivilege(Privilege::VIEW_POSTS);
$post = $this->postService->getByNameOrId($args['postNameOrId']);
- return $this->postViewProxy->fromEntity($post, $this->getFullFetchConfig());
+ return ['post' => $this->postViewProxy->fromEntity($post, $this->getFullFetchConfig())];
}
}
diff --git a/src/Routes/Posts/GetPosts.php b/src/Routes/Posts/GetPosts.php
index 3cdab1d6..f4b3bb84 100644
--- a/src/Routes/Posts/GetPosts.php
+++ b/src/Routes/Posts/GetPosts.php
@@ -54,7 +54,7 @@ class GetPosts extends AbstractPostRoute
$result = $this->postService->getFiltered($filter);
$entities = $this->postViewProxy->fromArray($result->getEntities(), $this->getLightFetchConfig());
return [
- 'data' => $entities,
+ 'posts' => $entities,
'pageSize' => $result->getPageSize(),
'totalRecords' => $result->getTotalRecords()];
}
diff --git a/src/Routes/Posts/Notes/AddPostNote.php b/src/Routes/Posts/Notes/AddPostNote.php
index 5e3fa76e..10530112 100644
--- a/src/Routes/Posts/Notes/AddPostNote.php
+++ b/src/Routes/Posts/Notes/AddPostNote.php
@@ -49,6 +49,6 @@ class AddPostNote extends AbstractPostRoute
$formData = new PostNoteFormData($this->inputReader);
$postNote = $this->postNotesService->createPostNote($post, $formData);
- return $this->postNoteViewProxy->fromEntity($postNote);
+ return ['note' => $this->postNoteViewProxy->fromEntity($postNote)];
}
}
diff --git a/src/Routes/Posts/Notes/DeletePostNote.php b/src/Routes/Posts/Notes/DeletePostNote.php
index f97c645a..7b86e217 100644
--- a/src/Routes/Posts/Notes/DeletePostNote.php
+++ b/src/Routes/Posts/Notes/DeletePostNote.php
@@ -32,6 +32,6 @@ class DeletePostNote extends AbstractPostRoute
{
$postNote = $this->postNotesService->getById($args['postNoteId']);
$this->privilegeService->assertPrivilege(Privilege::DELETE_POST_NOTES);
- return $this->postNotesService->deletePostNote($postNote);
+ $this->postNotesService->deletePostNote($postNote);
}
}
diff --git a/src/Routes/Posts/Notes/GetPostNotes.php b/src/Routes/Posts/Notes/GetPostNotes.php
index a5232bca..c99097cb 100644
--- a/src/Routes/Posts/Notes/GetPostNotes.php
+++ b/src/Routes/Posts/Notes/GetPostNotes.php
@@ -44,6 +44,6 @@ class GetPostNotes extends AbstractPostRoute
{
$post = $this->postService->getByNameOrId($args['postNameOrId']);
$postNotes = $this->postNotesService->getByPost($post);
- return $this->postNoteViewProxy->fromArray($postNotes);
+ return ['notes' => $this->postNoteViewProxy->fromArray($postNotes)];
}
}
diff --git a/src/Routes/Posts/Notes/UpdatePostNote.php b/src/Routes/Posts/Notes/UpdatePostNote.php
index a96bfd78..e1ff7c21 100644
--- a/src/Routes/Posts/Notes/UpdatePostNote.php
+++ b/src/Routes/Posts/Notes/UpdatePostNote.php
@@ -45,6 +45,6 @@ class UpdatePostNote extends AbstractPostRoute
$formData = new PostNoteFormData($this->inputReader);
$postNote = $this->postNotesService->updatePostNote($postNote, $formData);
- return $this->postNoteViewProxy->fromEntity($postNote);
+ return ['note' => $this->postNoteViewProxy->fromEntity($postNote)];
}
}
diff --git a/src/Routes/Posts/UpdatePost.php b/src/Routes/Posts/UpdatePost.php
index 5787af40..e1cc4879 100644
--- a/src/Routes/Posts/UpdatePost.php
+++ b/src/Routes/Posts/UpdatePost.php
@@ -59,6 +59,6 @@ class UpdatePost extends AbstractPostRoute
$this->postService->updatePost($post, $formData);
$post = $this->postService->getByNameOrId($postNameOrId);
- return $this->postViewProxy->fromEntity($post, $this->getFullFetchConfig());
+ return ['post' => $this->postViewProxy->fromEntity($post, $this->getFullFetchConfig())];
}
}
diff --git a/src/Routes/Scores/AbstractScoreRoute.php b/src/Routes/Scores/AbstractScoreRoute.php
index 052181b8..f9e6e050 100644
--- a/src/Routes/Scores/AbstractScoreRoute.php
+++ b/src/Routes/Scores/AbstractScoreRoute.php
@@ -42,7 +42,6 @@ abstract class AbstractScoreRoute extends AbstractRoute
$result = $this->scoreService->setUserScore($user, $entity, $score);
return [
'score' => $this->scoreService->getScoreValue($entity),
- 'ownScore' => $result->getScore(),
- ];
+ 'ownScore' => $result->getScore()];
}
}
diff --git a/src/Routes/Tags/DeleteTag.php b/src/Routes/Tags/DeleteTag.php
index 0cd827a0..3eca1bba 100644
--- a/src/Routes/Tags/DeleteTag.php
+++ b/src/Routes/Tags/DeleteTag.php
@@ -31,6 +31,6 @@ class DeleteTag extends AbstractTagRoute
{
$tag = $this->tagService->getByName($args['tagName']);
$this->privilegeService->assertPrivilege(Privilege::DELETE_TAGS);
- return $this->tagService->deleteTag($tag);
+ $this->tagService->deleteTag($tag);
}
}
diff --git a/src/Routes/Tags/GetTag.php b/src/Routes/Tags/GetTag.php
index 6c0c6836..4cf0923a 100644
--- a/src/Routes/Tags/GetTag.php
+++ b/src/Routes/Tags/GetTag.php
@@ -36,6 +36,6 @@ class GetTag extends AbstractTagRoute
$this->privilegeService->assertPrivilege(Privilege::LIST_TAGS);
$tag = $this->tagService->getByName($args['tagName']);
- return $this->tagViewProxy->fromEntity($tag, $this->getFullFetchConfig());
+ return ['tag' => $this->tagViewProxy->fromEntity($tag, $this->getFullFetchConfig())];
}
}
diff --git a/src/Routes/Tags/GetTagSiblings.php b/src/Routes/Tags/GetTagSiblings.php
index bda22e44..d0c2e69a 100644
--- a/src/Routes/Tags/GetTagSiblings.php
+++ b/src/Routes/Tags/GetTagSiblings.php
@@ -38,8 +38,6 @@ class GetTagSiblings extends AbstractTagRoute
$tag = $this->tagService->getByName($tagName);
$result = $this->tagService->getSiblings($tagName);
$entities = $this->tagViewProxy->fromArray($result);
- return [
- 'data' => $entities,
- ];
+ return ['tags' => $entities];
}
}
diff --git a/src/Routes/Tags/GetTags.php b/src/Routes/Tags/GetTags.php
index 47bb9596..30d4a09e 100644
--- a/src/Routes/Tags/GetTags.php
+++ b/src/Routes/Tags/GetTags.php
@@ -49,7 +49,7 @@ class GetTags extends AbstractTagRoute
$result = $this->tagService->getFiltered($filter);
$entities = $this->tagViewProxy->fromArray($result->getEntities(), $this->getFullFetchConfig());
return [
- 'data' => $entities,
+ 'tags' => $entities,
'pageSize' => $result->getPageSize(),
'totalRecords' => $result->getTotalRecords()];
}
diff --git a/src/Routes/Tags/MergeTags.php b/src/Routes/Tags/MergeTags.php
index 8a0f9e5b..946766ee 100644
--- a/src/Routes/Tags/MergeTags.php
+++ b/src/Routes/Tags/MergeTags.php
@@ -38,6 +38,6 @@ class MergeTags extends AbstractTagRoute
$sourceTag = $this->tagService->getByName($tagName);
$targetTag = $this->tagService->getByName($targetTagName);
$this->privilegeService->assertPrivilege(Privilege::MERGE_TAGS);
- return $this->tagService->mergeTag($sourceTag, $targetTag);
+ $this->tagService->mergeTag($sourceTag, $targetTag);
}
}
diff --git a/src/Routes/Tags/UpdateTag.php b/src/Routes/Tags/UpdateTag.php
index 7f848e7f..bd41ff41 100644
--- a/src/Routes/Tags/UpdateTag.php
+++ b/src/Routes/Tags/UpdateTag.php
@@ -57,6 +57,6 @@ class UpdateTag extends AbstractTagRoute
$this->privilegeService->assertPrivilege(Privilege::CHANGE_TAG_SUGGESTIONS);
$tag = $this->tagService->updateTag($tag, $formData);
- return $this->tagViewProxy->fromEntity($tag, $this->getFullFetchConfig());
+ return ['tag' => $this->tagViewProxy->fromEntity($tag, $this->getFullFetchConfig())];
}
}
diff --git a/src/Routes/Users/ActivateAccount.php b/src/Routes/Users/ActivateAccount.php
index 790bb542..623d9733 100644
--- a/src/Routes/Users/ActivateAccount.php
+++ b/src/Routes/Users/ActivateAccount.php
@@ -24,6 +24,6 @@ class ActivateAccount extends AbstractUserRoute
public function work($args)
{
$user = $this->userService->getByNameOrEmail($args['userNameOrEmail'], true);
- return $this->userService->sendActivationEmail($user);
+ $this->userService->sendActivationEmail($user);
}
}
diff --git a/src/Routes/Users/CreateUser.php b/src/Routes/Users/CreateUser.php
index a8dcee94..02f7ba29 100644
--- a/src/Routes/Users/CreateUser.php
+++ b/src/Routes/Users/CreateUser.php
@@ -41,6 +41,6 @@ class CreateUser extends AbstractUserRoute
$this->privilegeService->assertPrivilege(Privilege::REGISTER);
$formData = new RegistrationFormData($this->inputReader);
$user = $this->userService->createUser($formData);
- return $this->userViewProxy->fromEntity($user);
+ return ['user' => $this->userViewProxy->fromEntity($user)];
}
}
diff --git a/src/Routes/Users/DeleteUser.php b/src/Routes/Users/DeleteUser.php
index 92f04108..284ad1d8 100644
--- a/src/Routes/Users/DeleteUser.php
+++ b/src/Routes/Users/DeleteUser.php
@@ -38,6 +38,6 @@ class DeleteUser extends AbstractUserRoute
: Privilege::DELETE_ALL_ACCOUNTS);
$user = $this->userService->getByNameOrEmail($userNameOrEmail);
- return $this->userService->deleteUser($user);
+ $this->userService->deleteUser($user);
}
}
diff --git a/src/Routes/Users/GetUser.php b/src/Routes/Users/GetUser.php
index c3d1209e..89d0f0ea 100644
--- a/src/Routes/Users/GetUser.php
+++ b/src/Routes/Users/GetUser.php
@@ -41,6 +41,6 @@ class GetUser extends AbstractUserRoute
if (!$this->privilegeService->isLoggedIn($userNameOrEmail))
$this->privilegeService->assertPrivilege(Privilege::VIEW_USERS);
$user = $this->userService->getByNameOrEmail($userNameOrEmail);
- return $this->userViewProxy->fromEntity($user);
+ return ['user' => $this->userViewProxy->fromEntity($user)];
}
}
diff --git a/src/Routes/Users/GetUsers.php b/src/Routes/Users/GetUsers.php
index b9a8a9a3..81bb3e63 100644
--- a/src/Routes/Users/GetUsers.php
+++ b/src/Routes/Users/GetUsers.php
@@ -52,7 +52,7 @@ class GetUsers extends AbstractUserRoute
$result = $this->userService->getFiltered($filter);
$entities = $this->userViewProxy->fromArray($result->getEntities());
return [
- 'data' => $entities,
+ 'users' => $entities,
'pageSize' => $result->getPageSize(),
'totalRecords' => $result->getTotalRecords()];
}
diff --git a/src/Routes/Users/PasswordReset.php b/src/Routes/Users/PasswordReset.php
index b70344fc..9832fb5c 100644
--- a/src/Routes/Users/PasswordReset.php
+++ b/src/Routes/Users/PasswordReset.php
@@ -22,6 +22,6 @@ class PasswordReset extends AbstractUserRoute
public function work($args)
{
$user = $this->userService->getByNameOrEmail($args['userNameOrEmail']);
- return $this->userService->sendPasswordResetEmail($user);
+ $this->userService->sendPasswordResetEmail($user);
}
}
diff --git a/src/Routes/Users/UpdateUser.php b/src/Routes/Users/UpdateUser.php
index e7c74072..8281c343 100644
--- a/src/Routes/Users/UpdateUser.php
+++ b/src/Routes/Users/UpdateUser.php
@@ -91,6 +91,6 @@ class UpdateUser extends AbstractUserRoute
}
$user = $this->userService->updateUser($user, $formData);
- return $this->userViewProxy->fromEntity($user);
+ return ['user' => $this->userViewProxy->fromEntity($user)];
}
}