feat: introduce asset action count caching

This commit is contained in:
Wyatt Johnson
2018-09-23 20:43:43 -06:00
parent 0e25c8d446
commit d8417eda2e
5 changed files with 64 additions and 16 deletions
@@ -1,4 +1,5 @@
import { GQLAssetTypeResolver } from "talk-server/graph/tenant/schema/__generated__/types";
import { decodeActionCounts } from "talk-server/models/actions";
import { Asset } from "talk-server/models/asset";
const Asset: GQLAssetTypeResolver<Asset> = {
@@ -6,6 +7,7 @@ const Asset: GQLAssetTypeResolver<Asset> = {
ctx.loaders.Comments.forAsset(asset.id, input),
// TODO: implement this.
isClosed: () => false,
actionCounts: asset => decodeActionCounts(asset.action_counts),
};
export default Asset;
@@ -930,6 +930,11 @@ type Asset {
after: Cursor
): CommentsConnection!
"""
actionCounts stores the counts of all the actions for the Comment.
"""
actionCounts: ActionCounts!
"""
author is the authors listed in the meta tags for the Asset.
"""