Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Damien Armillon
API Toucan
Commits
bfec623c
Commit
bfec623c
authored
Nov 17, 2019
by
Damien Armillon
Browse files
Fix Bug
parent
29b256bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/routes/routesToucan.js
View file @
bfec623c
...
...
@@ -16,14 +16,14 @@ router.route("/toucans")
* Si before et after sont définis (dates) on ne renvoie qu'entre ces dates
*/
.
get
(
celebrate
({
query
:
validGet
}),
function
(
req
,
res
)
{
let
options
=
{
"
date
"
:{}
};
let
options
Date
=
{};
if
(
req
.
query
.
before
){
options
[
"
date
"
][
"
$lt
"
]
=
req
.
query
.
before
;
options
Date
.
$lt
=
req
.
query
.
before
;
}
if
(
req
.
query
.
after
){
options
[
"
date
"
][
"
$gt
"
]
=
req
.
query
.
after
;
options
Date
.
$gt
=
req
.
query
.
after
;
}
Toucan
.
find
(
options
)
Toucan
.
find
(
(
req
.
query
.
before
||
req
.
query
.
after
)
?
{
"
date
"
:
optionsDate
}
:
null
)
.
sort
({
date
:
-
1
})
.
limit
(
req
.
query
.
limit
)
.
exec
(
function
(
err
,
toucans
)
{
...
...
Write
Preview
Supports
Markdown
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