-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api-graphql): custom subscriptions #13154
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,9 +83,9 @@ const schema = a.schema({ | |
viewCount: a.integer(), | ||
status: a.enum(['draft', 'pending', 'published']), | ||
}) | ||
.secondaryIndexes([ | ||
a.index('title'), | ||
a.index('description').sortKeys(['viewCount']), | ||
.secondaryIndexes(index => [ | ||
index('title'), | ||
index('description').sortKeys(['viewCount']), | ||
Comment on lines
+86
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines up the DX with aws-amplify/amplify-data#132 |
||
]), | ||
Product: a | ||
.model({ | ||
|
@@ -120,7 +120,7 @@ const schema = a.schema({ | |
argumentContent: a.string().required(), | ||
}) | ||
.returns(a.ref('EchoResult')) | ||
.function('echoFunction') | ||
.handler(a.handler.function('echoFunction')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Migrating these to the new DX as well. We still have tests in |
||
.authorization([a.allow.public()]), | ||
|
||
// custom query returning a primitive type | ||
|
@@ -130,23 +130,23 @@ const schema = a.schema({ | |
inputString: a.string().required(), | ||
}) | ||
.returns(a.string()) | ||
.function('echoFunction') | ||
.handler(a.handler.function('echoFunction')) | ||
.authorization([a.allow.public()]), | ||
echoNestedCustomTypes: a | ||
.query() | ||
.arguments({ | ||
input: a.string().required(), | ||
}) | ||
.returns(a.ref('ProductTrackingMeta')) | ||
.function('echoFunction') | ||
.handler(a.handler.function('echoFunction')) | ||
.authorization([a.allow.public()]), | ||
echoModelHasNestedTypes: a | ||
.query() | ||
.arguments({ | ||
input: a.string().required(), | ||
}) | ||
.returns(a.ref('Product')) | ||
.function('echoFunction') | ||
.handler(a.handler.function('echoFunction')) | ||
.authorization([a.allow.public()]), | ||
// custom mutation returning a non-model type | ||
PostLikeResult: a.customType({ | ||
|
@@ -158,7 +158,7 @@ const schema = a.schema({ | |
postId: a.id().required(), | ||
}) | ||
.returns(a.ref('PostLikeResult')) | ||
.function('echoFunction') | ||
.handler(a.handler.function('echoFunction')) | ||
.authorization([a.allow.private()]), | ||
|
||
// custom mutation returning a model type | ||
|
@@ -182,9 +182,21 @@ const schema = a.schema({ | |
postId: a.id().required(), | ||
}) | ||
.returns(a.ref('Post')) | ||
.function('echoFunction') | ||
.handler(a.handler.function('echoFunction')) | ||
.authorization([a.allow.private()]), | ||
|
||
onPostLiked: a | ||
.subscription() | ||
.for(a.ref('likePostReturnPost')) | ||
.returns(a.ref('Post')) | ||
.handler(a.handler.custom({ entry: './jsResolver_base.js' })), | ||
|
||
onPostUpdated: a | ||
.subscription() | ||
.for(a.ref('Post').mutations(['update'])) | ||
.arguments({ postId: a.string() }) | ||
.returns(a.ref('Post')) | ||
.handler(a.handler.custom({ entry: './jsResolver_base.js' })), | ||
//#endregion | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workspace settings defined in this file override local VS Code settings, so this effectively forces everyone to use
tabSize: 4
. Removing it so contributors can use their tab size of choice.