Skip to content

Rails application for consignments

License

Notifications You must be signed in to change notification settings

artsy/convection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Artsy Developers

  • Read and run setup script:

    $ cat bin/setup
    $ bin/setup
    
  • Shared Configuration for Local Development

Convection uses shared configuration to distribute common and sensitive configuration values. The setup script will download .env.shared and also initialize .env (from .env.example). The .env file is for custom configuration and any overrides.

If a new sensitive (or common) environment variable needs to be added for development, remember to also update the shared configuraton in S3. Find update instructions here. This is only required when expanding shared development environment configuration.

Non-Artsy Developers

  • Fork the project to your GitHub account

  • Clone your fork:

$ git clone git@github.com:your-github-username/convection.git
  • Populate environment variables

See initializer for environment variables that you'll need to add to your local .env file.

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 Standard Ruby.

Did You Change the GraphQL Schema?

If you have changed Convection GraphQL schema, make sure to do the following:

Step 1: In convection, run:

$ rake graphql:schema:idl

Step 2: Copy the generated _schema.graphql file to the convection.graphql file in metaphysics.

This file is used for stitching. See docs/schema-stitching.md for additional step you might need to do.

Starting Server

$ foreman start # to run web and worker processes
# or
$ foreman start web # to run web process only
# or
$ hokusai dev start # to run via local docker

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

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