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
histhub
api
Commits
1db3ef32
Commit
1db3ef32
authored
Sep 27, 2019
by
tobinski
Browse files
Use language query
parent
cecd3b65
Pipeline
#3445
passed with stage
in 2 minutes and 50 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/controller/api.ts
View file @
1db3ef32
...
...
@@ -85,13 +85,11 @@ export class ApiController {
* @param next
*/
public
static
concordance
(
req
:
InterfaceRequestKafka
,
res
:
Response
,
next
:
NextFunction
)
{
const
language
=
req
.
validatedBody
.
language
||
'
de
'
;
const
message
:
any
=
{
};
message
.
resolverneo4j
=
{
depth
:
parseInt
(
req
.
validatedBody
.
depth
)
||
1
,
};
message
.
verb
=
'
same_as
'
;
message
.
language
=
language
;
// add values for next middleware
req
.
message
=
ApiController
.
buildMessage
(
req
,
message
);
req
.
config
=
[
'
resolverneo4j
'
];
...
...
@@ -105,7 +103,6 @@ export class ApiController {
* @param next
*/
public
static
match
(
req
:
InterfaceRequestKafka
,
res
:
Response
,
next
:
NextFunction
)
{
const
language
=
req
.
validatedBody
.
language
||
'
de
'
;
const
message
:
any
=
{};
message
.
resolverelasticsearch
=
{
distance
:
parseInt
(
req
.
validatedBody
.
distance
)
||
10000
,
...
...
@@ -113,7 +110,6 @@ export class ApiController {
};
// todo: change wording
message
.
verb
=
'
same_as
'
;
message
.
language
=
language
;
// add values for next middleware
req
.
message
=
ApiController
.
buildMessage
(
req
,
message
);
req
.
config
=
[
'
resolverelasticsearch
'
];
...
...
@@ -211,6 +207,7 @@ export class ApiController {
* On data, write stuff to kafka
*/
try
{
console
.
log
(
message
);
req
.
kafkaProducer
.
produce
(
'
request-geoconcordance
'
,
-
1
,
message
,
id
);
core
.
getReporter
().
setDataOut
(
1
);
}
catch
(
error
)
{
...
...
@@ -229,6 +226,7 @@ export class ApiController {
// the message needs to be compatible to the schema
const
url
=
req
.
url
||
req
.
originalUrl
;
const
id
=
shajs
(
'
sha256
'
).
update
(
url
).
digest
(
'
hex
'
);
const
language
=
req
.
validatedBody
.
language
||
'
de
'
;
// get the verb from the params or the options
const
verb
:
string
=
req
.
params
.
verb
||
options
.
verb
;
...
...
@@ -241,6 +239,7 @@ export class ApiController {
id
,
verb
,
node
,
language
,
config
:
options
,
}
}
...
...
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