ChatQueries.js 826 Bytes
import { gql } from "apollo-boost";

export const SUBSCRIPTION_MSG = gql`
  subscription subMessage {
    subMessage {
      id
      text
      sender {
        id
        username
      }
      createdAt
    }
  }
`;

export const NEW_MESSAGE = gql`
  mutation newMessage($message: String!) {
    newMessage(message: $message) {
      id
      text
      sender {
        id
        username
      }
      createdAt
    }
  }
`;

export const WHOLE_MESSAGE = gql`
  mutation wholeMessage($message: String!, $roomId: Int!) {
    wholeMessage(message: $message, roomId: $roomId) {
      id
      text
      sender {
        id
        username
      }
      createdAt
    }
  }
`;

export const GET_ROOM_BY_NAME = gql`
  query getRoomByName($roomName: String!) {
    getRoomByName(roomName: $roomName) {
      id
    }
  }
`;