diff --git a/app/main.js b/app/main.js index 0df4f51..a7de4b1 100644 --- a/app/main.js +++ b/app/main.js @@ -31,6 +31,8 @@ } ]) var PouchDBService = require('./shell/services/PouchDBService') + var LovefieldService = require('./shell/services/LovefieldService') + var RDFStoreService = require('./shell/services/RDFStoreService') var ActivityDataService = require('./shell/services/ActivityDataService') var ActivityService = require('./shell/services/ActivityService') var ModuleProvider = require('./scripts/ModuleProvider') @@ -39,6 +41,8 @@ ModuleProvider.loadModules() angular.module('electron-app').provider('modules', [ModuleProvider]) angular.module('electron-app').service('PouchDBService', [PouchDBService]) + angular.module('electron-app').service('LovefieldService', [LovefieldService]) + angular.module('electron-app').service('RDFStoreService', [RDFStoreService]) angular.module('electron-app').service('ActivityDataService', ['PouchDBService', ActivityDataService]) angular.module('electron-app').service('ActivityService', ['ActivityDataService', ActivityService]) angular.module('electron-app').controller('ShellController', ['$scope', '$log', '$q', '$mdSidenav', 'modules', 'ActivityService', ShellController]) diff --git a/app/shell/controllers/ShellController.js b/app/shell/controllers/ShellController.js index 1aa7eb2..4e95892 100644 --- a/app/shell/controllers/ShellController.js +++ b/app/shell/controllers/ShellController.js @@ -64,7 +64,6 @@ */ $scope.notify = (title, message) => { $q.when(true).then(() => { - console.log("Notification", title, message) notifier.notify(title, { message: message, icon: appCfg.app.icon diff --git a/app/shell/services/LovefieldService.js b/app/shell/services/LovefieldService.js new file mode 100644 index 0000000..950434b --- /dev/null +++ b/app/shell/services/LovefieldService.js @@ -0,0 +1,25 @@ +(function () { + 'use strict' + /** + * LovefieldService - description + * + * @return {type} description + */ + function LovefieldService () { + + var lf = require('lovefield') + + return { + /** + * initialize function - description + * + * @param {type} dbName description + * @return {type} description + */ + initialize: function (dbName) { + return lf.schema.create(dbName); + } + } + } + module.exports = LovefieldService +})() diff --git a/app/shell/services/RDFStoreService.js b/app/shell/services/RDFStoreService.js new file mode 100644 index 0000000..845288b --- /dev/null +++ b/app/shell/services/RDFStoreService.js @@ -0,0 +1,43 @@ +(function () { + 'use strict' + /** + * RDFStoreService - description + * + * @return {type} description + */ + function RDFStoreService () { + + var rdfStore = require('rdfStore') + /** + * DataService - description + * + * @param {type} dbName description + * @return {type} description + */ + function DataService (dbName) { + var promise = new Promise((resolve, reject) => { + rdfStore.Store({ persistent: true, name: dbName }) + .then((result) => { + resolve(result) + }) + .catch((err) => { + console.log(err) + reject(err) + }) + }) + return promise + } + return { + /** + * initialize function - description + * + * @param {type} dbName description + * @return {type} description + */ + initialize: function (dbName) { + return new DataService(dbName) + } + } + } + module.exports = RDFStoreService +})()