mirror of
https://github.com/wassname/talk.git
synced 2026-09-11 12:51:33 +08:00
feat: introduce asset action count caching
This commit is contained in:
@@ -7,7 +7,10 @@ import {
|
||||
createActions,
|
||||
encodeActionCounts,
|
||||
} from "talk-server/models/actions";
|
||||
import { retrieveAsset } from "talk-server/models/asset";
|
||||
import {
|
||||
retrieveAsset,
|
||||
updateAssetActionCounts,
|
||||
} from "talk-server/models/asset";
|
||||
import {
|
||||
Comment,
|
||||
createComment,
|
||||
@@ -85,6 +88,7 @@ export async function create(
|
||||
|
||||
// Insert and handle creating the actions.
|
||||
comment = await addCommentActions(mongo, tenant, comment, inputs);
|
||||
// asse
|
||||
}
|
||||
|
||||
if (input.parent_id) {
|
||||
@@ -196,6 +200,14 @@ async function addCommentActions(
|
||||
actionCounts
|
||||
);
|
||||
|
||||
// Update the Asset with the updated action counts.
|
||||
await updateAssetActionCounts(
|
||||
mongo,
|
||||
tenant.id,
|
||||
comment.asset_id,
|
||||
actionCounts
|
||||
);
|
||||
|
||||
// Check to see if there was an actual comment returned (there should
|
||||
// have been, we just created it!).
|
||||
if (!updatedComment) {
|
||||
|
||||
Reference in New Issue
Block a user