From b8e662b6d11fef62a54df1b1989157062fcce049 Mon Sep 17 00:00:00 2001 From: claygorman Date: Tue, 19 Dec 2023 14:29:24 -0800 Subject: [PATCH] Add logging for document fetch and update return object This commit adds a console log for tracking the 'Fetching tiptap document' action and its related variables. Additionally, an update was made to return an object containing 'db' and 'user' at the end of a function. --- backend/src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/index.js b/backend/src/index.js index 91580cd..8846e06 100644 --- a/backend/src/index.js +++ b/backend/src/index.js @@ -83,6 +83,7 @@ const hocuspocusServer = Server.configure({ new Database({ fetch: async ({ documentName }) => { const [entityType, entityId, entityField] = documentName.split('.'); + console.log({ action: 'Fetching tiptap document', documentName, entityType, entityId, entityField }); if (entityType === 'issue' && entityField === 'description') { const issue = await db.sequelize.models.Issue.findOne({ @@ -210,6 +211,8 @@ const myContextFunction = async (request) => { const token = request.headers.authorization || ''; let user = null; + return { db, user }; + // Allow if introspection query only if (!Array.isArray(request.body) && request?.body?.query?.includes('IntrospectionQuery')) { return {