Created
March 7, 2022 14:29
-
-
Save evankirkiles/68124044372c84efecee4bafa5bc3e76 to your computer and use it in GitHub Desktop.
MEDIUM: AWS Amplify Cascading Deletion Queries + Mutations
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
// /opt/graphql/queries.js | |
const listClotheImages = /* GraphQL */ ` | |
query listClotheImages( | |
$filter: ModelClotheImageFilterInput | |
$nextToken: String | |
) { | |
listClotheImages(filter: $filter, nextToken: $nextToken) { | |
items { | |
id | |
} | |
nextToken | |
} | |
} | |
`; | |
const listOutfitComponents = /* GraphQL */ ` | |
query listOutfitComponents( | |
$filter: ModelOutfitComponentFilterInput | |
$nextToken: String | |
) { | |
listOutfitComponents(filter: $filter, nextToken: $nextToken) { | |
items { | |
id | |
outfitComponentsId | |
} | |
nextToken | |
} | |
} | |
`; | |
module.exports = { | |
listClotheImages, | |
listOutfitComponents, | |
}; | |
// /opt/graphql/mutations.js | |
const deleteClothe = /* GraphQL */ ` | |
mutation deleteClothe($input: DeleteClotheInput!) { | |
deleteClothe(input: $input) { | |
id | |
} | |
} | |
`; | |
const deleteClotheImage = /* GraphQL */ ` | |
mutation deleteClotheImage($input: DeleteClotheImageInput!) { | |
deleteClotheImage(input: $input) { | |
id | |
} | |
} | |
`; | |
const deleteOutfitComponent = /* GraphQL */ ` | |
mutation deleteOutfitComponent($input: DeleteOutfitComponentInput!) { | |
deleteOutfitComponent(input: $input) { | |
id | |
} | |
} | |
`; | |
module.exports = { | |
deleteClothe, | |
deleteClotheImage, | |
deleteOutfitComponent, | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment