How to use the fulcrum-core.Changeset function in fulcrum-core

To help you get started, we’ve selected a few fulcrum-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fulcrumapp / fulcrum-desktop / app / main / models / changeset.js View on Github external
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _minidb = require('minidb');

var _fulcrumCore = require('fulcrum-core');

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

class Changeset extends _fulcrumCore.Changeset {
  static get tableName() {
    return 'changesets';
  }

  static get columns() {
    return [{ name: 'accountRowID', column: 'account_id', type: 'integer', null: false }, { name: 'id', column: 'resource_id', type: 'string', null: false }, { name: 'formRowID', column: 'form_id', type: 'integer' }, { name: 'formID', column: 'form_resource_id', type: 'string' }, { name: 'metadata', column: 'metadata', type: 'json' }, { name: 'metadataIndexText', column: 'metadata_index_text', type: 'string' }, { name: 'closedAt', column: 'closed_at', type: 'datetime' }, { name: 'closedByRowID', column: 'closed_by_id', type: 'integer' }, { name: 'closedByID', column: 'closed_by_resource_id', type: 'string' }, { name: 'createdByRowID', column: 'created_by_id', type: 'integer' }, { name: 'createdByID', column: 'created_by_resource_id', type: 'string' }, { name: 'updatedByRowID', column: 'updated_by_id', type: 'integer' }, { name: 'updatedByID', column: 'updated_by_resource_id', type: 'string' }, { name: 'numberOfChanges', column: 'number_of_changes', type: 'integer' }, { name: 'numberOfCreates', column: 'number_of_creates', type: 'integer' }, { name: 'numberOfUpdates', column: 'number_of_updates', type: 'integer' }, { name: 'numberOfDeletes', column: 'number_of_deletes', type: 'integer' }, { name: 'minLat', column: 'min_lat', type: 'double' }, { name: 'maxLat', column: 'max_lat', type: 'double' }, { name: 'minLon', column: 'min_lon', type: 'double' }, { name: 'maxLon', column: 'max_lon', type: 'double' }, { name: 'createdAt', column: 'server_created_at', type: 'datetime' }, { name: 'updatedAt', column: 'server_updated_at', type: 'datetime' }];
  }

  beforeSave(options) {
    var _this = this;

    return _asyncToGenerator(function* () {
      _this._metadataIndexText = _this.metadataIndexText;
    })();
  }
}