All files / src/modules/implementations/database read-model-contract.js

100% Statements 26/26
100% Branches 3/3
100% Functions 1/1
100% Lines 26/26

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 2754x 54x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 14x 1x 54x  
'use strict';
module.exports = () => {
    const columns = {
        database_metadata: ['key', 'value'],
        source_files: ['id', 'path', 'sha256', 'size'],
        journal_entries: ['id', 'source_file_id', 'line'],
        file_comments: ['entry_id', 'text'],
        prices: ['entry_id', 'date', 'base_commodity', 'quote_quantity', 'quote_commodity', 'comment'],
        account_declarations: ['entry_id', 'name', 'comment', 'used'],
        tag_declarations: ['entry_id', 'name', 'comment', 'used'],
        commodity_declarations: ['entry_id', 'symbol', 'comment', 'format', 'is_default', 'used'],
        transactions: ['entry_id', 'date', 'description'],
        postings: ['id', 'transaction_id', 'position', 'posting_date', 'account',
            'amount_quantity', 'amount_commodity', 'lot_cost_quantity', 'lot_cost_commodity',
            'lot_cost_is_total', 'cost_quantity', 'cost_commodity', 'cost_is_total',
            'balance_quantity', 'balance_commodity'],
        comments: ['id', 'transaction_id', 'posting_id', 'position', 'text'],
        tags: ['id', 'transaction_id', 'posting_id', 'position', 'ordinal', 'name', 'value'],
        resolved_posting_amounts: ['id', 'posting_id', 'position', 'amount_quantity',
            'amount_commodity', 'balance_quantity'],
        valuation_prices: ['commodity', 'date', 'rate'],
    };
    return Object.freeze(Object.fromEntries(Object.entries(columns).map(([table, names]) => [
        table, Object.freeze(names),
    ])));
};