Add a route to return used tags

This is part of the `/insights` route without queries for file usage.
This commit is contained in:
Eike Kettner
2020-08-08 07:56:55 +02:00
parent a4796f3f7f
commit 1c8b66194b
5 changed files with 52 additions and 32 deletions

View File

@ -31,11 +31,11 @@ trait Conversions {
d.incoming,
d.outgoing,
d.bytes,
TagCloud(d.tags.map(tc => TagCount(mkTagLight(tc), tc.count)))
mkTagCloud(d.tags)
)
def mkTagLight(t: OCollective.TagCount): TagLight =
TagLight(t.id, t.name, t.category)
def mkTagCloud(tags: List[OCollective.TagCount]) =
TagCloud(tags.map(tc => TagCount(mkTag(tc.tag), tc.count)))
// attachment meta
def mkAttachmentMeta(rm: RAttachmentMeta): AttachmentMeta =

View File

@ -28,6 +28,12 @@ object CollectiveRoutes {
resp <- Ok(Conversions.mkItemInsights(ins))
} yield resp
case GET -> Root / "cloud" =>
for {
cloud <- backend.collective.tagCloud(user.account.collective)
resp <- Ok(Conversions.mkTagCloud(cloud))
} yield resp
case req @ POST -> Root / "settings" =>
for {
settings <- req.as[CollectiveSettings]