Skip to content

Instantly share code, notes, and snippets.

@evankirkiles
Created March 7, 2022 14:29
Show Gist options
  • Save evankirkiles/68124044372c84efecee4bafa5bc3e76 to your computer and use it in GitHub Desktop.
Save evankirkiles/68124044372c84efecee4bafa5bc3e76 to your computer and use it in GitHub Desktop.
MEDIUM: AWS Amplify Cascading Deletion Queries + Mutations
// /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