#!/bin/bash

operation=$1
if [ $operation != 'push' ] && [ $operation != 'check' ]
then
    echo "invalid operation '${operation}'"
    exit -1
fi

# concat all schema files into one
# excluding files not using only alpha chars. like `_federated`.
cat ./src/schema/[A-Za-z]*.graphql > federated.graphql

# push or check schema
yarn apollo service:${operation} --graph graphql-theorchard --serviceName graphql-solfege --localSchemaFile federated.graphql $2 $3