All files / framework/src/api/db/model/user AccountModel.js

100% Statements 6/6
100% Branches 0/0
100% Functions 2/2
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 411x 1x 1x               281x                           1x                           1x    
const BasicModel = require('../BasicModel');
const TABLES = require('../../../../constants/tables');
const _ = require('lodash');
 
/**
 * AccountModel implementation of default accnout database entity
 * @augments BasicModel
 */
class AccountModel extends BasicModel {
    static get tableName() {
        return TABLES.ACCOUNT_TABLE_NAME;
    }
 
    /**
     * JsonSchema getter merge account schema with super class schema
     * @type {Object}
     * @property {string} accessToken AccessToken (short term)
     * @property {string} refreshToken Refresh token (long term)
     * @property {string} email user email
     * @property {string} provider identity provider (e.g. GOOGLE)
     * @property {string} subject user identifier in 3rd party system
     * @property {number} userId owner of account
     */
    static get jsonSchema() {
        return _.merge(super.jsonSchema, {
            properties: {
                accessToken: { type: 'string' },
                refreshToken: { type: 'string' },
                email: { type: 'string' },
                provider: { type: 'string' },
                subject: { type: 'string' },
                userId: { type: 'integer' },
 
            },
        });
    }
}
 
module.exports = AccountModel;