Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
07885680
Commit
07885680
authored
May 07, 2020
by
James Fargher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Order storage moves API by default
parent
ff1b5ceb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
app/models/project_repository_storage_move.rb
app/models/project_repository_storage_move.rb
+2
-0
lib/api/project_repository_storage_moves.rb
lib/api/project_repository_storage_moves.rb
+1
-1
spec/requests/api/project_repository_storage_moves_spec.rb
spec/requests/api/project_repository_storage_moves_spec.rb
+14
-0
No files found.
app/models/project_repository_storage_move.rb
View file @
07885680
...
...
@@ -52,4 +52,6 @@ class ProjectRepositoryStorageMove < ApplicationRecord
state
:finished
,
value:
4
state
:failed
,
value:
5
end
scope
:order_created_at_desc
,
->
{
order
(
created_at: :desc
)
}
end
lib/api/project_repository_storage_moves.rb
View file @
07885680
...
...
@@ -15,7 +15,7 @@ module API
use
:pagination
end
get
do
storage_moves
=
ProjectRepositoryStorageMove
.
all
storage_moves
=
ProjectRepositoryStorageMove
.
order_created_at_desc
present
paginate
(
storage_moves
),
with:
Entities
::
ProjectRepositoryStorageMove
,
current_user:
current_user
end
...
...
spec/requests/api/project_repository_storage_moves_spec.rb
View file @
07885680
...
...
@@ -29,6 +29,20 @@ describe API::ProjectRepositoryStorageMoves do
expect
{
get_project_repository_storage_moves
}.
not_to
exceed_query_limit
(
control
)
end
it
'returns the most recently created first'
do
storage_move_oldest
=
create
(
:project_repository_storage_move
,
:scheduled
,
created_at:
2
.
days
.
ago
)
storage_move_middle
=
create
(
:project_repository_storage_move
,
:scheduled
,
created_at:
1
.
day
.
ago
)
get
api
(
'/project_repository_storage_moves'
,
user
)
json_ids
=
json_response
.
map
{
|
storage_move
|
storage_move
[
'id'
]
}
expect
(
json_ids
).
to
eq
([
storage_move
.
id
,
storage_move_middle
.
id
,
storage_move_oldest
.
id
])
end
end
describe
'GET /project_repository_storage_moves/:id'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment