2025-03-19 19:56:57 -05:00

31 lines
971 B
JavaScript

const BaseModel = require('./BaseModel');
class User extends BaseModel {
static get tableName() {
return 'users';
}
static get idColumn() {
return 'id';
}
static get jsonSchema() {
return {
type: 'object',
required: ['username', 'password', 'email'],
properties: {
id: { type: 'integer' },
username: { type: 'string', minLength: 1, maxLength: 255 },
password: { type: 'string', minLength: 1 },
email: { type: 'string', minLength: 1, maxLength: 255 },
is_admin: { type: 'boolean', default: false },
is_active: { type: 'boolean', default: true },
api_key: { type: ['string', 'null'] },
created: { type: 'string', format: 'date-time' },
modified: { type: 'string', format: 'date-time' }
}
};
}
}
module.exports = User;