This file contains 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
# action | |
exports.test = | |
name: 'test' | |
description: 'test' | |
routes: | |
get: [ | |
{ path: "/routes" } | |
{ path: "/routes/:test" } | |
] |
This file contains 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
exports.getRoles = | |
name: 'getRoles' | |
description: 'all roles' | |
run: (api, data, next) -> | |
api.roles.getRoles data, (err, resp) -> | |
return next err if err | |
data.response = resp | |
next() |
This file contains 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
exports.User = | |
name: 'user' | |
description: 'defines user routes' | |
post: | |
description: 'creates a user' | |
run: (api, data, next) -> | |
api.users.createUser data.params, (err, resp) -> | |
return next err if err | |
data.response = resp |
This file contains 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
module.factory( | |
"User", | |
['LoopBackResource', 'LoopBackAuth', '$injector', function(Resource, LoopBackAuth, $injector) { | |
var R = Resource( | |
urlBase + "/Users/:id", | |
{ 'id': '@id' }, | |
{ | |
"create": { | |
url: urlBase + "/Users", |
This file contains 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
module | |
.factory('LoopBackAuth', function() { | |
var props = ['accessTokenId', 'currentUserId', 'currentUserData', 'rememberMe']; | |
var propsPrefix = '$LoopBack$'; | |
function LoopBackAuth() { | |
var self = this; | |
this.rememberMe = undefined; | |
this.currentUserData = null; | |
props.forEach(function(name) { |
This file contains 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
var accessTokenModelName, adminUser, authModelName; | |
authModelName = 'user'; | |
accessTokenModelName = 'accessToken'; | |
adminUser = { | |
email: 'new-admin@example.com', | |
username: 'newAdmin', | |
password: 'password', |
This file contains 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
do -> | |
angular.module 'material.core.colors', ['material.core.theming'] | |
.provider '$mdColors', ($mdColorPalette) -> | |
style = angular.element '<style></style>' | |
document.head.appendChild style[0] | |
stylesheet = style[0].sheet |
This file contains 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
methods = [ | |
'count' | |
'create' | |
'createChangeStream' | |
'deleteAll' | |
'deleteById' | |
'destroyAll' | |
'destroyById' | |
'exists' |
This file contains 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
let debug = require('debug')('loopback:hooks:wrap'); | |
import async from 'async'; | |
import { createPromiseCallback } from 'loopback-datasource-juggler/lib/utils'; | |
import { inspect } from 'util'; | |
export default function(server) { | |
let callback = function(args) { |
This file contains 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
function includeOneToOne(callback) { | |
var targetIds = []; | |
var objTargetIdMap = {}; | |
var lookupKey = (relation.type === 'belongsTo') ? relation.keyFrom : relation.keyTo; | |
for (var i = 0; i < objs.length; i++) { | |
var obj = objs[i]; | |
if (relation.type === 'belongsTo') { | |
if (obj[lookupKey] === null || |
OlderNewer