From 1ada62ad64b9664783de875820242fc404f967f2 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 19 Nov 2013 15:15:59 +0100 Subject: initial design documents from the webapp (#3770) --- .../site_couchdb/files/designs/users/User.json | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 puppet/modules/site_couchdb/files/designs/users/User.json (limited to 'puppet/modules/site_couchdb/files/designs/users') diff --git a/puppet/modules/site_couchdb/files/designs/users/User.json b/puppet/modules/site_couchdb/files/designs/users/User.json new file mode 100644 index 00000000..c500822b --- /dev/null +++ b/puppet/modules/site_couchdb/files/designs/users/User.json @@ -0,0 +1,26 @@ +{ + "_id": "_design/User", + "language": "javascript", + "views": { + "by_login": { + "map": " function(doc) {\n if ((doc['type'] == 'User') && (doc['login'] != null)) {\n emit(doc['login'], 1);\n }\n }\n", + "reduce": "_sum" + }, + "all": { + "map": " function(doc) {\n if (doc['type'] == 'User') {\n emit(doc._id, null);\n }\n }\n" + }, + "by_alias": { + "map": "function(doc) {\n if (doc.type != 'User') {\n return;\n }\n doc.email_aliases.forEach(function(alias){\n emit(alias.username, 1);\n });\n}\n", + "reduce": "function(key, values, rereduce) { return sum(values); }" + }, + "by_login_or_alias": { + "map": "function(doc) {\n if (doc.type != 'User') {\n return;\n }\n emit(doc.login, 1);\n doc.email_aliases.forEach(function(alias){\n emit(alias.username, 1);\n });\n}\n", + "reduce": "function(key, values, rereduce) { return sum(values); }" + }, + "by_created_at": { + "map": " function(doc) {\n if ((doc['type'] == 'User') && (doc['created_at'] != null)) {\n emit(doc['created_at'], 1);\n }\n }\n", + "reduce": "_sum" + } + }, + "couchrest-hash": "26adb5c9480663de3fe60d959b60a7b2" +} \ No newline at end of file -- cgit v1.2.3 From 7fbad48e98cb49367041b22f7c94a8d0e001db33 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 7 Jan 2014 12:02:05 +0100 Subject: fix function issues in webapp design documents This change is a result of https://github.com/leapcode/leap_web/pull/133. Both should be deployed at the same time to prevent conflicts. --- puppet/modules/site_couchdb/files/designs/users/User.json | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'puppet/modules/site_couchdb/files/designs/users') diff --git a/puppet/modules/site_couchdb/files/designs/users/User.json b/puppet/modules/site_couchdb/files/designs/users/User.json index c500822b..c99666cb 100644 --- a/puppet/modules/site_couchdb/files/designs/users/User.json +++ b/puppet/modules/site_couchdb/files/designs/users/User.json @@ -9,18 +9,10 @@ "all": { "map": " function(doc) {\n if (doc['type'] == 'User') {\n emit(doc._id, null);\n }\n }\n" }, - "by_alias": { - "map": "function(doc) {\n if (doc.type != 'User') {\n return;\n }\n doc.email_aliases.forEach(function(alias){\n emit(alias.username, 1);\n });\n}\n", - "reduce": "function(key, values, rereduce) { return sum(values); }" - }, - "by_login_or_alias": { - "map": "function(doc) {\n if (doc.type != 'User') {\n return;\n }\n emit(doc.login, 1);\n doc.email_aliases.forEach(function(alias){\n emit(alias.username, 1);\n });\n}\n", - "reduce": "function(key, values, rereduce) { return sum(values); }" - }, "by_created_at": { "map": " function(doc) {\n if ((doc['type'] == 'User') && (doc['created_at'] != null)) {\n emit(doc['created_at'], 1);\n }\n }\n", "reduce": "_sum" } }, - "couchrest-hash": "26adb5c9480663de3fe60d959b60a7b2" + "couchrest-hash": "3bdbcd85b928ad911e0c89a8924e015c" } \ No newline at end of file -- cgit v1.2.3 From face1d929175b94e26ca11858e3b055873fdde92 Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 26 Feb 2014 14:55:47 +0100 Subject: update design docs, include messages (#5188) --- puppet/modules/site_couchdb/files/designs/users/User.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'puppet/modules/site_couchdb/files/designs/users') diff --git a/puppet/modules/site_couchdb/files/designs/users/User.json b/puppet/modules/site_couchdb/files/designs/users/User.json index c99666cb..4089ad97 100644 --- a/puppet/modules/site_couchdb/files/designs/users/User.json +++ b/puppet/modules/site_couchdb/files/designs/users/User.json @@ -9,10 +9,14 @@ "all": { "map": " function(doc) {\n if (doc['type'] == 'User') {\n emit(doc._id, null);\n }\n }\n" }, + "by_created_at_and_one_month_warning_not_sent": { + "map": "function (doc) {\n if ((doc['type'] == 'User') && (doc['created_at'] != null) && (doc['one_month_warning_sent'] == null)) {\n emit(doc['created_at'], 1);\n } \n}\n", + "reduce": "function(key, values, rereduce) { return sum(values); }" + }, "by_created_at": { "map": " function(doc) {\n if ((doc['type'] == 'User') && (doc['created_at'] != null)) {\n emit(doc['created_at'], 1);\n }\n }\n", "reduce": "_sum" } }, - "couchrest-hash": "3bdbcd85b928ad911e0c89a8924e015c" + "couchrest-hash": "61840ab3ec0f94ef8bbd6dd208db3b70" } \ No newline at end of file -- cgit v1.2.3