-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
59591ad
commit c3fc897
Showing
69 changed files
with
3,691 additions
and
17 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,4 @@ | ||
--- | ||
exclude_paths: | ||
- "graphql/mutation/*/appsync.js" | ||
- "graphql/query/*/appsync.js" |
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 |
---|---|---|
|
@@ -32,6 +32,7 @@ override.tf.json | |
# Ignore CLI configuration files | ||
.terraformrc | ||
terraform.rc | ||
|
||
.validate | ||
.apply | ||
plan.tfplan |
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
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
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,20 @@ | ||
graphql/%/appsync.js: graphql/node_modules graphql/%/appsync.ts | ||
cd graphql && \ | ||
esbuild $*/*.ts \ | ||
--bundle \ | ||
--external:"@aws-appsync/utils" \ | ||
--format=esm \ | ||
--platform=node \ | ||
--target=esnext \ | ||
--sourcemap=inline \ | ||
--sources-content=false \ | ||
--outdir=$* | ||
|
||
graphql/node_modules: graphql/package.json | ||
cd graphql && npm install | ||
|
||
GRAPHQL := $(patsubst %.ts,%.js,$(wildcard graphql/*/*/appsync.ts)) | ||
|
||
.PHONY: graphql | ||
graphql: $(GRAPHQL) | ||
echo $(GRAPHQL) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,48 @@ | ||
import { util, Context, DynamoDBPutItemRequest, AppSyncIdentityCognito, PutItemInputAttributeMap } from '@aws-appsync/utils'; | ||
Check failure on line 1 in graphql/mutation/createGame/appsync.ts Codacy Production / Codacy Static Code Analysisgraphql/mutation/createGame/appsync.ts#L1
|
||
|
||
/** | ||
* A CreateGameInput creates a Game. | ||
* They are stored in DynamoDB with a PK of `GAME#<id>` and an SK of `GAME`. | ||
* The ID is a UUID | ||
* The fireflyUserId is the Cognito ID of the user | ||
*/ | ||
|
||
interface CreateGameInput { | ||
name: string; | ||
description?: string; | ||
} | ||
|
||
export function request(context: Context<{ input: CreateGameInput }>): DynamoDBPutItemRequest { | ||
if (!context.identity) { | ||
util.error('Unauthorized: Identity information is missing.' as string); | ||
} | ||
|
||
const identity = context.identity as AppSyncIdentityCognito; | ||
Check failure on line 20 in graphql/mutation/createGame/appsync.ts Codacy Production / Codacy Static Code Analysisgraphql/mutation/createGame/appsync.ts#L20
|
||
if (!identity.sub) { | ||
util.error('Unauthorized: User ID is missing.' as string); | ||
} | ||
|
||
const input = context.arguments.input; | ||
const id = util.autoId(); | ||
const timestamp = util.time.nowISO8601(); | ||
return { | ||
operation: 'PutItem', | ||
key: util.dynamodb.toMapValues({ PK: "GAME#"+id, SK: 'GAME' }), | ||
attributeValues: util.dynamodb.toMapValues({ | ||
name: input.name, | ||
description: input.description, | ||
id: id, | ||
fireflyUserId: identity.sub, | ||
createdAt: timestamp, | ||
updatedAt: timestamp | ||
}) as PutItemInputAttributeMap | ||
}; | ||
} | ||
|
||
export function response(context: Context): unknown { | ||
if (context.error) { | ||
util.appendError(context.error.message, context.error.type, context.result); | ||
return; | ||
} | ||
return context.result; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.