Last active
November 30, 2023 04:30
-
-
Save iamsuneeth/dd33d31282222c96cfe6b35c06dfe21d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable @typescript-eslint/no-var-requires */ | |
/* eslint-disable no-param-reassign */ | |
const { ObjectId } = require('mongodb'); | |
function setConfigCreateBody(requestParams, context, ee, next) { | |
const contentId = new ObjectId(); | |
requestParams.body = JSON.stringify({ | |
query: `mutation UpsertConfigs($data: ConfigsInput!) { | |
upsertConfigs(data: $data) { | |
code | |
message | |
success | |
data { | |
contentId | |
} | |
} | |
}`, | |
variables: { | |
data: { | |
contentId | |
}, | |
}, | |
}); | |
next(); | |
} | |
function setConfigUpdateBody(requestParams, context, ee, next) { | |
requestParams.body = JSON.stringify({ | |
query: `mutation UpsertLayoutConfigs($data: ConfigsInput!, $query: ConfigsQueryInput) { | |
upsertConfigs(data: $data, query: $query) { | |
code | |
message | |
success | |
data { | |
contentId | |
} | |
} | |
}`, | |
variables: { | |
data: { | |
contentId: context.vars.contentId | |
// other fields | |
}, | |
query: { | |
contentId: context.vars.contentId, | |
}, | |
}, | |
}); | |
next(); | |
} | |
// ... other functions | |
module.exports = { | |
setLayoutConfigCreateBody, | |
// ... | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment