This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//App.js | |
var React = require('react'); | |
var CSSModules = require('react-css-modules'); | |
var ReactRouter = require('react-router-dom'); | |
var Router = ReactRouter.BrowserRouter; | |
var Route = ReactRouter.Route; | |
import styles from '../../../../sass/layout/_layout.scss'; | |
var Index = require('../pages/Index'); | |
var SideBar = require('../component/SideBar'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async getClient (clientId, clientSecret, callback) { | |
let client = await this.mongoClient.collection('client').findOne({"client" : clientId, "client_secret" : clientSecret}, {"_id" : 1}); | |
let scopes = await this.mongoClient.collection('scope').find({"client_id" : client._id }).toArray(); | |
console.log(scopes); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async getClient (clientId, clientSecret, callback) { | |
let client = await this.mongoClient.collection('client').findOne({"client" : clientId, "client_secret" : clientSecret}, {"_id" : 1}); | |
let scopes = await this.mongoClient.collection('scope').find({"client_id" : client._id }); | |
console.log(scopes.toArray()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/home/vagrant/api/node_modules/babel-core/lib/transformation/file/index.js:590 | |
throw err; | |
^ | |
SyntaxError: /home/vagrant/api/db/connection.js: Unexpected token (5:11) | |
3 | | |
4 | class ConnectionManager { | |
> 5 | protected mongoClient; | |
| ^ | |
6 | constructor() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*Code to save Client and Scope:* | |
```javascript | |
let scope = new ScopeModel(); | |
scope.client = client._id; | |
scope.markModified('client'); | |
console.log(scope); | |
await scope.save(); | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id, name, age | |
1, dean, 10 | |
2, dean, 10 | |
1, blah, 9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table student table department | |
id, name, age id, name, student_id | |
1, dean, 10 1, Arts, 1 | |
2, tah , 10 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Table Students | |
id, name | |
1, Dean | |
2, Dean | |
3, Shahib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |