Failed Conditions
Pull Request — master (#72)
by Sander
01:51
created

js/app/services/NotebookService.js (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
/**
2
 * Nextcloud - NextNotes
3
 *
4
 * @copyright Copyright (c) 2016, Sander Brand ([email protected])
5
 * @copyright Copyright (c) 2016, Marcos Zuriaga Miguel ([email protected])
6
 * @license GNU AGPL version 3 or any later version
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License as
10
 * published by the Free Software Foundation, either version 3 of the
11
 * License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU Affero General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public License
19
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 *
21
 */
22
(function() {
23
	'use strict';
24
	/**
25
	 * @ngdoc service
26
	 * @name NextNotesApp.NoteService
27
	 * @description
28
	 * # NoteService
29
	 * Service in the NextNotesApp.
30
	 */
31
	angular.module('NextNotesApp').service('NotebookService', [
32
		'$rootScope',
33
		'NotebookFactory',
34
		'$timeout',
35
		'$q',
36
		function($rootScope, NotebookFactory, $timeout, $q) {
37
			var newGroupTemplate = {
38
				'name': '',
39
				'color': '',
40
				'parent_id': 0
41
			};
42
43
			return {
44
				newGroup: function() {
45
					return angular.copy(newGroupTemplate);
46
				},
47
				getGroupById: function(groupId) {
48
					groupId = parseInt(groupId);
49
					var deferred = $q.defer();
50
					NotebookFactory.get({id: groupId}, function(group) {
51
						$rootScope.notes[group.id] = group;
52
						deferred.resolve(group);
53
					});
54
					return deferred.promise;
55
				},
56
				save: function(notebook){
57
					NotebookFactory.save(notebook)
0 ignored issues
show
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
58
				},
59
				update: NotebookFactory.update
60
61
			};
62
		}]);
63
}());
64