-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.yaml
164 lines (153 loc) · 3.7 KB
/
example.yaml
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
backend:
package: internal
# TODO remove this, generate it somehow
model_imports:
- "from datetime import datetime, date"
datamodel:
user:
table: user
primary_key: user_id
description: User entity
graphql:
# patch: true
# create: true
# delete: true
# update: true
# identifier: userId
hierarchy:
reviews:
description: User's reviews
relationship: reviews
eager_load: true
# as_list: True
fields:
# - name: name of database field
# type: field type
# nullable: true/false - defaults to false
# foreign_model: datamodel name e.g. user
# foreign_model_field: field name e.g. user_id
- name: user_id
type: integer
description: User primary key
can_create: false
can_update: false
- name: username
type: string
description: Username
filters:
eq: true
ne: true
like: true
re: true
- name: password
type: string
- name: created_at
type: datetime
default: datetime.utcnow
can_create: false
can_update: false
- name: updated_at
type: datetime
default: datetime.utcnow
onupdate: datetime.utcnow
can_create: false
can_update: false
relationships:
reviews:
foreign_model: review
foreign_model_field: user_id
backref: user
restaurant:
table: restaurant
primary_key: restaurant_id
fields:
- name: restaurant_id
type: integer
can_create: false
can_update: false
filters:
lt: true
gt: true
lte: true
gte: true
- name: name
type: string
- name: address
type: string
- name: cuisine
type: string
- name: average_rating
type: decimal
- name: created_at
type: datetime
default: datetime.utcnow
can_create: false
can_update: false
- name: updated_at
type: datetime
default: datetime.utcnow
onupdate: datetime.utcnow
can_create: false
can_update: false
graphql:
hierarchy:
reviews:
relationship: reviews
relationships:
reviews:
foreign_model: review
foreign_model_field: restaurant_id
backref: restaurant
review:
table: review
primary_key: review_id
fields:
- name: review_id
type: integer
can_create: false
can_update: false
- name: restaurant_id
type: integer
foreign_model: restaurant
foreign_model_field: restaurant_id
- name: user_id
type: integer
foreign_model: user
foreign_model_field: user_id
- name: rating
type: integer
- name: visit_date
type: date
- name: comment
type: integer
- name: created_at
type: datetime
default: datetime.utcnow
can_create: false
can_update: false
- name: updated_at
type: datetime
default: datetime.utcnow
onupdate: datetime.utcnow
can_create: false
can_update: false
graphql:
hierarchy:
# these are via backref
user:
description: User for review
relationship: user
eager_load: true
as_list: false
restaurant:
description: Restaurant for review
relationship: restaurant
eager_load: true
as_list: false
indexes:
review_restaurant_idx:
fields:
- restaurant_id
# relationships
# graphql fields