On Tea Way is a tea subscription service that customizes tea packaging with images from the user. This is the backend app that stores user, tea, subscription information and serves information to the (eventual) front endapp.
I've created this API as a submission to Shopify's BackEnd Engineering Internship.
Table of Contents
- Upload photo for tea packaging
- Search Unsplash for photo and add as photo for packaging
- See all photos that belong to given user
- Delete uploaded photos
- Update uploaded photos
- Get Subscription information
- Create Package Photos
- Testing: factory-bot_rails, faker, pry, shoulda-matchers, simplecov, webmock, vcr
- Dev/Production: aws-sdk-s3, apollo_upload_server, image_processing
- API: faraday, graphql
To get a local copy up and running follow these simple example steps.
» Ruby version 2.7.2
» Rails version 5.2.6
- Clone the repo
git clone https://github.com/suzkiee/on_tea_way.git
- Install gems
bundle install
- Run
rails db:{create,migrate,seed}
- To run testing suite
bundle exec rspec
To test enpoints
-
Download Altair GraphiQL Client*
-
Copy + paste GraphQL codeblock from below into left hand side of client
- We are using Altair because it allows you to attach files to your mutation queries. Graphiql does not currently have that feature.
userPhotos: returns all users in database
query {
userPhotos(id: 1){
id
photos {
id
userUploaded
unsplashId
userPhotoUrl
}
}
}
searchPhotos: returns photos that match query from Unsplash API
query {
searchPhotos(query: "puppy"){
url
unsplashId
userUploaded
}
}
uploadUserPhoto: uploads User Photo
mutation($file: Upload!) {
uploadUserPhoto(input: {
upload: $file
userId: 1
}) {
userId
unsplashId
userUploaded
}
}
uploadUnsplashPhoto: uploads photo using Unsplash url and id
mutation {
uploadUnsplashPhoto(input: {
url: "https://images.unsplash.com/photo-1593134257782-e89567b7718a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwyNTEwMzZ8MHwxfHNlYXJjaHwxfHxwdXBweXxlbnwwfHx8fDE2MzIxNDM2MzY&ixlib=rb-1.2.1&q=80&w=1080"
userId: 1
}) {
userId
unsplashId
userUploaded
url
}
}
Suzie Kim - Linkedin - GitHub - Email
Project Link: Tea Time
» README Template Source
» Shopify BackEnd Developer Intership Posting