F8App_DataModel_Prisma_version

F8App GraphQL 服务器 Prisma版本的Datamodel重构版
添加了关联的类型, Tag类型, 关联条件实际只有演讲↔️演讲者, 演讲↔️地图,演讲↔️标签的关系

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
type Agenda {
id: ID! @unique
startTime:String
endTime:String
speakers:[Speaker!]! @relation(name:"AgendaBySpeaker") #一个 agenda可以有多个发言者
tags:[Tag!]! # 一个 Agenda可以有多个 tag, 不会发生歧义所以不用@ relation关联条件
allDay:Boolean@default(value:"false")
day:Int!
hasDetails:Boolean@default(value:"true")
onMySchedule:Boolean@default(value:"false")
sessionDescription:String
sessionLocation:Map!@relation(name:"AgendaOfMap") #每个 agenda有一个地理位置
sessionSlug: String
sessionTitle:String!
createdAt: DateTime!
updatedAt: DateTime!
}

type Speaker {
id: ID! @unique
speakerPic: String
speakerName: String!
speakerTitle:String!
createdAt: DateTime!
updatedAt: DateTime!
agendas:[Agenda!]!@relation(name:"AgendaBySpeaker") #一个发言者可以有多个 agenda

}

type Map {
id:ID!@unique
x1:String
x2:String
x3:String
name:String
createdAt: DateTime!
updatedAt: DateTime!
mapOfAgendas:[Agenda!]!@relation(name:"AgendaOfMap") # 一个地图可以有多个 agenda
}

type Faq {
id:ID!@unique
question:String
anwser:String
createdAt: DateTime!
updatedAt: DateTime!
}

type Notification {
id:ID!@unique
text:String!
createdAt: DateTime!
updatedAt: DateTime!
}

type Page {
id:ID!@unique
alias: String
title:String
createdAt: DateTime!
updatedAt: DateTime!
}

type Todo {
id:ID!@unique
createdAt: DateTime!
updatedAt: DateTime!
text: String
isCompleted:Boolean@default(value:"false")
}

type Tag {
id:ID!@unique
createdAt: DateTime!
updatedAt: DateTime!
text: String
description:String
agenda:Agenda
}

playground中的方法

添加一个 Agenda 需要输入的字段

单个 Agenda 的mutate 操作

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
mutate AgendaCreateInput {
startTime: String
endTime: String
allDay: Boolean
day: Int!
hasDetails: Boolean
onMySchedule: Boolean
sessionDescription: String
sessionSlug: String
sessionTitle: String!
speakers:{
speakerPic: String
speakerName: String!
speakerTitle: String!
}

tags:{
text: String
description: String
}

sessionLocation:{
x1: String
x2: String
x3: String
name: String
}
}