From 094b5eadc7dd9a68c5fb0e94c0fb663e5f2c0bd0 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 21 Jun 2021 17:47:54 +0200 Subject: [PATCH 1/3] =?UTF-8?q?IMPLEMENTATION=20:=20vue,=20list=20et=20rew?= =?UTF-8?q?rite=20pour=20les=20items=20modifi=C3=A9s=20du=20corpus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lists/feed.js | 21 +++++++++++++++++++++ app/rewrites.json | 8 ++++++++ app/views/modified/map.js | 5 +++++ 3 files changed, 34 insertions(+) create mode 100644 app/lists/feed.js create mode 100644 app/views/modified/map.js diff --git a/app/lists/feed.js b/app/lists/feed.js new file mode 100644 index 0000000..dd9716f --- /dev/null +++ b/app/lists/feed.js @@ -0,0 +1,21 @@ +function(head, req){ + start({ + 'headers': { + 'Content-Type': 'text/xml' + } + }); + uri = req.query.app; + send('Modifications'); + send(uri); + send('IF05'); + while(row = getRow()){ + send(''.concat( + '', + '' + row.doc.item_name + '', + 'Lieu : ' + row.doc.spatial + ' créé le ' + row.doc.created + '', + '' + uri + '/item/' + row.doc.item_corpus + '/' + row.id + '', + '' + )); + } + send(''); +} diff --git a/app/rewrites.json b/app/rewrites.json index f8129ba..8519ef6 100644 --- a/app/rewrites.json +++ b/app/rewrites.json @@ -42,6 +42,14 @@ "key": [":user"], "reduce": "false" } + }, { + "from": "feed/:corpus", + "to": "_list/feed/modified", + "query": { + "include_docs": "true", + "startkey": [":corpus"], + "endkey": [":corpus",{}] + } }, { "from": "corpus/:corpus", "to": "_view/corpus", diff --git a/app/views/modified/map.js b/app/views/modified/map.js new file mode 100644 index 0000000..b87620d --- /dev/null +++ b/app/views/modified/map.js @@ -0,0 +1,5 @@ +function (doc) { + if(doc.item_corpus && doc.record.modified){ + emit([doc.item_corpus, doc.record.modified]); + } +} From 287e3953b5cf948a71e03f78fb6d26d3c51d5612 Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 22 Jun 2021 15:18:53 +0200 Subject: [PATCH 2/3] FEATURE: Get notified on corpus changes (see #501) --- app/lists/feed.js | 40 +++++++++++++++++++-------------------- app/views/modified/map.js | 6 +++--- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/lists/feed.js b/app/lists/feed.js index dd9716f..33fe2cf 100644 --- a/app/lists/feed.js +++ b/app/lists/feed.js @@ -1,21 +1,21 @@ -function(head, req){ - start({ - 'headers': { - 'Content-Type': 'text/xml' - } - }); - uri = req.query.app; - send('Modifications'); - send(uri); - send('IF05'); - while(row = getRow()){ - send(''.concat( - '', - '' + row.doc.item_name + '', - 'Lieu : ' + row.doc.spatial + ' créé le ' + row.doc.created + '', - '' + uri + '/item/' + row.doc.item_corpus + '/' + row.id + '', - '' - )); - } - send(''); +function (head, req) { + start({ + 'headers': { + 'Content-Type': 'text/xml' + } + }); + uri = req.query.app; + send('' + req.query.startkey + ''); + send(uri); + send('Created or updated items.'); + while(row = getRow()){ + send(''.concat( + '', + '' + row.doc.item_name + '', + 'Lieu : ' + row.doc.spatial + ' créé le ' + row.doc.created + '', + '' + uri + '/item/' + row.doc.item_corpus + '/' + row.id + '', + '' + )); + } + send(''); } diff --git a/app/views/modified/map.js b/app/views/modified/map.js index b87620d..b678267 100644 --- a/app/views/modified/map.js +++ b/app/views/modified/map.js @@ -1,5 +1,5 @@ function (doc) { - if(doc.item_corpus && doc.record.modified){ - emit([doc.item_corpus, doc.record.modified]); - } + if (doc.item_corpus && doc.record.modified) { + emit([doc.item_corpus, doc.record.modified]); + } } From 19b3c9c9836fc3dc0c779aa95121832ce2126d4d Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 24 Jun 2021 15:11:50 +0200 Subject: [PATCH 3/3] MERGING: 501 and 152 --- app/lists/feed.js | 10 +- app/rewrites.json | 304 +++++++++++++++++++------------------- app/views/modified/map.js | 7 +- 3 files changed, 166 insertions(+), 155 deletions(-) diff --git a/app/lists/feed.js b/app/lists/feed.js index 33fe2cf..8f77260 100644 --- a/app/lists/feed.js +++ b/app/lists/feed.js @@ -9,11 +9,17 @@ function (head, req) { send(uri); send('Created or updated items.'); while(row = getRow()){ - send(''.concat( + var i=0; + var topic=""; + for (var t in row.doc.topics){ + topic+=t+", "; + } + send(''.concat( '', '' + row.doc.item_name + '', - 'Lieu : ' + row.doc.spatial + ' créé le ' + row.doc.created + '', + ' Lieu : ' + row.doc.spatial + ' Créé le : ' + row.doc.created + ' Catégorie(s) : ' + topic + '', '' + uri + '/item/' + row.doc.item_corpus + '/' + row.id + '', + 'Modifié le : ' + row.doc.record.modified + '' '' )); } diff --git a/app/rewrites.json b/app/rewrites.json index 8519ef6..51575f0 100644 --- a/app/rewrites.json +++ b/app/rewrites.json @@ -1,152 +1,152 @@ -[ - { - "to": "../../_changes", - "from": "events", - "query": { - "filter": "argos/events", - "feed": "eventsource" - } - }, - { - "from": "item/", - "to": "_view/resource", - "query": { - "key": [":resource"] - } - }, { - "from": "empty", - "to": "_list/empty/empty", - "query": { - "include_docs": "true" - } - }, { - "from": "", - "to": "_list/index/stats", - "query": { - "group": "true" - }, - "method": "GET" - }, { - "from": "", - "to": "../../" - }, { - "from": "_users", - "to": "../../../_users" - }, { - "from": ":object", - "to": "../../:object" - }, { - "from": "user/:user", - "to": "_view/user", - "query": { - "key": [":user"], - "reduce": "false" - } - }, { - "from": "feed/:corpus", - "to": "_list/feed/modified", - "query": { - "include_docs": "true", - "startkey": [":corpus"], - "endkey": [":corpus",{}] - } - }, { - "from": "corpus/:corpus", - "to": "_view/corpus", - "query": { - "startkey": [":corpus"], - "endkey": [":corpus", {}] - } - }, { - "from": "item/:corpus/:item", - "to": "_view/corpus", - "query": { - "startkey": [":corpus", ":item"], - "endkey": [":corpus", ":item", {}] - } - }, { - "from": "item/:corpus/:item/:resource", - "to": "../../:item/:resource" - }, { - "from": "viewpoint/:viewpoint", - "to": "_view/viewpoint", - "query": { - "startkey": [":viewpoint"], - "endkey": [":viewpoint", {}] - } - }, { - "from": "topic/:viewpoint/:topic", - "to": "_view/viewpoint", - "query": { - "startkey": [":viewpoint", ":topic"], - "endkey": [":viewpoint", ":topic", {}] - } - }, { - "from": "attribute/:corpus/", - "to": "_view/attribute", - "query": { - "startkey": [":corpus"], - "endkey": [":corpus", {}], - "group_level": "2" - } - }, { - "from": "attribute/:corpus/:attribute/", - "to": "_view/attribute", - "query": { - "startkey": [":corpus", ":attribute"], - "endkey": [":corpus", ":attribute", {}], - "group_level": "3" - } - }, { - "from": "attribute/:corpus/:attribute/:value", - "to": "_view/attribute", - "query": { - "startkey": [":corpus", ":attribute", ":value"], - "endkey": [":corpus", ":attribute", ":value", {}], - "reduce": "false" - } - }, { - "from": "v1/actor/", - "to": "_list/actorsV1/user", - "query": { - "group": "true" - } - }, { - "from": "v1/actor/:user", - "to": "_list/actorV1/user", - "query": { - "key": [":user"], - "reduce": "false" - } - }, { - "from": "v1/viewpoint/:viewpoint/", - "to": "_list/viewpointV1/viewpointV1", - "query": { - "key": [":viewpoint"] - } - }, { - "from": "v1/viewpoint/:viewpoint/topic/:topic", - "to": "_list/topicV1/viewpointV1", - "query": { - "key": [":viewpoint",":topic"] - } - }, { - "from": "v1/entity/:corpus/:item/:coordinates", - "to": "_list/fragmentV1/fragmentV1", - "query": { - "key": [":item", ":coordinates"] - } - }, { - "from": "v1/entity/:corpus/:item", - "to": "_show/itemV1/:item" - }, { - "from": "v1/entity/:corpus/", - "to": "_list/corpusV1/corpusV1", - "query": { - "key": [":corpus"] - } - }, { - "from": ":object/:resource", - "to": "../../:object/:resource" - } -] +[ + { + "to": "../../_changes", + "from": "events", + "query": { + "filter": "argos/events", + "feed": "eventsource" + } + }, + { + "from": "item/", + "to": "_view/resource", + "query": { + "key": [":resource"] + } + }, { + "from": "empty", + "to": "_list/empty/empty", + "query": { + "include_docs": "true" + } + }, { + "from": "", + "to": "_list/index/stats", + "query": { + "group": "true" + }, + "method": "GET" + }, { + "from": "", + "to": "../../" + }, { + "from": "_users", + "to": "../../../_users" + }, { + "from": ":object", + "to": "../../:object" + }, { + "from": "user/:user", + "to": "_view/user", + "query": { + "key": [":user"], + "reduce": "false" + } + }, { + "from": "feed/:corpic", + "to": "_list/feed/modified", + "query": { + "include_docs": "true", + "startkey": [":corpic"], + "endkey": [":corpic",{}] + } + }, { + "from": "corpus/:corpus", + "to": "_view/corpus", + "query": { + "startkey": [":corpus"], + "endkey": [":corpus", {}] + } + }, { + "from": "item/:corpus/:item", + "to": "_view/corpus", + "query": { + "startkey": [":corpus", ":item"], + "endkey": [":corpus", ":item", {}] + } + }, { + "from": "item/:corpus/:item/:resource", + "to": "../../:item/:resource" + }, { + "from": "viewpoint/:viewpoint", + "to": "_view/viewpoint", + "query": { + "startkey": [":viewpoint"], + "endkey": [":viewpoint", {}] + } + }, { + "from": "topic/:viewpoint/:topic", + "to": "_view/viewpoint", + "query": { + "startkey": [":viewpoint", ":topic"], + "endkey": [":viewpoint", ":topic", {}] + } + }, { + "from": "attribute/:corpus/", + "to": "_view/attribute", + "query": { + "startkey": [":corpus"], + "endkey": [":corpus", {}], + "group_level": "2" + } + }, { + "from": "attribute/:corpus/:attribute/", + "to": "_view/attribute", + "query": { + "startkey": [":corpus", ":attribute"], + "endkey": [":corpus", ":attribute", {}], + "group_level": "3" + } + }, { + "from": "attribute/:corpus/:attribute/:value", + "to": "_view/attribute", + "query": { + "startkey": [":corpus", ":attribute", ":value"], + "endkey": [":corpus", ":attribute", ":value", {}], + "reduce": "false" + } + }, { + "from": "v1/actor/", + "to": "_list/actorsV1/user", + "query": { + "group": "true" + } + }, { + "from": "v1/actor/:user", + "to": "_list/actorV1/user", + "query": { + "key": [":user"], + "reduce": "false" + } + }, { + "from": "v1/viewpoint/:viewpoint/", + "to": "_list/viewpointV1/viewpointV1", + "query": { + "key": [":viewpoint"] + } + }, { + "from": "v1/viewpoint/:viewpoint/topic/:topic", + "to": "_list/topicV1/viewpointV1", + "query": { + "key": [":viewpoint",":topic"] + } + }, { + "from": "v1/entity/:corpus/:item/:coordinates", + "to": "_list/fragmentV1/fragmentV1", + "query": { + "key": [":item", ":coordinates"] + } + }, { + "from": "v1/entity/:corpus/:item", + "to": "_show/itemV1/:item" + }, { + "from": "v1/entity/:corpus/", + "to": "_list/corpusV1/corpusV1", + "query": { + "key": [":corpus"] + } + }, { + "from": ":object/:resource", + "to": "../../:object/:resource" + } +] diff --git a/app/views/modified/map.js b/app/views/modified/map.js index b678267..8991450 100644 --- a/app/views/modified/map.js +++ b/app/views/modified/map.js @@ -1,5 +1,10 @@ function (doc) { if (doc.item_corpus && doc.record.modified) { emit([doc.item_corpus, doc.record.modified]); + if(doc.topics && doc.record.modified){ + for (var t in doc.topics){ + emit([t, doc.record.modified]); + } + } } -} +} \ No newline at end of file