Browse Source

Remove json schemas from models as they aren't necessary

Signed-off-by: Dušan Mitrović <dusan@dusanmitrovic.xyz>
master
Dušan Mitrović 3 months ago
parent
commit
8d7d9256ec
Signed by: dusan GPG Key ID: 8E81D1BFCE8427E5
2 changed files with 6 additions and 67 deletions
  1. +3
    -32
      models/Post.js
  2. +3
    -35
      models/User.js

+ 3
- 32
models/Post.js View File

@@ -11,35 +11,6 @@ class Post extends Model {
return 'posts';
}

static get jsonSchema() {
return {
type: 'object',
required: ['title', 'description', 'content', 'user_id'],
properties: {
id: {
type: 'integer'
},
title: {
type: 'string',
minLegth: 1,
maxLength: 100
},
description: {
type: 'string',
minLegth: 1,
maxLength: 300
},
content: {
type: 'string',
minLegth: 1
},
user_id: {
type: 'integer'
}
}
};
}

static get relationMappings() {
const User = require('./User');

@@ -49,9 +20,9 @@ class Post extends Model {
modelClass: User,
join: {
from: 'posts.user_id',
to: 'users.id'
}
}
to: 'users.id',
},
},
};
}
}


+ 3
- 35
models/User.js View File

@@ -11,38 +11,6 @@ class User extends Model {
return 'users';
}

static get jsonSchema() {
return {
type: 'object',
required: ['first_name', 'last_name', 'email', 'password'],
properties: {
id: {
type: 'integer'
},
first_name: {
type: 'string',
minLegth: 1,
maxLength: 100
},
last_name: {
type: 'string',
minLegth: 1,
maxLength: 100
},
email: {
type: 'string',
maxLength: 100,
format: 'email'
},
password: {
type: 'string',
minLegth: 8,
maxLength: 100
}
}
};
}

static get relationMappings() {
const Post = require('./Post');

@@ -52,9 +20,9 @@ class User extends Model {
modelClass: Post,
join: {
from: 'users.id',
to: 'posts.user_id'
}
}
to: 'posts.user_id',
},
},
};
}
}


Loading…
Cancel
Save