Skip to content

Commit

Permalink
Restored examples to work without babel
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekel committed Aug 27, 2018
1 parent 5189468 commit e5c547a
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,22 @@ const { Model } = require('objection');

class User extends Model {

static tableName = 'user'

static jsonSchema = {
type: 'object',
required: ['firstName', 'lastName'],
static get tableName() {
return 'user';
}

properties: {
id: { type: 'integer' },
firstName: { type: 'string', maxLength: 45 },
lastName: { type: 'string', maxLength: 45 },
status: { type: 'string', enum: ['active', 'disabled'], default: 'active' },
}
static get jsonSchema() {
return {
type: 'object',
required: ['firstName', 'lastName'],

properties: {
id: { type: 'integer' },
firstName: { type: 'string', maxLength: 45 },
lastName: { type: 'string', maxLength: 45 },
status: { type: 'string', enum: ['active', 'disabled'], default: 'active' },
},
};
}

static get relationMappings() {
Expand Down Expand Up @@ -128,18 +132,22 @@ const { Model } = require('objection');

class Todo extends Model {

static tableName = 'todo'

static jsonSchema = {
type: 'object',
required: ['userId', 'text'],
static get tableName() {
return 'todo';
}

properties: {
id: { type: 'integer' },
userId: { type: 'integer' },
text: { type: 'string' },
complete: { type: 'boolean', default: false },
}
static get jsonSchema() {
return {
type: 'object',
required: ['userId', 'text'],

properties: {
id: { type: 'integer' },
userId: { type: 'integer' },
text: { type: 'string' },
complete: { type: 'boolean', default: false },
},
};
}

static get relationMappings() {
Expand Down

0 comments on commit e5c547a

Please sign in to comment.