Notes/src/entities/api_token.js

25 lines
559 B
JavaScript
Raw Normal View History

2018-04-01 17:38:24 -04:00
"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;