Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit e5c547a

Browse files
author
Dekel
committed
Restored examples to work without babel
1 parent 5189468 commit e5c547a

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

README.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,22 @@ const { Model } = require('objection');
7272

7373
class User extends Model {
7474

75-
static tableName = 'user'
76-
77-
static jsonSchema = {
78-
type: 'object',
79-
required: ['firstName', 'lastName'],
75+
static get tableName() {
76+
return 'user';
77+
}
8078

81-
properties: {
82-
id: { type: 'integer' },
83-
firstName: { type: 'string', maxLength: 45 },
84-
lastName: { type: 'string', maxLength: 45 },
85-
status: { type: 'string', enum: ['active', 'disabled'], default: 'active' },
86-
}
79+
static get jsonSchema() {
80+
return {
81+
type: 'object',
82+
required: ['firstName', 'lastName'],
83+
84+
properties: {
85+
id: { type: 'integer' },
86+
firstName: { type: 'string', maxLength: 45 },
87+
lastName: { type: 'string', maxLength: 45 },
88+
status: { type: 'string', enum: ['active', 'disabled'], default: 'active' },
89+
},
90+
};
8791
}
8892

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

129133
class Todo extends Model {
130134

131-
static tableName = 'todo'
132-
133-
static jsonSchema = {
134-
type: 'object',
135-
required: ['userId', 'text'],
135+
static get tableName() {
136+
return 'todo';
137+
}
136138

137-
properties: {
138-
id: { type: 'integer' },
139-
userId: { type: 'integer' },
140-
text: { type: 'string' },
141-
complete: { type: 'boolean', default: false },
142-
}
139+
static get jsonSchema() {
140+
return {
141+
type: 'object',
142+
required: ['userId', 'text'],
143+
144+
properties: {
145+
id: { type: 'integer' },
146+
userId: { type: 'integer' },
147+
text: { type: 'string' },
148+
complete: { type: 'boolean', default: false },
149+
},
150+
};
143151
}
144152

145153
static get relationMappings() {

0 commit comments

Comments
 (0)