-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfoodDB.gql
146 lines (123 loc) Β· 2.85 KB
/
foodDB.gql
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
143
144
145
146
type Recipe @collection(name: "recipes") {
ingredients: [IngredientEntry!] @relation
title: String!
chef: Chef!
description: String
instructions: String
time: Int
image: String
public: Boolean
}
type IngredientEntry @collection(name: "ingrediententries") {
ingredient: Ingredient!
recipe: Recipe!
name: String!
amount: String
notes: String
order: Int
}
type Ingredient @collection(name: "ingredients") {
name: String! @unique
}
input ChefInput {
username: String!
name: String
bio: String
image: String
}
type Chef @collection(name: "chefs") {
username: String! @unique
name: String
recipes: [Recipe!] @relation
bio: String
image: String
}
type Query {
myRecipes(filter: FilterInput):[Recipe!] @resolver(name: "search_recipes")
allIngredients: [Ingredient!]! @index(name: "all_ingredients")
findChefByUsername(username: String!): Chef! @index(name: "find_chef_by_username")
me: Chef! @resolver(name: "Identity")
}
input FilterInput {
chefid: ID
searchterm: String
maxtime: Int
}
input IngredientInput {
name: String!
}
input ChefRecipesRelation {
create: [RecipeInput]
connect: [ID]
disconnect: [ID]
}
input RecipeChefRelation {
create: ChefInput
connect: ID
}
input RecipeIngredientsRelation {
create: [IngredientEntryInput]
connect: [ID]
disconnect: [ID]
}
input RecipeInput {
ingredients: RecipeIngredientsRelation
title: String!
chef: RecipeChefRelation
description: String
instructions: String
time: Int
image: String
public: Boolean
}
input NewRecipeInput {
ingredients: [UpdateIngredientEntryInput!]
title: String!
chef: RecipeChefRelation
description: String
instructions: String
time: Int
image: String
public: Boolean
}
type Mutation {
logoutChef:Boolean! @resolver(name:"logout_chef")
newRecipe(input: NewRecipeInput): ID! @resolver(name: "create_recipe")
createChef(input: CreateChefInput): Chef! @resolver(name: "create_chef")
loginChef(input: LoginChefInput): String! @resolver(name: "login_chef")
batchDeleteRecipeIngredients(input:[ID!]): Boolean! @resolver(name: "batch_delete_recipe_ingredients")
batchUpdateRecipeIngredients(input:[UpdateIngredientEntryInput!]): [IngredientEntry] @resolver(name:"batch_update_recipe_ingredients")
}
input UpdateIngredientEntryInput {
id: ID!
ingredientid: ID!
name: String!
amount: String!
order: Int
notes: String!
recipeid: ID!
}
input IngredientEntryInput {
ingredient: IngredientEntryIngredientRelation
recipe: IngredientEntryRecipeRelation
name: String!
amount: String
notes: String
order: Int
}
input IngredientEntryIngredientRelation {
create: IngredientInput
connect: ID
}
input IngredientEntryRecipeRelation {
create: RecipeInput
connect: ID
}
input LoginChefInput {
username: String!
password: String!
}
input CreateChefInput {
username: String!
password: String!
}