我不知道我的 graphql 请求的问题在哪里
I can't figure where is the problem with my graphql request
每次尝试在 graphql 中发送数据查询时,我都会收到错误的请求代码,
而且我无法确定问题是来自解析器还是来自输入,
下面是解析器:
const addTranslationTableAdminResolver = async (args, context, info) => {
checkAuth(context);
const videocardId = args.input.videoCardId;
const videoLink = args.input.videoLink;
const orgId = args.input.orgId;
await context.dao.createTranslationTable({
id,
orgId,
videocardId,
dateTime,
videoLink,
});
return {
statusMessage: 'SUCCESS',
};
};
数据对象访问如下:
const createTranslationTable = async ({ orgId, videocardId, videoLink }) => {
const queryString = `INSERT INTO translation_table (org_id, video_id,request_date,video_link)
VALUES (, , , ) RETURNING *`;
const dateTime = new Date();
const values = [orgId, videocardId, dateTime, videoLink];
const result = await query(queryString, values);
if (result && result.rows.length === 1) {
return getAllTranslationObject(result.rows[0]);
}
};
当我尝试发送数据查询时,遇到与上述相同的错误。
const createTransaltionVideoCard = (orgId, videoCardId, videoLink) => {
return gqBackOfficeClient.mutate({
mutation: gql`
mutation {
createTranslationTable(input: {
orgId: ${orgId},
videocardId: ${videoCardId},
videoLink :"${videoLink}"
}) {
statusMessage
}
}
`,
});
};
const handleTranslationButtonClick = (orgId, videoCardId, videoLink) => {
setIsTranslationButtonClicked(true);
createTransaltionVideoCard({
orgId,
videoCardId,
videoLink,
}).then((res) => {
console.log(res);
});
};
只是为了更新,解决了这个问题,这是解析器的问题,现在它工作正常 –
每次尝试在 graphql 中发送数据查询时,我都会收到错误的请求代码,
而且我无法确定问题是来自解析器还是来自输入,
下面是解析器:
const addTranslationTableAdminResolver = async (args, context, info) => {
checkAuth(context);
const videocardId = args.input.videoCardId;
const videoLink = args.input.videoLink;
const orgId = args.input.orgId;
await context.dao.createTranslationTable({
id,
orgId,
videocardId,
dateTime,
videoLink,
});
return {
statusMessage: 'SUCCESS',
};
};
数据对象访问如下:
const createTranslationTable = async ({ orgId, videocardId, videoLink }) => {
const queryString = `INSERT INTO translation_table (org_id, video_id,request_date,video_link)
VALUES (, , , ) RETURNING *`;
const dateTime = new Date();
const values = [orgId, videocardId, dateTime, videoLink];
const result = await query(queryString, values);
if (result && result.rows.length === 1) {
return getAllTranslationObject(result.rows[0]);
}
};
当我尝试发送数据查询时,遇到与上述相同的错误。
const createTransaltionVideoCard = (orgId, videoCardId, videoLink) => {
return gqBackOfficeClient.mutate({
mutation: gql`
mutation {
createTranslationTable(input: {
orgId: ${orgId},
videocardId: ${videoCardId},
videoLink :"${videoLink}"
}) {
statusMessage
}
}
`,
});
};
const handleTranslationButtonClick = (orgId, videoCardId, videoLink) => {
setIsTranslationButtonClicked(true);
createTransaltionVideoCard({
orgId,
videoCardId,
videoLink,
}).then((res) => {
console.log(res);
});
};
只是为了更新,解决了这个问题,这是解析器的问题,现在它工作正常 –