API sorting improvements:

- Add endpoints for getting/updating sorting methods
- Results from library and title endpoints are now sorted
This commit is contained in:
Alex Ling
2022-03-22 10:46:38 +00:00
parent a5a7396edd
commit 7ecdb1c0dd
4 changed files with 116 additions and 11 deletions
+9 -2
View File
@@ -218,9 +218,16 @@ class Title
unless depth == 0
json.field "titles" do
json.array do
self.titles.each do |title|
_titles = if sort_context
sorted_titles sort_context[:username],
sort_context[:opt]
else
self.titles
end
_titles.each do |title|
json.raw title.build_json(slim: slim,
depth: depth > 0 ? depth - 1 : depth)
depth: depth > 0 ? depth - 1 : depth,
sort_context: sort_context)
end
end
end