Skip to content

Instantly share code, notes, and snippets.

View dclarke-modus's full-sized avatar

dclarke-modus

View GitHub Profile
class ScopeModal extends React.Component {
constructor(props) {
super(props);
this._onChange = this._onChange.bind(this);
this.handleClose = this.handleClose.bind(this);
this.state = { show: false, scope: null, form: {name : null, description: null, enabled : null, id: null, grants : []} };
}
componentWillMount () {
let Schema = () => {
let {nodeInterface, nodeField} = nodeDefinitions(
(globalId) => {
var {type, id} = fromGlobalId(globalId);
if (type === 'Grant') {
return GrantModel.findById(id);
} else if (type === 'Scope') {
return ScopeModel.findById(id);
} else {
import React from 'react';
import {createFragmentContainer, graphql} from 'react-relay';
import scopeAction from './actions/scopeModalAction';
class Scope extends React.Component {
constructor(props, context) {
super(props, context);
this.editScope = this.editScope.bind(this);
}
import {GraphQLSchema, GraphQLObjectType, GraphQLInt, GraphQLString, GraphQLList, GraphQLBoolean} from 'graphql';
import {connectionArgs, connectionDefinitions, connectionFromArray, connectionFromPromisedArray, fromGlobalId, globalIdField, mutationWithClientMutationId, nodeDefinitions} from 'graphql-relay';
import {ClientModel, ScopeModel, TokenModel, GrantModel} from '../schemas';
let Schema = () => {
let {nodeInterface, nodeField} = nodeDefinitions(
(globalId) => {
var {type, id} = fromGlobalId(globalId);
Employee Table Department
id, name id, name, employee_id
1, Dean Clarke 1, Accounts, 1
2, Harshid 2, Legal, 2
3, Puja
Table Students Table Class
id, name, class_id id, name
1, Dean, 1 1, Math
3, Shahib, 2 2, English
4, Chris, null 3, Science
Table Students
id, name
1, Dean
2, Dean
3, Shahib
table student table department
id, name, age id, name, student_id
1, dean, 10 1, Arts, 1
2, tah , 10
id, name, age
1, dean, 10
2, dean, 10
1, blah, 9
await connectionManager.connect();
let client = await connectionManager.getClient().findOne({'client' : 'local'});
let grant = await connectionManager.getGrant().findOne({'name' : 'Client_Credential'});
let service = await connectionManager.getService().findOne({'description' : 'Service 1'});
let ScopeModel = connectionManager.getScope();
let scope = new ScopeModel({client_id : client._id, grant_id : grant._id, service_id : service._id});
await scope.save();
console.log(await connectionManager.getClient().findOne({'client' : 'local'}).populate('scopes'));