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 Knex = require('knex'); | |
var Promise = require('bluebird'); | |
Object.assign(Knex.Client.prototype.QueryBuilder.prototype, { | |
paginate(per_page, current_page) { | |
var pagination = {}; | |
var per_page = +per_page || 8; | |
var page = +current_page || 1; | |
if ( page < 1 ) page = 1; | |
var offset = (page - 1) * per_page; |
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
{ | |
"tiles": [ | |
{ | |
"type": "weeds", | |
"y": "112", | |
"x": "640" | |
}, | |
{ | |
"type": "twig", | |
"y": "128", |
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 = function(sequelize, DataTypes) { | |
return sequelize.define('user_roles', { | |
id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true }, | |
userId: { type: DataTypes.INTEGER }, | |
roleId: { type: DataTypes.INTEGER }, | |
schoolId: { type: DataTypes.INTEGER }, | |
councilId: { type: DataTypes.INTEGER }, | |
classId: { type: DataTypes.INTEGER }, | |
active: { type: DataTypes.BOOLEAN }, | |
created: { type: DataTypes.DATE, defaultValue: DataTypes.NOW }, |
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 checkEmail(email) { | |
if(!email) | |
return false; | |
console.log('email check 1'); | |
// not the worlds BEST email reex, but it does it's job good enough | |
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
if(re.test(email) == false) { | |
console.log("regex test failed on email"); | |
return false; |