Skip to content

Get notified on changes related to a corpus #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: v4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions app/lists/feed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function (head, req) {
start({
'headers': {
'Content-Type': 'text/xml'
}
});
uri = req.query.app;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attention la variable n'est pas déclarée. Même si ça fonctionne, ça peut causer des effets de bord.

send('<rss><channel><title>' + req.query.startkey + '</title><link>');
send(uri);
send('</link><description>Created or updated items.</description>');
while(row = getRow()){
var i=0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il est souvent conseillé de mettre un espace de chaque côté du =.

var topic="";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il est souvent conseillé de mettre un espace de chaque côté du =.

for (var t in row.doc.topics){
topic+=t+", ";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il est souvent conseillé de mettre un espace de chaque côté du += et du +.

}
send(''.concat(
'<item>',
'<title>' + row.doc.item_name + '</title>',
'<description> Lieu : ' + row.doc.spatial + ' Créé le : ' + row.doc.created + ' Catégorie(s) : ' + topic + '</description>',
'<link>' + uri + '/item/' + row.doc.item_corpus + '/' + row.id + '</link>',
'<guid>Modifié le : ' + row.doc.record.modified + '</guid>'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Même si ça devrait marcher, c'est un peu bizarre de mettre une phrase (en français qui plus est ) comme identifiant.

Par contre, vous avez raison @sarah-ngn, le moment précis de la modification est un bon candidat pour identifier l'évènement.

'</item>'
));
}
send('</channel></rss>');
}
296 changes: 152 additions & 144 deletions app/rewrites.json
Original file line number Diff line number Diff line change
@@ -1,144 +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": "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"
}
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attention, vous avez dû modifier quelque chose dans l'indendation (peut-être est-ce à cause de l'éditeur que vous utilisez). Du coup, ça rend difficile de voir précisément ce que vous vouliez réellement modifier.

En plus des problèmes de lecture du diff ça rend toutes les autres opérations de Git moins efficaces (merge, revert, blame, bisect...).

[
{
"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"
}
]
10 changes: 10 additions & 0 deletions app/views/modified/map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function (doc) {
if (doc.item_corpus && doc.record.modified) {
emit([doc.item_corpus, doc.record.modified]);
if(doc.topics && doc.record.modified){
Copy link
Member

@benel benel Jun 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il est conseillé de mettre un espace après le if ainsi que avant l'accolade.

for (var t in doc.topics){
emit([t, doc.record.modified]);
}
}
}
}