api, backend: replace '+( { ... } )' -> '+{ ... }'

api, backend: whitespace: '+( {' -> '+({'
This commit is contained in:
Lucas 2023-02-19 15:15:57 +00:00
parent 861593d26d
commit 7d827212c1
2 changed files with 11 additions and 11 deletions

View File

@ -58,11 +58,11 @@ get "/" => sub {
send_error("API error", 500) if !$res->{success}; send_error("API error", 500) if !$res->{success};
my $data = decode_json($res->{content}); my $data = decode_json($res->{content});
my @media = map +( { my @media = map +{
# XXX point to a cache # XXX point to a cache
image_src => "$POORBOORU_API/download/$_", image_src => "$POORBOORU_API/download/$_",
view_uri => uri_for("/view/$_"), view_uri => uri_for("/view/$_"),
} ), @{$data->{media}}; }, @{$data->{media}};
template "gallery" => { template "gallery" => {
title => "PoorBooru", title => "PoorBooru",
@ -81,11 +81,11 @@ get "/tags" => sub {
send_error("API error", 500) if !$res->{success}; send_error("API error", 500) if !$res->{success};
my $data = decode_json($res->{content}); my $data = decode_json($res->{content});
my @tags = map +( { my @tags = map +{
name => $_->{name}, name => $_->{name},
count => $_->{count}, count => $_->{count},
uri => uri_for("/tag/" . $_->{name}), uri => uri_for("/tag/" . $_->{name}),
} ), @{$data->{tags}}; }, @{$data->{tags}};
template "tags" => { template "tags" => {
title => "Tags", title => "Tags",
@ -101,11 +101,11 @@ get "/tag/:tag_id_or_name" => sub {
send_error("API error", 500) if !$res->{success}; send_error("API error", 500) if !$res->{success};
my $data = decode_json($res->{content}); my $data = decode_json($res->{content});
my @media = map +( { my @media = map +{
# XXX point to a cache # XXX point to a cache
image_src => "$POORBOORU_API/download/$_", image_src => "$POORBOORU_API/download/$_",
view_uri => uri_for("/view/$_"), view_uri => uri_for("/view/$_"),
} ), @{$data->{media}}; }, @{$data->{media}};
template "gallery" => { template "gallery" => {
title => $data->{name}, title => $data->{name},

View File

@ -53,11 +53,11 @@ get "/tags" => sub {
my $paged_tags = schema("default")->resultset("TagsCountView") my $paged_tags = schema("default")->resultset("TagsCountView")
->search({}, $TAGS_COUNT_VIEW_SEARCH_OPTS)->page($page); ->search({}, $TAGS_COUNT_VIEW_SEARCH_OPTS)->page($page);
my @tags = map +( { my @tags = map +{
id => $_->tag_id, id => $_->tag_id,
name => $_->name, name => $_->name,
count => $_->count, count => $_->count,
} ), $paged_tags->all; }, $paged_tags->all;
return { return {
pager => mkpager($paged_tags), pager => mkpager($paged_tags),
@ -74,11 +74,11 @@ post "/tags" => sub {
my @tags; my @tags;
eval { eval {
@tags = map +( { @tags = map +{
id => $_->tag_id, id => $_->tag_id,
name => $_->name, name => $_->name,
} ), schema("default")->resultset("Tag") }, schema("default")->resultset("Tag")
->populate([map +({ name => $_ }), @tag_names]); ->populate([map +{ name => $_ }, @tag_names]);
} or send_error("Tag exists", 409); } or send_error("Tag exists", 409);
return \@tags; return \@tags;