Skip to content

suzkiee/on_tea_way

Repository files navigation

Frame 1 (1)

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
  1. About The Project
  2. Getting Started
  3. Schema
  4. GraphQL Endpoints
  5. Contact
  6. Acknowledgements

About this Project

Rails Badge CircleCI Badge GraphQL Badge Heroku Badge

Current Features

  • Upload photo for tea packaging
  • Search Unsplash for photo and add as photo for packaging
  • See all photos that belong to given user

Future Features

  • Delete uploaded photos
  • Update uploaded photos
  • Get Subscription information
  • Create Package Photos

Important Gems

  • Testing: factory-bot_rails, faker, pry, shoulda-matchers, simplecov, webmock, vcr
  • Dev/Production: aws-sdk-s3, apollo_upload_server, image_processing
  • API: faraday, graphql

Schema

Screen Shot 2021-09-20 at 8 17 27 PM

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

» Ruby version 2.7.2
» Rails version 5.2.6

Installation

  1. Clone the repo
    git clone https://github.com/suzkiee/on_tea_way.git
  2. Install gems
    bundle install
  3. Run
    rails db:{create,migrate,seed}

Testing

RSpec

  1. To run testing suite
    bundle exec rspec

GraphQL Endpoints

Testing

To test enpoints

  1. Download Altair GraphiQL Client*

  2. Copy + paste GraphQL codeblock from below into left hand side of client

Screen Shot 2021-09-20 at 8 46 14 PM

  • We are using Altair because it allows you to attach files to your mutation queries. Graphiql does not currently have that feature.

Queries

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
    }
  }

Mutations

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 
            }
          }

Contact

Suzie Kim - Linkedin - GitHub - Email

Project Link: Tea Time

Acknowledgements

» README Template Source
» Shopify BackEnd Developer Intership Posting

About

GraphQL backend application for tea subscription service

Topics

Resources

Stars

Watchers

Forks

Languages