smaller refactorings continued

This commit is contained in:
azivner
2018-04-01 17:38:24 -04:00
parent 15d951b04e
commit 96dab5d51e
14 changed files with 122 additions and 109 deletions

25
src/entities/api_token.js Normal file
View File

@@ -0,0 +1,25 @@
"use strict";
const Entity = require('./entity');
const utils = require('../services/utils');
class ApiToken extends Entity {
static get tableName() { return "api_tokens"; }
static get primaryKeyName() { return "apiTokenId"; }
beforeSaving() {
if (!this.apiTokenId) {
this.apiTokenId = utils.newApiTokenId();
}
if (!this.isDeleted) {
this.isDeleted = false;
}
if (!this.dateCreated) {
this.dateCreated = utils.nowDate();
}
}
}
module.exports = ApiToken;