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

    # The mutation root.
    mutation: Mutation
8 9 10

    # The subscription root.
    subscription: Subscription
11 12 13 14
}

type Query {
    # Version of the application.
15
    version: String!
16 17

    # List of events of a specified category.
18
    eventsByCategoryAndStatus(categoryId: ID!, status: EventStatus): [Event]!
19 20

    # Single event by ID.
21
    eventById(id: ID!): Event!
22 23 24

    # Events by IDs.
    eventsByIds(ids: [ID!]!): [Event!]!
25 26 27 28
}

type Mutation {
    # Create a new event.
B
Bogdan Kobylynskyi 已提交
29
    createEvent(categoryId: String!, createdBy: String!): Event! @auth(role:"admin")
30 31
}

32 33 34 35 36
type Subscription {
    # Subscribe to events
    eventsCreated: [Event!]!
}

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

# 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
}