Page MenuHomeSealhub

No OneTemporary

diff --git a/bin/prometheus-modules/chat/chat.js b/bin/prometheus-modules/chat/chat.js
index 69902201..6e74c207 100644
--- a/bin/prometheus-modules/chat/chat.js
+++ b/bin/prometheus-modules/chat/chat.js
@@ -1,96 +1,112 @@
var Service = require("prometheus-service");
var resourceManager = require("prometheus-resource-manager");
module.exports.service_info = function(service_name){
var ret = {};
if(service_name=="chat"){
- ret["name"] = "Prometheus Distributed Chat System";
- ret["description"] = "The an advanced simple chat image processing service module";
+ ret.name = "Prometheus Distributed Chat System";
+ ret.description = "The an advanced simple chat image processing service module";
}
return ret;
}
function construct_chat_service(){
var chat_service = new Service();
//todo
chat_service.on("post", function(payload, callback){
resourceManager.newResource("chat-message", payload, function(response){
callback(response);
})
})
+ chat_service.on("create_conversation", function(payload, callback){
+ resourceManager.newResource("chat-conversation", payload, function(response){
+ callback(response);
+ })
+ })
return chat_service;
}
module.exports.construct_service = function(service_name){
if(service_name=="chat"){
return construct_chat_service();
}
};
/**
Reosource types
*/
module.exports.construct_resource_type = function(type){
switch(type){
case "chat-message":
return {
from: {type: "text", required:true},//should be an association to User
message: {type: "text", required: true},
date: {type: "date"},
order_in_conversation: {type: "int"}
}
break;
case "chat-conversation":
return {
title: {type: "text"}
}
break;
}
}
module.exports.construct_associations = function(AssocInterface){
AssocInterface.create("chat-message", "chat-conversation", true, "is_in_conversation", "contains_messages");
}
/*
channel associations
*/
module.exports.channel_setup = function(channel_id, dependencies){
var www_server = dependencies["channel.www-server"];
var chat_service = dependencies["service.chat"];
www_server.route(
{
method: 'GET',
path: '/chat/lolo',
handler: function(request, reply){
console.log("captured request for nono");
db_view_service.emit("list", function(data){
reply(data);
})
}
});
www_server.route(
{
method: 'GET',
path: '/api/v1/chat/post',
handler: function(request, reply){
chat_service.emit("post", {message: "heloł mejbi", from: "groovy354@gmail.com"}, function(data){
reply(data);
})
}
});
+ www_server.route(
+ {
+ method: 'GET',
+ path: '/api/v1/chat/new-conversation',
+ handler: function(request, reply){
+ chat_service.emit("create_conversation", {title: "Template conversation"}, function(data){
+ reply(data);
+ })
+ }
+ });
+
}
\ No newline at end of file
diff --git a/generate_docs.sh b/generate_docs.sh
new file mode 100755
index 00000000..369b154d
--- /dev/null
+++ b/generate_docs.sh
@@ -0,0 +1,3 @@
+#/bin/sh
+
+jsdoc . -r -c jsdoc.json -d docs
\ No newline at end of file
diff --git a/jsdoc.json b/jsdoc.json
new file mode 100644
index 00000000..14b4c854
--- /dev/null
+++ b/jsdoc.json
@@ -0,0 +1,18 @@
+{
+ "tags": {
+ "allowUnknownTags": true
+ },
+ "source": {
+ //"include": ["./bin/node_modules"],
+ "exclude": [ "./bin/node_modules/.bin", "./bin/node_modules/Set", "./bin/node_modules/boom", "./bin/node_modules/glue", "./bin/node_modules/hapi", "./bin/node_modules/http", "./bin/node_modules/ip", "./bin/node_modules/mongodb", "./bin/node_modules/open", "./bin/node_modules/promise", "./bin/node_modules/query-string", "./bin/node_modules/request", "./bin/node_modules/simpleargs", "./bin/node_modules/socket.io", "./bin/node_modules/socket.io-client"],
+ "includePattern": ".+\\.js(doc)?$",
+ //"includePattern": "\\./bin/node_modules/prometheus[^/]+/.*\\.js",
+ "excludePattern": "(^|\\/|\\\\)_"
+ },
+ "plugins": [],
+ "templates": {
+ "cleverLinks": false,
+ "monospaceLinks": false
+ }
+}
+

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 8, 13:35 (7 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034632
Default Alt Text
(4 KB)

Event Timeline