Skip to content

Commit

Permalink
Add logging for document fetch and update return object
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
claygorman committed Dec 19, 2023
1 parent b512f4a commit b8e662b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit b8e662b

Please sign in to comment.