Files
2022-03-09 22:16:51 +02:00

51 lines
939 B
JavaScript

const { gql } = require("apollo-server");
const typeDefs = gql`
type MainCard {
title: String!
image: String!
}
type Animal {
id: ID!
image: String!
title: String!
rating: Float
price: String!
description: [String]!
slug: String!
stock: Int!
onSale: Boolean
category: Category
}
type Category {
id: ID!
image: String!
category: String!
slug: String!
animals: [Animal!]!
}
type Query {
mainCards: [MainCard]
animals: [Animal!]!
animal(slug: String!): Animal
categories: [Category!]!
category(slug: String!): Category
}
type Mutation {
addAnimal(
image: String!
title: String!
rating: Float
price: String!
description: [String]!
slug: String!
stock: Int!
onSale: Boolean
category: String
): Animal
removeAnimal(id: ID!): Boolean
}
`;
module.exports = { typeDefs };