Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
305 changes: 305 additions & 0 deletions graphql/codegen/examples/example-postgis.schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
"""A universally unique identifier as defined by [RFC 4122](https://tools.ietf.org/html/rfc4122)."""
scalar UUID

"""
A point in time as described by the [ISO
8601](https://en.wikipedia.org/wiki/ISO_8601) standard. May or may not include a timezone.
"""
scalar Datetime

"""A string representing a cursor for pagination."""
scalar Cursor

"""GeoJSON scalar for PostGIS geometry input/output."""
scalar GeoJSON

"""The root query type."""
type Query {
"""Reads and enables pagination through a set of `Place`."""
places(
first: Int
last: Int
offset: Int
before: Cursor
after: Cursor
orderBy: [PlacesOrderBy!] = [PRIMARY_KEY_ASC]
filter: PlaceFilter
condition: PlaceCondition
): PlacesConnection

"""Reads a single `Place` using its globally unique `ID`."""
place(id: UUID!): Place

"""Reads and enables pagination through a set of `Route`."""
routes(
first: Int
last: Int
offset: Int
before: Cursor
after: Cursor
orderBy: [RoutesOrderBy!] = [PRIMARY_KEY_ASC]
filter: RouteFilter
condition: RouteCondition
): RoutesConnection

"""Reads a single `Route` using its globally unique `ID`."""
route(id: UUID!): Route
}

"""The root mutation type."""
type Mutation {
"""Creates a single `Place`."""
createPlace(input: CreatePlaceInput!): CreatePlacePayload

"""Updates a single `Place` using its globally unique `ID`."""
updatePlace(input: UpdatePlaceInput!): UpdatePlacePayload

"""Deletes a single `Place` using its globally unique `ID`."""
deletePlace(input: DeletePlaceInput!): DeletePlacePayload

"""Creates a single `Route`."""
createRoute(input: CreateRouteInput!): CreateRoutePayload

"""Updates a single `Route` using its globally unique `ID`."""
updateRoute(input: UpdateRouteInput!): UpdateRoutePayload

"""Deletes a single `Route` using its globally unique `ID`."""
deleteRoute(input: DeleteRouteInput!): DeleteRoutePayload
}

# ============================================================================
# Entity Types
# ============================================================================

type Place {
id: UUID!
name: String!
location: GeoJSON
createdAt: Datetime!
updatedAt: Datetime
}

type Route {
id: UUID!
name: String!
path: GeoJSON
createdAt: Datetime!
}

# ============================================================================
# Enums
# ============================================================================

enum PlacesOrderBy {
NATURAL
PRIMARY_KEY_ASC
PRIMARY_KEY_DESC
ID_ASC
ID_DESC
NAME_ASC
NAME_DESC
CREATED_AT_ASC
CREATED_AT_DESC
}

enum RoutesOrderBy {
NATURAL
PRIMARY_KEY_ASC
PRIMARY_KEY_DESC
ID_ASC
ID_DESC
NAME_ASC
NAME_DESC
CREATED_AT_ASC
CREATED_AT_DESC
}

# ============================================================================
# Connection Types
# ============================================================================

type PlacesConnection {
nodes: [Place!]!
edges: [PlacesEdge!]!
pageInfo: PageInfo!
totalCount: Int!
}

type PlacesEdge {
node: Place!
cursor: Cursor!
}

type RoutesConnection {
nodes: [Route!]!
edges: [RoutesEdge!]!
pageInfo: PageInfo!
totalCount: Int!
}

type RoutesEdge {
node: Route!
cursor: Cursor!
}

type PageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: Cursor
endCursor: Cursor
}

# ============================================================================
# Filter Types (geometry columns should use GeoJSONFilter)
# ============================================================================

input PlaceFilter {
id: UUIDFilter
name: StringFilter
location: GeoJSONFilter
and: [PlaceFilter!]
or: [PlaceFilter!]
not: PlaceFilter
}

input RouteFilter {
id: UUIDFilter
name: StringFilter
path: GeoJSONFilter
and: [RouteFilter!]
or: [RouteFilter!]
not: RouteFilter
}

input UUIDFilter {
equalTo: UUID
notEqualTo: UUID
in: [UUID!]
notIn: [UUID!]
isNull: Boolean
}

input StringFilter {
equalTo: String
notEqualTo: String
in: [String!]
notIn: [String!]
includes: String
startsWith: String
endsWith: String
isNull: Boolean
}

input GeoJSONFilter {
isNull: Boolean
equalTo: GeoJSON
notEqualTo: GeoJSON
distinctFrom: GeoJSON
notDistinctFrom: GeoJSON
}

# ============================================================================
# Condition Types
# ============================================================================

input PlaceCondition {
id: UUID
name: String
location: GeoJSON
}

input RouteCondition {
id: UUID
name: String
path: GeoJSON
}

# ============================================================================
# Mutation Input Types
# ============================================================================

input CreatePlaceInput {
clientMutationId: String
place: PlaceInput!
}

input PlaceInput {
name: String!
location: GeoJSON
}

input UpdatePlaceInput {
clientMutationId: String
id: UUID!
patch: PlacePatch!
}

input PlacePatch {
name: String
location: GeoJSON
}

input DeletePlaceInput {
clientMutationId: String
id: UUID!
}

input CreateRouteInput {
clientMutationId: String
route: RouteInput!
}

input RouteInput {
name: String!
path: GeoJSON
}

input UpdateRouteInput {
clientMutationId: String
id: UUID!
patch: RoutePatch!
}

input RoutePatch {
name: String
path: GeoJSON
}

input DeleteRouteInput {
clientMutationId: String
id: UUID!
}

# ============================================================================
# Mutation Payload Types
# ============================================================================

type CreatePlacePayload {
clientMutationId: String
place: Place
}

type UpdatePlacePayload {
clientMutationId: String
place: Place
}

type DeletePlacePayload {
clientMutationId: String
place: Place
}

type CreateRoutePayload {
clientMutationId: String
route: Route
}

type UpdateRoutePayload {
clientMutationId: String
route: Route
}

type DeleteRoutePayload {
clientMutationId: String
route: Route
}
Loading
Loading