All files / src/lib/graphql mutations.ts

100% Statements 13/13
100% Branches 0/0
100% Functions 0/0
100% Lines 13/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142          1x                                 1x                 1x                 1x                 1x                           1x                 1x                 1x                     1x           1x                     1x                     1x                     1x                    
import { gql } from '@apollo/client';
 
/**
 * Mutation to create a new user account
 */
export const CREATE_USER = gql`
  mutation createUser($userRegisterInput: UserRegisterInput!) {
    createUser(userRegisterInput: $userRegisterInput) {
      success
      message
      messageKey
      user {
        id
        email
        firstName
        lastName
        userName
      }
    }
  }
`;
 
export const RESET_PASSWORD = gql`
  mutation resetPassword($email: String!) {
    resetPassword(email: $email) {
      success
      message
    }
  }
`;
 
export const SET_NEW_PASSWORD = gql`
  mutation setNewPassword($token: String!, $newPassword: String!) {
    setNewPassword(token: $token, newPassword: $newPassword) {
      success
      message
    }
  }
`;
 
export const CHANGE_PASSWORD = gql`
  mutation changePassword($passwordEditInput: PasswordEditInput!) {
    changePassword(passwordEditInput: $passwordEditInput) {
      success
      message
    }
  }
`;
 
export const UPDATE_USER = gql`
  mutation updateUser($userUpdateInput: UserUpdateInput!) {
    updateUser(userUpdateInput: $userUpdateInput) {
      success
      message
      user {
        id
        firstName
        lastName
      }
    }
  }
`;
 
export const CREATE_RECIPE = gql`
  mutation CreateRecipe($recipeCreateInput: RecipeCreateInput!) {
    createRecipe(recipeCreateInput: $recipeCreateInput) {
      id
      title
    }
  }
`;
 
export const EDIT_RECIPE = gql`
  mutation EditRecipe($id: ID!, $recipeEditInput: RecipeEditInput!) {
    editRecipe(id: $id, recipeEditInput: $recipeEditInput) {
      id
      title
    }
  }
`;
 
export const RATE_RECIPE = gql`
  mutation RateRecipe($ratingInput: RatingInput!) {
    rateRecipe(ratingInput: $ratingInput) {
      id
      averageRating
      ratingsCount
      userRating
    }
  }
`;
 
export const DELETE_RATING = gql`
  mutation DeleteRating($recipeId: ID!) {
    deleteRating(recipeId: $recipeId)
  }
`;
 
export const ADD_TO_FAVORITE_RECIPES = gql`
  mutation AddToFavoriteRecipes($userId: ID!, $recipeId: ID!) {
    addToFavoriteRecipes(userId: $userId, recipeId: $recipeId) {
      success
      message
      messageKey
      statusCode
    }
  }
`;
 
export const REMOVE_FROM_FAVORITE_RECIPES = gql`
  mutation RemoveFromFavoriteRecipes($userId: ID!, $recipeId: ID!) {
    removeFromFavoriteRecipes(userId: $userId, recipeId: $recipeId) {
      success
      message
      messageKey
      statusCode
    }
  }
`;
 
export const FOLLOW_USER = gql`
  mutation FollowUser($targetUserId: ID!) {
    followUser(targetUserId: $targetUserId) {
      success
      message
      messageKey
      statusCode
    }
  }
`;
 
export const UNFOLLOW_USER = gql`
  mutation UnfollowUser($targetUserId: ID!) {
    unfollowUser(targetUserId: $targetUserId) {
      success
      message
      messageKey
      statusCode
    }
  }
`;