test.graphqls 1.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
# A GraphQL schema provides a root type for each kind of operation.
schema {
    # The query root.
    query: Query

    # The mutation root.
    mutation: Mutation
}

type Query {
    # Version of the application.
12
    version: String!
13 14

    # List of events of a specified category.
15
    eventsByCategoryAndStatus(categoryId: ID!, status: EventStatus): [Event]!
16 17

    # Single event by ID.
18
    eventById(id: ID!): Event!
19 20 21 22
}

type Mutation {
    # Create a new event.
B
Bogdan Kobylynskyi 已提交
23
    createEvent(categoryId: String!, createdBy: String!): Event! @auth(role:"admin")
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
}


# An event that describes a thing that happens
type Event {
    id: ID
    categoryId: String
    properties: [EventProperty]
    status: EventStatus
    createdBy: String
    createdDateTime: DateTime
    active: Boolean
    rating: Int
}

# An event property have all possible types
type EventProperty {
    floatVal: Float
    booleanVal: Boolean
    intVal: Int
    stringVal: String
    child: [EventProperty]
    parent: Event
}

# Custom DateTime scalar
# Format: yyyy-MM-dd'T'HH:mm:ssZ
scalar DateTime


# Possible statuses of the event
enum EventStatus {
    OPEN
    IN_PROGRESS
    LOGGED
}