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
72d09bd8
Commit
72d09bd8
authored
Oct 18, 2021
by
charlie ablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add created_at filters to MR resolver
Changelog: added
parent
02ab3b58
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
0 deletions
+84
-0
app/graphql/resolvers/merge_requests_resolver.rb
app/graphql/resolvers/merge_requests_resolver.rb
+6
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+28
-0
spec/graphql/resolvers/merge_requests_resolver_spec.rb
spec/graphql/resolvers/merge_requests_resolver_spec.rb
+48
-0
spec/graphql/types/project_type_spec.rb
spec/graphql/types/project_type_spec.rb
+2
-0
No files found.
app/graphql/resolvers/merge_requests_resolver.rb
View file @
72d09bd8
...
...
@@ -68,6 +68,12 @@ module Resolvers
description:
'Sort merge requests by this criteria.'
,
required:
false
,
default_value: :created_desc
argument
:created_after
,
Types
::
TimeType
,
required:
false
,
description:
'Merge requests created after this timestamp.'
argument
:created_before
,
Types
::
TimeType
,
required:
false
,
description:
'Merge requests created before this timestamp.'
negated
do
argument
:labels
,
[
GraphQL
::
Types
::
String
],
...
...
doc/api/graphql/reference/index.md
View file @
72d09bd8
This diff is collapsed.
Click to expand it.
spec/graphql/resolvers/merge_requests_resolver_spec.rb
View file @
72d09bd8
...
...
@@ -218,6 +218,54 @@ RSpec.describe Resolvers::MergeRequestsResolver do
end
end
context
'with created_after and created_before arguments'
do
before
do
merge_request_1
.
update!
(
created_at:
4
.
days
.
ago
)
end
let
(
:all_mrs
)
do
[
merge_request_1
,
merge_request_2
,
merge_request_3
,
merge_request_4
,
merge_request_5
,
merge_request_6
,
merge_request_with_milestone
]
end
it
'returns merge requests created within a given period'
do
result
=
resolve_mr
(
project
,
created_after:
5
.
days
.
ago
,
created_before:
2
.
days
.
ago
)
expect
(
result
).
to
contain_exactly
(
merge_request_1
)
end
it
'returns some values filtered with created_before'
do
result
=
resolve_mr
(
project
,
created_before:
1
.
day
.
ago
)
expect
(
result
).
to
contain_exactly
(
merge_request_1
)
end
it
'returns some values filtered with created_after'
do
result
=
resolve_mr
(
project
,
created_after:
3
.
days
.
ago
)
expect
(
result
).
to
match_array
(
all_mrs
-
[
merge_request_1
])
end
it
'does not return anything for dates (even in the future) not matching any MRs'
do
result
=
resolve_mr
(
project
,
created_after:
5
.
days
.
from_now
)
expect
(
result
).
to
be_empty
end
it
'does not return anything for dates not matching any MRs'
do
result
=
resolve_mr
(
project
,
created_before:
15
.
days
.
ago
)
expect
(
result
).
to
be_empty
end
it
'does not return any values for an impossible set'
do
result
=
resolve_mr
(
project
,
created_after:
5
.
days
.
ago
,
created_before:
6
.
days
.
ago
)
expect
(
result
).
to
be_empty
end
end
context
'with milestone argument'
do
it
'filters merge requests by milestone title'
do
result
=
resolve_mr
(
project
,
milestone_title:
milestone
.
title
)
...
...
spec/graphql/types/project_type_spec.rb
View file @
72d09bd8
...
...
@@ -296,6 +296,8 @@ RSpec.describe GitlabSchema.types['Project'] do
:last
,
:merged_after
,
:merged_before
,
:created_after
,
:created_before
,
:author_username
,
:assignee_username
,
:reviewer_username
,
...
...
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