-
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.
UI and GraphQL to create and list games (#61)
* Workflow fix * Can display and create game * Codacy happiness * Get DOM tests running under Jest * Codacy happiness
- Loading branch information
1 parent
df93607
commit d139f0a
Showing
23 changed files
with
1,620 additions
and
75 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
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
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
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,36 @@ | ||
import { util, Context, AppSyncIdentityCognito } from "@aws-appsync/utils"; | ||
import type { DynamoDBQueryRequest } from "@aws-appsync/utils/lib/resolver-return-types"; | ||
import type { GameSummary } from "../../../appsync/graphql"; | ||
|
||
export function request(context: Context): DynamoDBQueryRequest { | ||
if (!context.identity) { | ||
util.error("Unauthorized: Identity information is missing." as string); | ||
} | ||
|
||
const identity = context.identity as AppSyncIdentityCognito; | ||
if (!identity.sub) { | ||
util.error("Unauthorized: User ID is missing." as string); | ||
} | ||
|
||
return { | ||
operation: "Query", | ||
index: "GSI1", | ||
query: { | ||
expression: "#gsi1pk = :gsi1pk", | ||
expressionNames: { | ||
"#gsi1pk": "GSI1PK", | ||
}, | ||
expressionValues: { | ||
":gsi1pk": util.dynamodb.toString("USER#" + identity.sub), | ||
}, | ||
}, | ||
}; | ||
} | ||
|
||
export function response(context: Context): GameSummary[] { | ||
if (context.error) { | ||
util.appendError(context.error.message, context.error.type, context.result); | ||
return []; | ||
} | ||
return context.result.items as GameSummary[]; | ||
} |
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
Oops, something went wrong.