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      1x                                        
import { Model } from 'objection';
import { Slugify } from '../../src/index';
 
const SluggedModel = Slugify(Model, {
  sourceField: 'name',
  slugField: 'slugged',
  unique: true
});
 
export default class User extends SluggedModel {
  static modelPaths = [__dirname];
  static tableName = 'users';
  static jsonSchema = {
    type: 'object',
    required: ['name'],
 
    properties: {
      id: { type: 'integer' },
      name: { type: 'string', minLength: 1, maxLength: 255 },
      slugged: { type: 'string', minLength: 1, maxLength: 255 },
    }
  };
}