xtina-starr / convection

Rails application for consignments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Convection

Convection is the application that powers our consignments workflow, enabling users to submit works to consign through Artsy partners. For now, it encapsulates logic from rothko-api and rothko-web-public.

Meta CircleCI

Contributing Pull Requests

Convection accepts PRs from branches on the main artsy/convection repo. PRs from forks will not be built in the CI environment and cannot be merged directly.

Setup

  • Fork the project to your GitHub account

  • Clone your fork:

    $ git clone git@github.com:your-github-username/convection.git
    
  • Read and run setup script:

    $ cat bin/setup
    $ bin/setup
    
  • Populate environment variables

    .env.example contains the keys you'll need to add to your local .env file. Consider using the copy_env utility to populate the values directly from hokusai:

    $ copy_env hokusai
    

Tests

Once setup, you can run the tests like this:

$ bundle exec rake spec
# or
$ hokusai test

Note: the default rake task is setup to run tests and RuboCop.

Did You Change the GraphQL Schema?

If you have changed Convection GraphQL schema, make sure to run:

$ rake graphql:schema:idl

See docs/schema-stitching.md for more.

Starting Server

$ foreman start
# or
$ hokusai dev start

See the Procfile and Hokusai configuration to understand other services launched.

GraphQL

When running in development, this API has a GraphiQL instance at http://localhost:5000/graphiql

See schema stitching for more info about propagating changes through the Artsy application ecosystem.

Creating a Submission

Generate a valid JWT token in a Convection console:

payload = { aud: 'app', sub: '<valid user id>', roles: 'user,admin' }
token = JWT.encode payload, Convection.config.jwt_secret, 'HS256'

Via API:

Use curl to generate a submission with an artist_id (emails will appear in mailtrap).

curl -H 'Authorization: Bearer <token>' -H 'Accept: application/json' -d 'artist_id=5059d82a1fc9fa00020008ff' https://convection-staging.artsy.net/api/submissions

Via Metaphysics:

Be sure a valid X-Access-Token is set (can be jwt from above) and submit the following GraphQL mutation:

{
  "input": {
    "artistID": "5059d82a1fc9fa00020008ff"
  }
}
mutation createConsignmentSubmissionMutation(
  $input: CreateSubmissionMutationInput!
) {
  createConsignmentSubmission(input: $input) {
    consignmentSubmission {
      id
      artist {
        id
      }
    }
  }
}

About

Rails application for consignments

License:MIT License


Languages

Language:Ruby 61.0%Language:JavaScript 17.5%Language:HTML 15.4%Language:CSS 4.1%Language:CoffeeScript 1.7%Language:Shell 0.2%Language:Dockerfile 0.1%