Skip to content
Snippets Groups Projects
Unverified Commit c913a770 authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Fix recording order (#4644)

parent bf3ce203
Branches
Tags
No related merge requests found
...@@ -16,7 +16,7 @@ module Api ...@@ -16,7 +16,7 @@ module Api
def index def index
sort_config = config_sorting(allowed_columns: %w[name length visibility]) sort_config = config_sorting(allowed_columns: %w[name length visibility])
pagy, recordings = pagy(current_user.recordings&.order(sort_config)&.search(params[:search])) pagy, recordings = pagy(current_user.recordings&.order(sort_config, created_at: :desc)&.search(params[:search]))
render_data data: recordings, meta: pagy_metadata(pagy), status: :ok render_data data: recordings, meta: pagy_metadata(pagy), status: :ok
end end
......
...@@ -114,7 +114,9 @@ module Api ...@@ -114,7 +114,9 @@ module Api
# GET /api/v1/rooms/:friendly_id/recordings.json # GET /api/v1/rooms/:friendly_id/recordings.json
# Returns all of a specific room's recordings # Returns all of a specific room's recordings
def recordings def recordings
pagy, room_recordings = pagy(@room.recordings&.search(params[:q])) sort_config = config_sorting(allowed_columns: %w[name length visibility])
pagy, room_recordings = pagy(@room.recordings&.order(sort_config, created_at: :desc)&.search(params[:q]))
render_data data: room_recordings, meta: pagy_metadata(pagy), status: :ok render_data data: room_recordings, meta: pagy_metadata(pagy), status: :ok
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment