All files / support User.js

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27      3x                                              
import { Model } from 'objection';
import { Authenticatable, Recoverable, Tokenable } from '../../index';
 
const AuthModel = Authenticatable(
  Recoverable(
    Tokenable(Model, { secretToken: 'secret' })
  )
);
 
export default class User extends AuthModel {
  static modelPaths = [__dirname];
  static tableName = 'users';
  static jsonSchema = {
    type: 'object',
    required: ['name', 'email', 'password'],
 
    properties: {
      id: { type: 'integer' },
      name: { type: 'string', minLength: 1, maxLength: 255 },
      email: { type: 'string', minLength: 3, maxLength: 255 },
      password: { type: 'string', minLength: 3, maxLength: 255 },
      resetPasswordToken: { type: 'string', minLength: 20, maxLength: 255 },
      resetPasswordExp: { type: 'string', format: 'date-time' }
    }
  };
}