Skip to content

Commit

Permalink
GH-54: Create a new GraphQL schema
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyhchen committed Aug 5, 2021
1 parent 79e90d5 commit 7f5c54b
Show file tree
Hide file tree
Showing 25 changed files with 729 additions and 31 deletions.
10 changes: 10 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.allBatch.req.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version" : "2017-02-28",
"operation" : "Scan"
#if( ${context.arguments.count} )
,"limit": $util.toJson($context.arguments.count)
#end
#if( ${context.arguments.nextToken} )
,"nextToken": $util.toJson($context.arguments.nextToken)
#end
}
6 changes: 6 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.allBatch.res.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"batches": $utils.toJson($context.result.items)
#if( ${context.result.nextToken} )
,"nextToken": $util.toJson($context.result.nextToken)
#end
}
10 changes: 10 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.allHistory.req.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version" : "2017-02-28",
"operation" : "Scan"
#if( ${context.arguments.count} )
,"limit": $util.toJson($context.arguments.count)
#end
#if( ${context.arguments.nextToken} )
,"nextToken": $util.toJson($context.arguments.nextToken)
#end
}
6 changes: 6 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.allHistory.res.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"histories": $utils.toJson($context.result.items)
#if( ${context.result.nextToken} )
,"nextToken": $util.toJson($context.result.nextToken)
#end
}
6 changes: 6 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.allItems.req.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"items": $utils.toJson($context.result.items)
#if( ${context.result.nextToken} )
,"nextToken": $util.toJson($context.result.nextToken)
#end
}
10 changes: 10 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.allItems.res.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version" : "2017-02-28",
"operation" : "Scan"
#if( ${context.arguments.count} )
,"limit": $util.toJson($context.arguments.count)
#end
#if( ${context.arguments.nextToken} )
,"nextToken": $util.toJson($context.arguments.nextToken)
#end
}
10 changes: 10 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.allMain.req.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version" : "2017-02-28",
"operation" : "Scan"
#if( ${context.arguments.count} )
,"limit": $util.toJson($context.arguments.count)
#end
#if( ${context.arguments.nextToken} )
,"nextToken": $util.toJson($context.arguments.nextToken)
#end
}
6 changes: 6 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.allMain.res.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"mains": $utils.toJson($context.result.items)
#if( ${context.result.nextToken} )
,"nextToken": $util.toJson($context.result.nextToken)
#end
}
10 changes: 10 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.allTags.req.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version" : "2017-02-28",
"operation" : "Scan"
#if( ${context.arguments.count} )
,"limit": $util.toJson($context.arguments.count)
#end
#if( ${context.arguments.nextToken} )
,"nextToken": $util.toJson($context.arguments.nextToken)
#end
}
6 changes: 6 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.allTags.res.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tags": $utils.toJson($context.result.items)
#if( ${context.result.nextToken} )
,"nextToken": $util.toJson($context.result.nextToken)
#end
}
7 changes: 7 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.getBatch.req.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version" : "2017-02-28",
"operation" : "GetItem",
"key" : {
"id" : $util.dynamodb.toDynamoDBJson($ctx.args.id)
}
}
1 change: 1 addition & 0 deletions amplify/backend/api/rms/resolvers/Query.getBatch.res.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$utils.toJson($context.result)
7 changes: 7 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.getHistory.req.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version" : "2017-02-28",
"operation" : "GetItem",
"key" : {
"id" : $util.dynamodb.toDynamoDBJson($ctx.args.id)
}
}
1 change: 1 addition & 0 deletions amplify/backend/api/rms/resolvers/Query.getHistory.res.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$utils.toJson($context.result)
7 changes: 7 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.getItems.req.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version" : "2017-02-28",
"operation" : "GetItem",
"key" : {
"id" : $util.dynamodb.toDynamoDBJson($ctx.args.id)
}
}
1 change: 1 addition & 0 deletions amplify/backend/api/rms/resolvers/Query.getItems.res.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$utils.toJson($context.result)
7 changes: 7 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.getMain.req.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version" : "2017-02-28",
"operation" : "GetItem",
"key" : {
"id" : $util.dynamodb.toDynamoDBJson($ctx.args.id)
}
}
1 change: 1 addition & 0 deletions amplify/backend/api/rms/resolvers/Query.getMain.res.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$utils.toJson($context.result)
7 changes: 7 additions & 0 deletions amplify/backend/api/rms/resolvers/Query.getTags.req.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version" : "2017-02-28",
"operation" : "GetItem",
"key" : {
"id" : $util.dynamodb.toDynamoDBJson($ctx.args.id)
}
}
1 change: 1 addition & 0 deletions amplify/backend/api/rms/resolvers/Query.getTags.res.vtl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$utils.toJson($context.result)
79 changes: 75 additions & 4 deletions amplify/backend/api/rms/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,76 @@
type Todo @model {
id: ID!
name: String!
description: String
type Query {
allMain(count: Int, nextToken: String): PaginatedMains!
allItems(count: Int, nextToken: String): PaginatedItems!
allBatch(count: Int, nextToken: String): PaginatedBatches!
allTags(count: Int, nextToken: String): PaginatedTags!
allHistory(count: Int, nextToken: String): PaginatedHistories!
}

type Main @model @auth(rules: [{allow: public, operations: [read]}]) {
name: ID!
displayName: String!
description: String
tags: [String!]
items: [String!]
}

type PaginatedMains {
mains: [Main!]!
nextToken: String
}

type Items @model @auth(rules: [{allow: public, operations: [read]}]) {
id: ID!
name: String!
owner: String!
borrower: String!
batch: [String!]
history: [String!]
schedule: [String!]
notes: String
}

type PaginatedItems {
items: [Items!]!
nextToken: String
}

type Batch @model @auth(rules: [{allow: public, operations: [read]}]) {
key: ID!
val: [String!]
}

type PaginatedBatches {
batches: [Batch!]!
nextToken: String
}

type Tags @model @auth(rules: [{allow: public, operations: [read]}]) {
key: ID!
val: [String!]
}

type PaginatedTags {
tags: [Tags!]!
nextToken: String
}

type History @model @auth(rules: [{allow: public, operations: [read]}]) {
key: ID!
name: String!
id: String!
borrower: String!
action: Action!
notes: String
timestamp: Int!
}

type PaginatedHistories {
histories: [History!]!
nextToken: String
}

enum Action {
borrow
return
}
Loading

0 comments on commit 7f5c54b

Please sign in to comment.