Skip to content
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

Support custom mutations #2777

Open
1 task done
gpavlov2016 opened this issue Apr 17, 2024 · 1 comment
Open
1 task done

Support custom mutations #2777

gpavlov2016 opened this issue Apr 17, 2024 · 1 comment
Labels
datastore DataStore category/plugins feature-request Request a new feature

Comments

@gpavlov2016
Copy link

Before opening, please confirm:

Language and Async Model

Java, Kotlin, Kotlin - Coroutines

Amplify Categories

GraphQL API

Gradle script dependencies

// Put output below this line
aws-api = { module = "com.amplifyframework:aws-api", version.ref = "awsApi" }
core = { module = "com.amplifyframework:core", version.ref = "awsApi" }
awsApi = "2.14.11"

Environment information

# Put output below this line
------------------------------------------------------------
Gradle 8.4
------------------------------------------------------------

Build time:   2023-10-04 20:52:13 UTC
Revision:     e9251e572c9bd1d01e503a0dfdf43aedaeecdc3f

Kotlin:       1.9.10
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          11.0.22 (Oracle Corporation 11.0.22+9-LTS-219)
OS:           Windows 11 10.0 amd64


Please include any relevant guides or documentation you're referencing

No response

Describe the feature request

Add the ability to run custom mutation either by autogenerating from schema or building using a graphQL string.
For example, for the mutation defined in JS as follows:

Impression: a.model({
    videoId: a.string().required(),
    impressions: a.integer().default(0)
  }).identifier(['videoId'])
  .authorization([
    a.allow.public().to(['read'])
  ]),

  increaseImpression: a
    .mutation()
    // arguments that this query accepts
    .arguments({
      videoId: a.string()
    })
    // return type of the query
    .returns(a.ref('Impression'))
    // only allow signed-in users to call this API
    .authorization([a.allow.public()])
    .handler(a.handler.custom({
      dataSource: a.ref('Impression'),
      entry: './increment-impression.js'
    }))

GraphQL Mutation:

mutation MyMutation {
  increaseImpression(videoId: "1") {
    impressions
  }
}

Initialization steps (if applicable)

No response

Code Snippet

// Put your code below this line.

amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

No response

@github-actions github-actions bot added the pending-triage Issue is pending triage label Apr 17, 2024
@joon-won
Copy link
Contributor

joon-won commented Apr 17, 2024

Hi @gpavlov2016 , thank you for your feature request. We will take a look into the request at our earliest convenience to determine if this is something we want to take on.

@joon-won joon-won added feature-request Request a new feature datastore DataStore category/plugins labels Apr 17, 2024
@github-actions github-actions bot removed the pending-triage Issue is pending triage label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore DataStore category/plugins feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

2 participants