-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.gql
101 lines (89 loc) · 1.97 KB
/
schema.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
# @format
type CookingTip @embedded {
text: String!
}
type Image @embedded {
id: ID!
url: Float!
alt: String
}
type Ingredient @embedded {
id: Int
amount: Float!
calories: Float!
original: String!
name: String!
unit: String!
}
type Method @embedded {
instruction: String!
}
type Stock @embedded {
id: Int
amount: Float!
name: String!
stock: Float
unit: String!
}
type User {
firstName: String!
lastName: String!
email: String! @unique
calories: Int
avatar: String
favourites: [Recipe!] @relation(name: "user_favourites")
recipes: [Recipe!] @relation(name: "user_recipes")
plans: [Plan!] @relation
shoppingLists: [Shopping!] @relation
}
type Recipe {
description: String
image: String
ingredients: [Ingredient]
method: [Method]
serving: Int
tags: [Tag] @relation
title: String! @unique
author: User! @relation(name: "user_recipes")
favouritedBy: [User!] @relation(name: "user_favourites")
recipes: [Recipe]
schedule: [Schedule] @relation
tips: [CookingTip]
}
type Schedule {
day: String!
meal: String!
plan: Plan! @relation
recipe: Recipe! @relation
serving: Int!
owner: User!
}
type Plan {
week: String!
schedule: [Schedule] @relation
owner: User!
}
type Shopping {
week: String!
ingredients: [Stock]
owner: User!
}
type Tag {
name: String! @unique
recipes: [Recipe] @relation
}
type Query {
allPlansSortedByWeek: [Plan!]!
@resolver(name: "all_plans_sorted_by_week", paginated: true)
allRecipes: [Recipe!]
allTags: [Tag!]
findPlanByDate(week: String!): [Plan] @resolver(name: "find_plan_by_date")
findShoppingByDate(week: String!): [Shopping]
@resolver(name: "find_shopping_by_date")
findTagByName(name: String!): Tag
findUserByEmail(email: String!): User
isUserFavouriteRecipeById(id: ID!): Boolean
@resolver(name: "find_favourite_recipe_by_id")
searchRecipe(title: String, calories: Int, tags: [String]): [Recipe]
@resolver(name: "search_recipes", paginated: true)
}