api: use more compact code in /tags

This commit is contained in:
Lucas 2023-02-19 09:04:00 +00:00
parent 6eae4e0fe4
commit 420fc9ce97
1 changed files with 6 additions and 8 deletions

View File

@ -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 {