'i want to update dynamodbTable And I don't know am i wrong at dynomodb and qraphQL so then show me
i tires to Updated my dynamoDB table so i'm struck to schema and code , and then idk what i wrong with this code in javascript and schema pls help me to fix ! that code
this apollo playgroup Error log
{ "errors": [ { "message": "The provided key element does not match the schema"
This schema from Graphql
> updateJobApplication(input:UpdateJobApplication) : JobApplication!
>
>
> input UpdateJobApplication {
> postID:ID!
> createdByUserId:ID
> workTypeJobApplicationList: \[UpdateWorkTypeJobApplication!\]
> technicianList: \[UpdateTechnician\]
>
>
> input UpdateWorkTypeJobApplication {
> workType: String
> isLinked: Boolean
> fieldID: String
> jobList: \[ID\]
> totalJobList: \[UpdateTotalJobApplication!\] }
>
> input UpdateTechnician {
> userID: ID
> getUser: String }
>
> input UpdateTotalJobApplication {
> fieldValue: String
> registerQty: Int }
Table from dynamodb
***TableDynamoDbTable: {
Type: "AWS::DynamoDB::Table",
Properties: {
TableName: *****
BillingMode: "PAY_PER_REQUEST",
KeySchema: [
{ AttributeName: "postID", KeyType: "HASH" },
{ AttributeName: "applicationID", KeyType: "RANGE" },
],
GlobalSecondaryIndexes: [
{
IndexName: "username",
KeySchema: [{ AttributeName: "username", KeyType: "HASH" }],
Projection: {
ProjectionType: "ALL",
},
},
],
AttributeDefinitions: [
{ AttributeName: "postID", AttributeType: "S" },
{ AttributeName: "applicationID", AttributeType: "S" },
],
},
},
Based code below: using javascript
updateJobApplication: async (_parent, _args, _ctx, _info): Promise<IJobApplication> => {
const dynamoDb = _ctx.db
const JOB_APPLICATION_TABLE_NAME = _ctx.JOB_APPLICATION_TABLE_NAME
const args = _args.input
const appPeding = _args.input
const updateApplication = {
...appPeding[0],
}
console.log("ARGS", args)
const params = {
TableName: JOB_APPLICATION_TABLE_NAME,
Key: {
postID: args.postID,
// applicationID: args.applicationID,
},
Item: updateApplication,
}
await dynamoDb.update(params).promise()
console.log(params)
return updateApplication`
},
i don't know am i wrong which line please help me!!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
