From 420fc9ce97814f62bdf32aa212ff47155ecf57a8 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sun, 19 Feb 2023 09:04:00 +0000 Subject: [PATCH] api: use more compact code in /tags --- lib/PoorBooru/API/V0.pm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/PoorBooru/API/V0.pm b/lib/PoorBooru/API/V0.pm index 3c81c05..81f0486 100644 --- a/lib/PoorBooru/API/V0.pm +++ b/lib/PoorBooru/API/V0.pm @@ -38,15 +38,13 @@ get "/meta" => sub { }; get "/tags" => sub { - my @tags = schema("default")->resultset("TagsCountView")->all; + my @tags = map +( { + id => $_->tag_id, + name => $_->name, + count => $_->count, + } ), schema("default")->resultset("TagsCountView")->all; - return [ - map +( { - id => $_->tag_id, - name => $_->name, - count => $_->count, - } ), @tags, - ]; + return \@tags; }; post "/tags/new" => sub {