IO-2327 job importing test cases
This commit is contained in:
@@ -12,6 +12,12 @@ query FIND_BODYSHOP_BY_MESSAGING_SERVICE_SID(
|
||||
}
|
||||
`;
|
||||
|
||||
exports.INSERT_AVAILABLE_JOB = `mutation INSERT_AVAILABLE_JOB($job: available_jobs_insert_input!) {
|
||||
insert_available_jobs_one(object: $job) {
|
||||
id
|
||||
}
|
||||
}`;
|
||||
|
||||
exports.UNARCHIVE_CONVERSATION = `
|
||||
mutation UNARCHIVE_CONVERSATION($id: uuid!) {
|
||||
update_conversations_by_pk(pk_columns: {id: $id}, _set: {archived: false}) {
|
||||
|
||||
24
server/test/query.js
Normal file
24
server/test/query.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const GraphQLClient = require("graphql-request").GraphQLClient;
|
||||
|
||||
exports.testQuery = async function (req, res) {
|
||||
const BearerToken = req.headers.authorization;
|
||||
const { query, ...rest } = req.body;
|
||||
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||
headers: {
|
||||
Authorization: BearerToken,
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(query, {
|
||||
...rest,
|
||||
});
|
||||
|
||||
res.status(200).json(result);
|
||||
} catch (error) {
|
||||
res.status(400).send(JSON.stringify(error));
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user