-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.xml
More file actions
85 lines (75 loc) · 3.72 KB
/
Copy pathschema.xml
File metadata and controls
85 lines (75 loc) · 3.72 KB
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
<?xml version="1.0" encoding="UTF-8" ?>
<!--
- MetaData - API Generator.
- Copyright (C) 2022-2023 Bill Hails
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<!-- schema name is required -->
<schema name="demo" auth="enabled" access-token-expiry="24h" security="xss">
<entity name="users" auth-role="owner" auth-access="owner">
<!-- descriptions end up in the graphql docs -->
<description>A user of the service.</description>
<!-- fields are the components of entities -->
<field name="display_name" type="name"/>
<field name="email" type="email" unique="y" auth-role="external-id" auth-visibility="redacted"/>
<field name="password" type="password" auth-role="password" auth-visibility="hidden"/>
</entity>
<entity name="posts" auth-access="owner" debug="auth">
<description>A post by a user.</description>
<field name="title" type="title"/>
<field name="body" type="text"/>
<!-- a reference is a foreign key, essentially -->
<reference name="owner" references="users" auth-role="owner"/>
</entity>
<entity name="comments" auth-access="owner">
<description>A comment on a user, post or other comment.</description>
<field name="body" type="text"/>
<reference name="owner" references="users" auth-role="owner"/>
<!-- unions are discriminated foreign keys, this "about" union can refer to a user, post or comment -->
<union name="about">
<reference name="user" references="users" inverse="messages"/>
<reference name="post" references="posts"/>
<reference name="comment" references="comments" inverse="replies"/>
</union>
<field name="private" type="boolean" default="false" auth-role="private"/>
</entity>
<entity name="likes" auth-access="owner">
<description>Likes of a comment or post.</description>
<reference name="owner" references="users" auth-role="owner"/>
<union name="about">
<reference name="post" references="posts"/>
<reference name="comment" references="comments"/>
</union>
</entity>
<entity name="categories" auth-access="admin">
<description>Categories of Posts</description>
<field name="label" type="title" unique="y"/>
</entity>
<enum name="badge">
<option name="star"/>
<option name="hero"/>
</enum>
<entity name="badges" auth-access="owner">
<description>Awards given to users by users</description>
<!-- enum name must match -->
<enum name="badge"/>
<field name="amount" type="money"/>
<reference name="awarded_to" references="users" inverse="badges_for_me"/>
<reference name="awarded_by" references="users" inverse="badges_from_me" auth-role="owner"/>
</entity>
<!-- associations are many-to-many relationships -->
<association name="friends" lhs="users" rhs="users" auth-access="owner" auth-path="lhs,rhs"/>
<association name="posts_categories" lhs="posts" rhs="categories" auth-access="owner" auth-visibility="visible" auth-path="lhs.owner"/>
</schema>