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 i = 0; | |
module.exports = ++i; |
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
it('should be able to run normal queries inside transaction blocks', function() { | |
return knex('accounts') | |
.returning('id') | |
.insert({ | |
first_name: 'Transacting', | |
last_name: 'User', | |
email:'transaction-test3@example.com', | |
logins: 1, | |
about: 'Lorem ipsum Dolore labore incididunt enim.', |
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 ModelBase = Bookshelf.Model.extend(); | |
var CollectionBase = Bookshelf.Collection.extend({ | |
toJSON: function () { | |
var json = Bookshelf.Collection.toJSON.apply(this, arguments); | |
json.object = this.model.prototype.object; | |
return json; | |
}); | |
}); |
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.exports = Bookshelf.Model.extend({ | |
initialize: function () { | |
this.on('saving', this.validate); | |
}, | |
validate: function () {} | |
}); |
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
create = { | |
handler: function(request, reply) { | |
return new Address().save({ | |
name: request.payload.name, | |
address_line1: request.payload.address_line1 | |
}) | |
.call('fetch') | |
.then(reply) | |
.catch(reply); | |
} |
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
'use strict'; | |
var DB = require('./db'); | |
var Joi = require('joi'); | |
var Promise = require('bluebird'); | |
var _ = require('lodash'); | |
var Model = DB.Model.extend({ | |
constructor: function () { | |
DB.Model.apply(this, arguments); |
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
toJSON: -> | |
json = super | |
json.status = json.status.name | |
json |
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 sinon = require('sinon'); | |
var Promise = require('bookshelf/dialects/base/promise').Promise; | |
var Bookshelf = require('bookshelf'); | |
var unhandled = sinon.spy(); | |
var caught = sinon.spy(); | |
Promise.onPossiblyUnhandledRejection(unhandled); |
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
'use strict'; | |
angular.module('quizApp') | |
.factory('Question', function () { | |
var Question = function (question, answers, correct_answer) { | |
this.question = question; | |
this.answers = []; | |
this.correct_answer = correct_answer; | |
}; |
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
<div ng-repeat="answer in question.answers"> | |
<input type="text" ng-model="answer.text" /> | |
<input type="checkbox" ng-model="answer.correct" /> | |
</div> | |
<!-- --> | |
<answer ng-repeat="answer in answers" answer-model="answer"></answer> |
OlderNewer