-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
3,986 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
export type Maybe<T> = T | null; | ||
export type InputMaybe<T> = Maybe<T>; | ||
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] }; | ||
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> }; | ||
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> }; | ||
/** All built-in and custom scalars, mapped to their actual values */ | ||
export type Scalars = { | ||
ID: string; | ||
String: string; | ||
Boolean: boolean; | ||
Int: number; | ||
Float: number; | ||
AWSDate: string; | ||
AWSDateTime: string; | ||
AWSEmail: string; | ||
AWSIPAddress: string; | ||
AWSJSON: string; | ||
AWSPhone: string; | ||
AWSTime: string; | ||
AWSTimestamp: number; | ||
AWSURL: string; | ||
}; | ||
|
||
export type Book = { | ||
__typename?: 'Book'; | ||
author: Scalars['String']; | ||
bookId: Scalars['ID']; | ||
createdAt: Scalars['AWSDateTime']; | ||
description?: Maybe<Scalars['String']>; | ||
imageUrl?: Maybe<Scalars['AWSURL']>; | ||
price: Scalars['Float']; | ||
title: Scalars['String']; | ||
updatedAt: Scalars['AWSDateTime']; | ||
}; | ||
|
||
export type BookInput = { | ||
author: Scalars['String']; | ||
description?: InputMaybe<Scalars['String']>; | ||
imageUrl?: InputMaybe<Scalars['AWSURL']>; | ||
price: Scalars['Float']; | ||
title: Scalars['String']; | ||
}; | ||
|
||
export type BooksPage = { | ||
__typename?: 'BooksPage'; | ||
books?: Maybe<Array<Maybe<Book>>>; | ||
nextToken?: Maybe<Scalars['String']>; | ||
}; | ||
|
||
export type Mutation = { | ||
__typename?: 'Mutation'; | ||
createBook: Book; | ||
createOrder: Scalars['Boolean']; | ||
}; | ||
|
||
|
||
export type MutationCreateBookArgs = { | ||
newBook?: InputMaybe<BookInput>; | ||
}; | ||
|
||
|
||
export type MutationCreateOrderArgs = { | ||
newOrder?: InputMaybe<OrderInput>; | ||
}; | ||
|
||
export type OrderInput = { | ||
items?: InputMaybe<Array<InputMaybe<OrderItemInput>>>; | ||
}; | ||
|
||
export type OrderItem = { | ||
__typename?: 'OrderItem'; | ||
book: Book; | ||
orderId: Scalars['ID']; | ||
quantity: Scalars['Int']; | ||
userId: Scalars['ID']; | ||
}; | ||
|
||
export type OrderItemInput = { | ||
bookId: Scalars['ID']; | ||
quantity: Scalars['Int']; | ||
}; | ||
|
||
export type OrderItemsPage = { | ||
__typename?: 'OrderItemsPage'; | ||
OrderItems?: Maybe<Array<Maybe<OrderItem>>>; | ||
nextToken?: Maybe<Scalars['String']>; | ||
}; | ||
|
||
export type Query = { | ||
__typename?: 'Query'; | ||
getBookById: Book; | ||
listBooks: BooksPage; | ||
myOrders: OrderItemsPage; | ||
}; | ||
|
||
|
||
export type QueryGetBookByIdArgs = { | ||
bookId: Scalars['ID']; | ||
}; | ||
|
||
|
||
export type QueryListBooksArgs = { | ||
limit: Scalars['Int']; | ||
nextToken?: InputMaybe<Scalars['String']>; | ||
}; | ||
|
||
|
||
export type QueryMyOrdersArgs = { | ||
limit: Scalars['Int']; | ||
nextToken?: InputMaybe<Scalars['String']>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
scalar AWSDate | ||
scalar AWSTime | ||
scalar AWSDateTime | ||
scalar AWSTimestamp | ||
scalar AWSEmail | ||
scalar AWSJSON | ||
scalar AWSURL | ||
scalar AWSPhone | ||
scalar AWSIPAddress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
overwrite: true | ||
|
||
schema: | ||
- schema.graphql | ||
- appsync.graphql # 👈 add this | ||
|
||
generates: | ||
appsync.d.ts: | ||
plugins: | ||
- typescript | ||
|
||
# and this 👇 | ||
config: | ||
scalars: | ||
AWSJSON: string | ||
AWSDate: string | ||
AWSTime: string | ||
AWSDateTime: string | ||
AWSTimestamp: number | ||
AWSEmail: string | ||
AWSURL: string | ||
AWSPhone: string | ||
AWSIPAddress: string |
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
books-service/mapping-templates/Mutation.createBook.request.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"version" : "2017-02-28", | ||
"operation" : "PutItem", | ||
"key": { | ||
"bookId" : $util.dynamodb.toDynamoDBJson($util.autoId()) | ||
}, | ||
"attributeValues" : { | ||
"Title" : $util.dynamodb.toDynamoDBJson($ctx.args.newBook.title), | ||
"Description": $util.dynamodb.toDynamoDBJson($ctx.args.newBook.description), | ||
"ImageUrl": $util.dynamodb.toDynamoDBJson($ctx.args.newBook.imageUrl), | ||
"Author": $util.dynamodb.toDynamoDBJson($ctx.args.newBook.author), | ||
"Price": $util.dynamodb.toDynamoDBJson($ctx.args.newBook.price), | ||
"CreatedAt": $util.dynamodb.toDynamoDBJson($util.time.nowISO8601()), | ||
"UpdatedAt": $util.dynamodb.toDynamoDBJson($util.time.nowISO8601()) | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
books-service/mapping-templates/Mutation.createBook.response.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$util.toJson($ctx.result) |
7 changes: 7 additions & 0 deletions
7
books-service/mapping-templates/Query.getBookById.request.vtl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"version" : "2017-02-28", | ||
"operation" : "GetItem", | ||
"key" : { | ||
"BookId" : $util.dynamodb.toDynamoDBJson($ctx.args.bookId) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$util.toJson($ctx.result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"version" : "2017-02-28", | ||
"operation" : "Scan", | ||
"limit" : $util.toJson($context.arguments.limit), | ||
"nextToken" : $util.toJson($context.arguments.nextToken) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"books": $util.toJson($context.result.items), | ||
"nextToken": $util.toJson($util.defaultIfNullOrBlank($context.result.nextToken, null)) | ||
} |
Oops, something went wrong.