const BaseModel = require('./BaseModel'); const { Model } = require('objection'); /** * CREATE TABLE `admin` ( `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `created` datetime NOT NULL DEFAULT '2000-01-01 00:00:00', `modified` datetime NOT NULL DEFAULT '2000-01-01 00:00:00', `active` tinyint(1) NOT NULL DEFAULT 1, `superadmin` tinyint(1) NOT NULL DEFAULT 0, `phone` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', `email_other` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', `token` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '', `token_validity` datetime NOT NULL DEFAULT '2000-01-01 00:00:00', PRIMARY KEY (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='Postfix Admin - Virtual Admins' */ class Admin extends BaseModel { static get tableName() { return 'admin'; } static get idColumn() { return 'username'; } static get jsonSchema() { return { type: 'object', required: ['username', 'password'], properties: { username: { type: 'string', minLength: 1, maxLength: 255 }, password: { type: 'string', minLength: 1, maxLength: 255 }, created: { type: 'string', format: 'date-time' }, modified: { type: 'string', format: 'date-time' }, active: { type: 'integer', default: 1 }, superadmin: { type: 'integer', default: 0 }, phone: { type: 'string', maxLength: 30 }, email_other: { type: 'string', maxLength: 255 }, token: { type: 'string', maxLength: 255 }, token_validity: { type: 'string', format: 'date-time' }, } }; } static get relationMappings() { return {}; } } module.exports = Admin;