Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Dabit committed Jun 28, 2019
1 parent b59bbb0 commit 8514bf7
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 110 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -11,9 +11,9 @@ How do I upload images using GraphQL with AWS AppSync?
There are a few parts to this solution:

* You must first upload the image to a storage solution (Amazon S3)
* After you have finished uploading the image, you will then be given a `key` to reference this image. You then need to store this reference in a database using a GraphQL mutation.
* When you want to a public image (public bucket), you need to:
* Query the image reference from your database using GraphQL
* After you have finished uploading the image, you will need to store a reference to this image in a database using a GraphQL mutation.
* When you want to view a public image (public bucket), you need to:
* Query the image URL from your database using GraphQL
* When you want to view a private image (non-public bucket), you need to do two things:
* First, query the image reference from your database using GraphQL
* Get a signed URL for the image from S3
Expand Down
1 change: 0 additions & 1 deletion amplify/backend/api/gqlimages/schema.graphql
Expand Up @@ -10,7 +10,6 @@ type User @model {
id: ID!
username: String!
avatar: S3Object
email: String
}

type S3Object {
Expand Down
9 changes: 4 additions & 5 deletions src/Users.js
@@ -1,17 +1,16 @@
import React, { useState, useReducer, useEffect } from 'react'
import './App.css'
import { withAuthenticator } from 'aws-amplify-react'
import { Storage, Auth, API, graphqlOperation } from 'aws-amplify'
import { Storage, API, graphqlOperation } from 'aws-amplify'
import uuid from 'uuid/v4'
import { createUser as CreateUser } from './graphql/mutations'
import { listUsers } from './graphql/queries'
import { onCreateUser } from './graphql/subscriptions'
import ampConfig from './aws-exports'
import config from './aws-exports'

const {
aws_user_files_s3_bucket_region: region,
aws_user_files_s3_bucket: bucket
} = ampConfig
} = config

const initialState = {
users: []
Expand Down Expand Up @@ -97,7 +96,7 @@ function App() {
}, [])

return (
<div className="App" style={styles.container}>
<div style={styles.container}>
<input
label="File to upload"
type="file"
Expand Down
3 changes: 0 additions & 3 deletions src/graphql/mutations.js
Expand Up @@ -40,7 +40,6 @@ export const createUser = `mutation CreateUser($input: CreateUserInput!) {
region
key
}
email
}
}
`;
Expand All @@ -53,7 +52,6 @@ export const updateUser = `mutation UpdateUser($input: UpdateUserInput!) {
region
key
}
email
}
}
`;
Expand All @@ -66,7 +64,6 @@ export const deleteUser = `mutation DeleteUser($input: DeleteUserInput!) {
region
key
}
email
}
}
`;
2 changes: 0 additions & 2 deletions src/graphql/queries.js
Expand Up @@ -37,7 +37,6 @@ export const getUser = `query GetUser($id: ID!) {
region
key
}
email
}
}
`;
Expand All @@ -55,7 +54,6 @@ export const listUsers = `query ListUsers(
region
key
}
email
}
nextToken
}
Expand Down
148 changes: 55 additions & 93 deletions src/graphql/schema.json
Expand Up @@ -711,17 +711,6 @@
},
"isDeprecated" : false,
"deprecationReason" : null
}, {
"name" : "email",
"description" : null,
"args" : [ ],
"type" : {
"kind" : "SCALAR",
"name" : "String",
"ofType" : null
},
"isDeprecated" : false,
"deprecationReason" : null
} ],
"inputFields" : null,
"interfaces" : [ ],
Expand Down Expand Up @@ -839,15 +828,6 @@
"ofType" : null
},
"defaultValue" : null
}, {
"name" : "email",
"description" : null,
"type" : {
"kind" : "INPUT_OBJECT",
"name" : "ModelStringFilterInput",
"ofType" : null
},
"defaultValue" : null
}, {
"name" : "and",
"description" : null,
Expand Down Expand Up @@ -1210,15 +1190,6 @@
"ofType" : null
},
"defaultValue" : null
}, {
"name" : "email",
"description" : null,
"type" : {
"kind" : "SCALAR",
"name" : "String",
"ofType" : null
},
"defaultValue" : null
} ],
"interfaces" : null,
"enumValues" : null,
Expand Down Expand Up @@ -1307,15 +1278,6 @@
"ofType" : null
},
"defaultValue" : null
}, {
"name" : "email",
"description" : null,
"type" : {
"kind" : "SCALAR",
"name" : "String",
"ofType" : null
},
"defaultValue" : null
} ],
"interfaces" : null,
"enumValues" : null,
Expand Down Expand Up @@ -1413,6 +1375,61 @@
"interfaces" : [ ],
"enumValues" : null,
"possibleTypes" : null
}, {
"kind" : "ENUM",
"name" : "ModelSortDirection",
"description" : null,
"fields" : null,
"inputFields" : null,
"interfaces" : null,
"enumValues" : [ {
"name" : "ASC",
"description" : null,
"isDeprecated" : false,
"deprecationReason" : null
}, {
"name" : "DESC",
"description" : null,
"isDeprecated" : false,
"deprecationReason" : null
} ],
"possibleTypes" : null
}, {
"kind" : "INPUT_OBJECT",
"name" : "ModelBooleanFilterInput",
"description" : null,
"fields" : null,
"inputFields" : [ {
"name" : "ne",
"description" : null,
"type" : {
"kind" : "SCALAR",
"name" : "Boolean",
"ofType" : null
},
"defaultValue" : null
}, {
"name" : "eq",
"description" : null,
"type" : {
"kind" : "SCALAR",
"name" : "Boolean",
"ofType" : null
},
"defaultValue" : null
} ],
"interfaces" : null,
"enumValues" : null,
"possibleTypes" : null
}, {
"kind" : "SCALAR",
"name" : "Boolean",
"description" : "Built-in Boolean",
"fields" : null,
"inputFields" : null,
"interfaces" : null,
"enumValues" : null,
"possibleTypes" : null
}, {
"kind" : "INPUT_OBJECT",
"name" : "ModelFloatFilterInput",
Expand Down Expand Up @@ -1516,61 +1533,6 @@
"interfaces" : null,
"enumValues" : null,
"possibleTypes" : null
}, {
"kind" : "ENUM",
"name" : "ModelSortDirection",
"description" : null,
"fields" : null,
"inputFields" : null,
"interfaces" : null,
"enumValues" : [ {
"name" : "ASC",
"description" : null,
"isDeprecated" : false,
"deprecationReason" : null
}, {
"name" : "DESC",
"description" : null,
"isDeprecated" : false,
"deprecationReason" : null
} ],
"possibleTypes" : null
}, {
"kind" : "INPUT_OBJECT",
"name" : "ModelBooleanFilterInput",
"description" : null,
"fields" : null,
"inputFields" : [ {
"name" : "ne",
"description" : null,
"type" : {
"kind" : "SCALAR",
"name" : "Boolean",
"ofType" : null
},
"defaultValue" : null
}, {
"name" : "eq",
"description" : null,
"type" : {
"kind" : "SCALAR",
"name" : "Boolean",
"ofType" : null
},
"defaultValue" : null
} ],
"interfaces" : null,
"enumValues" : null,
"possibleTypes" : null
}, {
"kind" : "SCALAR",
"name" : "Boolean",
"description" : "Built-in Boolean",
"fields" : null,
"inputFields" : null,
"interfaces" : null,
"enumValues" : null,
"possibleTypes" : null
}, {
"kind" : "OBJECT",
"name" : "__Schema",
Expand Down
3 changes: 0 additions & 3 deletions src/graphql/subscriptions.js
Expand Up @@ -40,7 +40,6 @@ export const onCreateUser = `subscription OnCreateUser {
region
key
}
email
}
}
`;
Expand All @@ -53,7 +52,6 @@ export const onUpdateUser = `subscription OnUpdateUser {
region
key
}
email
}
}
`;
Expand All @@ -66,7 +64,6 @@ export const onDeleteUser = `subscription OnDeleteUser {
region
key
}
email
}
}
`;

0 comments on commit 8514bf7

Please sign in to comment.