Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var Model = require('objection').Model;
/**
* @extends Model
* @constructor
*/
function Animal() {
Model.apply(this, arguments);
}
Model.extend(Animal);
module.exports = Animal;
// Table name is the only required property.
Animal.tableName = 'Animal';
// Optional JSON schema. This is not the database schema! Nothing is generated
// based on this. This is only used for validation. Whenever a model instance
// is created it is checked against this schema. http://json-schema.org/.
Animal.jsonSchema = {
type: 'object',
required: ['name'],
properties: {
id: {type: 'integer'},
ownerId: {type: ['integer', 'null']},
name: {type: 'string', minLength: 1, maxLength: 255},
var Model = require('objection').Model;
var Animal = require('./Animal')
var Movie = require('./Movie')
/**
* @extends Model
* @constructor
*/
function Person() {
Model.apply(this, arguments);
}
Model.extend(Person);
module.exports = Person;
// Table name is the only required property.
Person.tableName = 'Person';
// Optional JSON schema. This is not the database schema! Nothing is generated
// based on this. This is only used for validation. Whenever a model instance
// is created it is checked against this schema. http://json-schema.org/.
Person.jsonSchema = {
type: 'object',
required: ['firstName', 'lastName'],
properties: {
id: {type: 'integer'},
parentId: {type: ['integer', 'null']},
firstName: {type: 'string', minLength: 1, maxLength: 255},
var Model = require('objection').Model;
/**
* @extends Model
* @constructor
*/
function Hero() {
Model.apply(this, arguments);
}
Model.extend(Hero);
module.exports = Hero;
// Table name is the only required property.
Hero.tableName = 'Hero';
Hero.jsonSchema = {
type: 'object',
required: ['name'],
properties: {
id: { type: 'integer' },
name: { type: 'string' },
details: { type: ['object', 'array', 'null'] },
homeId: { type: 'integer' }
}
};
var Model = require('objection').Model;
/**
* @extends Model
* @constructor
*/
function Movie() {
Model.apply(this, arguments);
}
Model.extend(Movie);
module.exports = Movie;
// Table name is the only required property.
Movie.tableName = 'Movie';
// Optional JSON schema. This is not the database schema! Nothing is generated
// based on this. This is only used for validation. Whenever a model instance
// is created it is checked against this schema. http://json-schema.org/.
Movie.jsonSchema = {
type: 'object',
required: ['name'],
properties: {
id: {type: 'integer'},
name: {type: 'string', minLength: 1, maxLength: 255}
}