From 4446255f6427835c91a578ac0246d728035296e4 Mon Sep 17 00:00:00 2001 From: tonyrewin Date: Thu, 8 Sep 2022 19:46:02 +0300 Subject: [PATCH] increment-view --- resolvers/zine.py | 6 ++++++ schema.graphql | 3 +++ 2 files changed, 9 insertions(+) diff --git a/resolvers/zine.py b/resolvers/zine.py index ede522dc..432ff27e 100644 --- a/resolvers/zine.py +++ b/resolvers/zine.py @@ -15,6 +15,12 @@ from sqlalchemy import select, desc, and_ from sqlalchemy.orm import selectinload +@mutation.field("incrementView") +async def increment_view(_, _info, shout): + async with ViewedStorage.lock: + return ViewedStorage.increment(shout) + + @query.field("topViewed") async def top_viewed(_, _info, page, size): async with ShoutsCache.lock: diff --git a/schema.graphql b/schema.graphql index 5b22124c..f214c8de 100644 --- a/schema.graphql +++ b/schema.graphql @@ -197,6 +197,9 @@ type Mutation { unfollow(what: FollowingEntity!, slug: String!): Result! # TODO: transform reaction with body to shout + + # seen + incrementView(shout: String!): Result! } ################################### Query