fixes to SQL and api spec

This commit is contained in:
Oliver Gorwits
2018-12-31 23:21:44 +00:00
parent 0151fc86a7
commit f56c48b83d
3 changed files with 7 additions and 4 deletions

View File

@@ -20,8 +20,8 @@ __PACKAGE__->result_source_instance->view_definition(<<ENDSQL
SELECT username, 'ldap' AS role FROM users
WHERE ldap
UNION
SELECT username, 'api', AS role FROM users
WHERE token AND token_from
SELECT username, 'api' AS role FROM users
WHERE token IS NOT NULL AND token_from IS NOT NULL
ENDSQL
);

View File

@@ -12,11 +12,11 @@ our @EXPORT = qw/
sub parse_search_params {
my $params = shift;
my $search = {};
my $partial = $params->{partial} || 0;
my $partial = $params->{partial} || false;
foreach my $param (keys %{$params}) {
if ($param ne 'return_url' and $param ne 'partial') {
if ($partial == 1) {
if ($partial eq 'true') {
$search->{"text(".$param.")"} = { -ilike => '%'.$params->{$param}.'%'};
}
else {

View File

@@ -25,6 +25,9 @@ swagger_path {
description => 'All parameters will be searched for case insensitively in their values',
},
],
responses => {
default => { description => 'A row from the node_ip table' },
},
},
get '/api/nodeip/search' => require_role api => sub {
my $para = params;