-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.js
More file actions
65 lines (60 loc) · 865 Bytes
/
schema.js
File metadata and controls
65 lines (60 loc) · 865 Bytes
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
const { gql } = require("apollo-server");
exports.typeDefs = gql`
"""
用户
"""
type User {
"主键"
id: ID!
"邮箱"
email: String!
"用户名"
name: String
"年龄"
age: Int
"生日"
birthDay: String
"身高"
height(unit: HeightUnit = CENTIMETRE): Float
"文章"
posts: [Post]
}
"""
文章
"""
type Post {
"主键"
id: ID!
"作者"
author: User
"标题"
title: String
"內容"
content: String
"发布时间"
createdAt: String
}
"""
分页
"""
type Pagination {
list: [Post]
total: Int
pageSize: Int
current: Int
}
"""
升高
"""
enum HeightUnit {
"米"
METRE
"厘米"
CENTIMETRE
}
type Query {
hello: String
users(count: Int): [User]
user(id: Int, name: String): User
}
`;