ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [28/51] [abbrv] ignite git commit: IGNITE-3262 Added space service.
Date Fri, 01 Jul 2016 07:18:15 GMT
IGNITE-3262 Added space service.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/579a3da6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/579a3da6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/579a3da6

Branch: refs/heads/ignite-3262
Commit: 579a3da66ce18f4466d034576c327c2195e6bcd1
Parents: 0301301
Author: Maxim Afanasiev <mafkus@gmail.com>
Authored: Thu Jun 30 10:28:33 2016 +0700
Committer: Maxim Afanasiev <mafkus@gmail.com>
Committed: Thu Jun 30 10:28:33 2016 +0700

----------------------------------------------------------------------
 .../src/main/js/serve/services/space.js         | 58 ++++++++++++++++++++
 1 file changed, 58 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/579a3da6/modules/web-console/src/main/js/serve/services/space.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/services/space.js b/modules/web-console/src/main/js/serve/services/space.js
new file mode 100644
index 0000000..106a0cb
--- /dev/null
+++ b/modules/web-console/src/main/js/serve/services/space.js
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+// Fire me up!
+
+module.exports = {
+    implements: 'services/spaceService',
+    inject: ['mongo']
+};
+
+module.exports.factory = (mongo) => {
+
+    class SpaceService {
+
+        /**
+         * Query for user spaces.
+         *
+         * @param userId User ID.
+         * @param {Boolean} demo Is need use demo space.
+         * @returns {Promise}
+         */
+        spaces(userId, demo) {
+            return mongo.Space.find({owner: userId, demo: !!demo}).lean().exec();
+        }
+
+        /**
+         * Extract IDs from user spaces.
+         *
+         * @param userId User ID.
+         * @param {Boolean} demo Is need use demo space.
+         * @returns {Promise}
+         */
+        spaceIds(userId, demo) {
+            return this.spaces(userId, demo)
+                .then((spaces) => spaces.map((space) => space._id));
+        }
+
+    }
+
+    return SpaceService;
+};
+


Mime
View raw message