Skip to content

Commit

Permalink
refactor(server): graphql schema (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
yk-eukarya committed May 26, 2023
1 parent f27b788 commit ee07100
Show file tree
Hide file tree
Showing 18 changed files with 4,343 additions and 4,068 deletions.
3 changes: 0 additions & 3 deletions server/.graphqlconfig

This file was deleted.

108 changes: 108 additions & 0 deletions server/gql/_shared.graphql
@@ -0,0 +1,108 @@
scalar Upload
scalar Any
scalar DateTime
scalar URL
scalar Lang
scalar FileSize
scalar TranslatedString
scalar Cursor

# Meta Type

interface Node {
id: ID!
}

enum NodeType {
ASSET
USER
TEAM
PROJECT
PLUGIN
SCENE
PROPERTY_SCHEMA
PROPERTY
DATASET_SCHEMA
DATASET
LAYER_GROUP
LAYER_ITEM
}

# Pagination

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

input Pagination{
first: Int
last: Int
after: Cursor
before: Cursor
}

# Basic types

type LatLng {
lat: Float!
lng: Float!
}

type LatLngHeight {
lat: Float!
lng: Float!
height: Float!
}

type Camera {
lat: Float!
lng: Float!
altitude: Float!
heading: Float!
pitch: Float!
roll: Float!
fov: Float!
}

type Rect {
west: Float!
south: Float!
east: Float!
north: Float!
}

type Typography {
fontFamily: String
fontWeight: String
fontSize: Int
color: String
textAlign: TextAlign
bold: Boolean
italic: Boolean
underline: Boolean
}

enum TextAlign {
LEFT
CENTER
RIGHT
JUSTIFY
JUSTIFY_ALL
}

# Query & Mutation

type Query {
node(id: ID!, type: NodeType!): Node
nodes(id: [ID!]!, type: NodeType!): [Node]!
}

type Mutation

schema {
query: Query
mutation: Mutation
}
60 changes: 60 additions & 0 deletions server/gql/asset.graphql
@@ -0,0 +1,60 @@
type Asset implements Node {
id: ID!
createdAt: DateTime!
teamId: ID!
name: String!
size: FileSize!
url: String!
contentType: String!
team: Team
}

enum AssetSortType {
DATE
SIZE
NAME
}

# InputType

input CreateAssetInput {
teamId: ID!
file: Upload!
}

input RemoveAssetInput {
assetId: ID!
}

# Payload

type CreateAssetPayload {
asset: Asset!
}

type RemoveAssetPayload {
assetId: ID!
}

# Connection

type AssetConnection {
edges: [AssetEdge!]!
nodes: [Asset]!
pageInfo: PageInfo!
totalCount: Int!
}

type AssetEdge {
cursor: Cursor!
node: Asset
}

extend type Query{
assets(teamId: ID!, keyword: String, sort: AssetSortType, pagination: Pagination): AssetConnection!
}

extend type Mutation {
createAsset(input: CreateAssetInput!): CreateAssetPayload
removeAsset(input: RemoveAssetInput!): RemoveAssetPayload
}
50 changes: 50 additions & 0 deletions server/gql/cluster.graphql
@@ -0,0 +1,50 @@
type Cluster {
id: ID!
name: String!
propertyId: ID!
property: Property
}

# InputType

input AddClusterInput {
sceneId: ID!
name: String!
}

input UpdateClusterInput {
clusterId: ID!
sceneId: ID!
name: String
propertyId: ID
}

input RemoveClusterInput {
clusterId: ID!
sceneId: ID!
}

# Payload

type AddClusterPayload {
scene: Scene!
cluster: Cluster!
}

type UpdateClusterPayload {
scene: Scene!
cluster: Cluster!
}

type RemoveClusterPayload {
scene: Scene!
clusterId: ID!
}

#extend type Query{ }

extend type Mutation {
addCluster(input: AddClusterInput!): AddClusterPayload
updateCluster(input: UpdateClusterInput!): UpdateClusterPayload
removeCluster(input: RemoveClusterInput!): RemoveClusterPayload
}

0 comments on commit ee07100

Please sign in to comment.