-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.ts
More file actions
40 lines (35 loc) · 946 Bytes
/
schema.ts
File metadata and controls
40 lines (35 loc) · 946 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
import { makeExecutableSchema } from 'graphql-tools';
import resolvers from './resolvers';
const typeDefs = `
type User {
username: String!
name: String!
picture: String
}
type Tag {
_id: Int @cypher(statement: "WITH {this} AS this RETURN ID(this)")
username: String!
title: String!
text: String
lat: Float
lon: Float
ele: Float
dtg: String
}
type Query {
getUser(username: String) : User
allUsers : [User]
tagById(id: Int) : Tag
tagsByUsername(username: String) : [Tag]
tagsByLocation(lat: Float, lon: Float radius: Float): [Tag]
}
type Mutation {
createUser(username: String, name: String, picture: String) : User
createTag(username: String, title: String, text: String, lat: Float, lon: Float, ele: Float, dtg: String) : Tag
removeTag(id: Int) : Tag
updateTag(id: Int, title: String, text: String) : Tag
}
`;
export default makeExecutableSchema({
typeDefs, resolvers,
});