Add the following to your .bashrc|.bash_profile|.zshrc|.fishrc
(or whatever you use).
function set_rhoas_env {
local env=$1
case $env in
"stage")
RHOASCONFIG="$HOME/.config/rhoas/config.stage.json"
;;
Add the following to your .bashrc|.bash_profile|.zshrc|.fishrc
(or whatever you use).
function set_rhoas_env {
local env=$1
case $env in
"stage")
RHOASCONFIG="$HOME/.config/rhoas/config.stage.json"
;;
import { GraphQLObjectType } from 'graphql'; | |
import { NoDataError } from '@graphback/runtime'; | |
import { getDatabaseArguments } from '@graphback/core'; | |
import { ObjectId } from 'mongodb'; | |
import { MongoDBDataProvider } from './MongoDBDataProvider'; | |
enum GraphbackDirective { | |
UpdatedAt = 'updatedAt' | |
} | |
interface FieldDirectiveTransformer { |
import { GraphbackDataProvider, GraphbackPlugin } from "graphback" | |
import { DocumentNode, GraphQLSchema } from 'graphql' | |
import { IResolvers, PubSubEngine } from 'apollo-server-express' | |
import { PgKnexDBDataProvider } from '@graphback/runtime-knex' | |
import Knex from 'knex' | |
interface DataProviderModelMap { | |
[modelName: string]: GraphbackDataProvider | |
} |
async function createModels(modelsDir: string, schema: GraphQLSchema, defaultDataProvider: GraphbackDataProvider, dbProviderOverrides: { [modelName: string]: GraphbackDataProvider } = {}, pubSub: PubSub): Promise<{ [serviceName: string]: CRUDService }> { | |
const models = require(modelsDir); | |
delete models.modelConfigs; | |
const services = {}; | |
for (const modelName of Object.keys(models)) { | |
const modelType = schema.getType(modelName) as GraphQLObjectType | |
const dbProvider = dbProviderOverrides[modelName] || defaultDataProvider |
async function createModels(modelsDir: string, schema: GraphQLSchema, defaultDataProvider: GraphbackDataProvider, dbProviderOverrides: { [modelName: string]: GraphbackDataProvider } = {}, pubSub: PubSub): Promise<{ [serviceName: string]: CRUDService }> { | |
const models = require(modelsDir); | |
const modelsConfig = { ...models.modelConfigs }; | |
delete models.modelConfigs; | |
const noteConfig = { | |
name: "Note", | |
pubSub: { | |
publishCreate: false, |
import { GraphQLSchema, GraphQLObjectType, GraphQLField, buildSchema, GraphQLScalarType, GraphQLString, printSchema, GraphQLNamedType } from 'graphql'; | |
const schema = buildSchema(` | |
type User { | |
id: ID! | |
name: String | |
} | |
`) | |
const userType = schema.getType('User') as GraphQLObjectType; |
For a flexible relationship mapping system to work, we really only need two fields, along with the relationship type:
@oneToMany | @oneToOne | @manyToOne
field: The field name on the opposite model to map to.
column: The database column name on the opposite model to map to.
The field
and column
can be optional depending on what other metadata is provided. See Cases below for some examples.
{"lastUpload":"2020-01-15T14:46:00.870Z","extensionVersion":"v3.4.3"} |
function isSuccess(success) { | |
return new Promise(function (resolve, reject) { | |
if (success === true) { | |
resolve('Success'); | |
} else { | |
reject('Error'); | |
} | |
}); | |
} |