Skip to content

Commit

Permalink
New update format
Browse files Browse the repository at this point in the history
  • Loading branch information
Neamar committed Dec 10, 2014
1 parent 0c25e47 commit 34a5784
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 39 deletions.
2 changes: 1 addition & 1 deletion lib/test-server/mocks/get-company.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
"user_count": 13,
"subcompany_count": 1,
"documents_per_update": 5000,
"last_update": "2014-12-10T14:58:29.891Z"
"last_update": "2014-12-10T15:05:32.750Z"
}
8 changes: 4 additions & 4 deletions lib/test-server/mocks/get-document_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
},
"document_count": 1,
"updated": "2014-12-10T14:59:34.187Z"
"updated": "2014-12-10T15:09:14.681Z"
},
{
"_type": "DocumentType",
Expand Down Expand Up @@ -331,8 +331,8 @@
"description": "An event, from a calendar for instance.",
"projections": {
"title": "{ \"name\": \"{{attr \"name\"}}\" }",
"full": "{\n \"eventName\": \"{{attr 'name'}}\",\n \"startDate\": \"{{dateRfc metadata.startDate}}\",\n \"endDate\": \"{{dateRfc metadata.endDate}}\",\n \"description\": \"{{attr 'description'}}\",\n \"organizer\": \"{{#if name}}{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}{{/if}} <{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}>\",\n \"attendee\": [\n {{#list metadata.attendee}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"location\" : \"{{#if metadata.location}}{{attr 'location'}}{{/if}}\"\n}\n",
"snippet": "{\n \"eventName\": \"{{attr 'name'}}\",\n \"startDate\": \"{{dateRfc metadata.startDate}}\",\n \"endDate\": \"{{dateRfc metadata.endDate}}\",\n \"description\": \"{{attr 'description'}}\",\n \"organizer\": \"{{#if name}}{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}{{/if}} <{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}>\",\n \"attendee\": [\n {{#list metadata.attendee}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"location\" : \"{{#if metadata.location}}{{attr 'location'}}{{/if}}\"\n}\n"
"full": "{\n \"eventName\": \"{{attr 'name'}}\",\n \"startDate\": \"{{dateRfc metadata.startDate}}\",\n \"endDate\": \"{{dateRfc metadata.endDate}}\",\n \"description\": \"{{#toBr}}{{attr 'description'}}{{/toBr}}\",\n \"organizer\": \"{{#if name}}{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}{{/if}} <{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}>\",\n \"attendee\": [\n {{#list metadata.attendee}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"location\" : \"{{#if metadata.location}}{{attr 'location'}}{{/if}}\"\n}\n",
"snippet": "{\n \"eventName\": \"{{attr 'name'}}\",\n \"startDate\": \"{{dateRfc metadata.startDate}}\",\n \"endDate\": \"{{dateRfc metadata.endDate}}\",\n \"description\": \"{{#toBr}}{{attr 'description'}}{{/toBr}}\",\n \"organizer\": \"{{#if name}}{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}{{/if}} <{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}>\",\n \"attendee\": [\n {{#list metadata.attendee}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{mail}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"location\" : \"{{#if metadata.location}}{{attr 'location'}}{{/if}}\"\n}\n"
},
"es_mapping": {
"properties": {
Expand Down Expand Up @@ -398,7 +398,7 @@
"description": "An email thread or conversation",
"projections": {
"title": "{ \"subject\": \"{{attr \"subject\"}}\" }",
"full": "{\n \"subject\": \"{{attr 'subject'}}\",\n \"date\": \"{{dateRfc metadata.date}}\",\n \"participants\": [\n {{#list metadata.participants}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"labels\": [ {{#list metadata.labels}}\"{{#escapeQuotes .}}{{.}}{{/escapeQuotes}}\"{{/list}} ],\n \"messages\": [\n {{#reverseList metadata.messages sibling=data.messages}}\n {\n \"subject\": \"{{#escapeQuotes .}}{{subject}}{{/escapeQuotes}}\",\n {{#if date}}\n \"date\": \"{{dateRfc date}}\",\n {{/if}}\n \"from\": [\n {{#list from}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"to\": [\n {{#list to}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"html\":\n {{#contextLookup ../data.messages reverse=true field=@index}}\n {{#if looked.html}}\n \"{{htmlHighlighter looked.html}}\"\n {{else}}\n \"{{textHighlighter text}}\"\n {{/if}}\n {{/contextLookup}}\n }\n {{/reverseList}}\n ],\n \"attachmentCount\": {{safeInt metadata.attachmentsCount}},\n \"messagesCount\": {{safeInt metadata.messages.length}},\n \"participantsCount\": {{safeInt metadata.participants.length}},\n \"singleEmail\":\n {{#if metadata.messages.[1]}}\n false\n {{else}}\n true\n {{/if}}\n\n}\n",
"full": "{\n \"subject\": \"{{attr 'subject'}}\",\n \"date\": \"{{dateRfc metadata.date}}\",\n \"participants\": [\n {{#list metadata.participants}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"labels\": [ {{#list metadata.labels}}\"{{#escapeQuotes .}}{{.}}{{/escapeQuotes}}\"{{/list}} ],\n \"messages\": [\n {{#reverseList metadata.messages sibling=data.messages}}\n {\n \"subject\": \"{{#escapeQuotes .}}{{subject}}{{/escapeQuotes}}\",\n {{#if date}}\n \"date\": \"{{dateRfc date}}\",\n {{/if}}\n \"from\": [\n {{#list from}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"to\": [\n {{#list to}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{#escapeQuotes .}}{{address}}{{/escapeQuotes}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"html\":\n {{#contextLookup ../data.messages reverse=true field=@index}}\n {{#if looked.html}}\n \"{{htmlHighlighter looked.html}}\"\n {{else}}\n \"{{#toBr}}{{textHighlighter text}}{{/toBr}}\"\n {{/if}}\n {{/contextLookup}}\n }\n {{/reverseList}}\n ],\n \"attachmentCount\": {{safeInt metadata.attachmentsCount}},\n \"messagesCount\": {{safeInt metadata.messages.length}},\n \"participantsCount\": {{safeInt metadata.participants.length}},\n \"singleEmail\":\n {{#if metadata.messages.[1]}}\n false\n {{else}}\n true\n {{/if}}\n\n}\n",
"snippet": "{\n \"subject\": \"{{attr 'subject'}}\",\n \"date\": \"{{dateRfc metadata.date}}\",\n \"participants\": [\n {{#list metadata.participants l=3}}\n {\n {{#if name}}\"name\": \"{{#escapeQuotes .}}{{name}}{{/escapeQuotes}}\",{{/if}}\n \"address\": \"{{hideDomainEmail address}}\",\n \"highlight\": {{isHighlight .}}\n }\n {{/list}}\n ],\n \"labels\": [ {{#list metadata.labels}}\"{{.}}\"{{/list}} ],\n \"snippet\":\n {{#contextLookup highlight field='messages.text'}}\n {{#if looked}}\n \"{{#escapeQuotes .}}{{{looked}}}{{/escapeQuotes}}\"\n {{else}}\n {{#if highlight.text}}\n \"{{#escapeQuotes .}}{{{highlight.text}}}{{/escapeQuotes}}\"\n {{else}}\n {{#last metadata.messages}}\n \"{{#escapeQuotes .}}{{#shorten .}}{{text}}{{/shorten}}{{/escapeQuotes}}\"\n {{else}}\n \"\"\n {{/last}}\n {{/if}}\n {{/if}}\n {{/contextLookup}},\n \"attachmentCount\": {{safeInt metadata.attachmentsCount}},\n \"participantsCount\": {{safeInt metadata.participants.length}},\n \"messagesCount\": {{safeInt metadata.messages.length}},\n \"singleEmail\":\n {{#if metadata.messages.[1]}}\n false\n {{else}}\n true\n {{/if}}\n}\n"
},
"es_mapping": {
Expand Down
8 changes: 4 additions & 4 deletions lib/test-server/mocks/get-documents-id-raw.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"_type": "Document",
"id": "54885fd6caef098362955f54",
"id": "5488621a42d43c8b0b302733",
"identifier": "the \"unique\" document identifier (éüà)",
"creation_date": "2014-12-10T14:59:34.132Z",
"modification_date": "2014-12-10T14:59:34.132Z",
"creation_date": "2014-12-10T15:09:14.626Z",
"modification_date": "2014-12-10T15:09:14.626Z",
"provider": {
"_type": "AccessToken",
"id": "54885c04e782a7946271cf00",
Expand Down Expand Up @@ -42,7 +42,7 @@
}
},
"actions": {},
"document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54",
"document_url": "https://api-staging.anyfetch.com/documents/5488621a42d43c8b0b302733",
"projection_type": "raw",
"data": {
"foo": "some_string"
Expand Down
8 changes: 4 additions & 4 deletions lib/test-server/mocks/get-documents-id.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"_type": "Document",
"id": "54885fd6caef098362955f54",
"id": "5488621a42d43c8b0b302733",
"identifier": "the \"unique\" document identifier (éüà)",
"creation_date": "2014-12-10T14:59:34.132Z",
"modification_date": "2014-12-10T14:59:34.132Z",
"creation_date": "2014-12-10T15:09:14.626Z",
"modification_date": "2014-12-10T15:09:14.626Z",
"provider": {
"_type": "AccessToken",
"id": "54885c04e782a7946271cf00",
Expand All @@ -22,7 +22,7 @@
}
},
"actions": {},
"document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54",
"document_url": "https://api-staging.anyfetch.com/documents/5488621a42d43c8b0b302733",
"projection_type": "full",
"data": {
"title": "Document title",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"_type": "Document",
"id": "54885fd6caef098362955f54",
"id": "5488621a42d43c8b0b302733",
"identifier": "the \"unique\" document identifier (éüà)",
"creation_date": "2014-12-10T14:59:34.132Z",
"modification_date": "2014-12-10T14:59:34.132Z",
"creation_date": "2014-12-10T15:09:14.626Z",
"modification_date": "2014-12-10T15:09:14.626Z",
"provider": {
"_type": "AccessToken",
"id": "54885c04e782a7946271cf00",
Expand All @@ -22,7 +22,7 @@
}
},
"actions": {},
"document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54",
"document_url": "https://api-staging.anyfetch.com/documents/5488621a42d43c8b0b302733",
"projection_type": "full",
"data": {
"title": "Document title",
Expand Down
8 changes: 4 additions & 4 deletions lib/test-server/mocks/get-documents.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
"data": [
{
"_type": "Document",
"id": "54885fd6caef098362955f54",
"id": "5488621a42d43c8b0b302733",
"identifier": "the \"unique\" document identifier (éüà)",
"creation_date": "2014-12-10T14:59:34.132Z",
"modification_date": "2014-12-10T14:59:34.132Z",
"creation_date": "2014-12-10T15:09:14.626Z",
"modification_date": "2014-12-10T15:09:14.626Z",
"provider": {
"_type": "AccessToken",
"id": "54885c04e782a7946271cf00",
Expand All @@ -52,7 +52,7 @@
}
},
"actions": {},
"document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54",
"document_url": "https://api-staging.anyfetch.com/documents/5488621a42d43c8b0b302733",
"projection_type": "snippet",
"data": {
"title": "Document title",
Expand Down
2 changes: 1 addition & 1 deletion lib/test-server/mocks/get-index.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"update_url": "https://api-staging.anyfetch.com/company/update",
"reset_url": "https://api-staging.anyfetch.com/company/reset",
"token_url": "https://api-staging.anyfetch.com/token",
"server_time": "2014-12-10T14:59:34.825Z"
"server_time": "2014-12-10T15:09:15.433Z"
}
2 changes: 1 addition & 1 deletion lib/test-server/mocks/get-providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"account_name": "",
"current": true,
"document_count": 1,
"updated": "2014-12-10T14:59:34.187Z",
"updated": "2014-12-10T15:09:14.681Z",
"providing": true
}
]
4 changes: 2 additions & 2 deletions lib/test-server/mocks/get-subcompanies-id.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_type": "Company",
"id": "54885fd6e782a7946271d03f",
"id": "5488621ae181a1a20b5aa579",
"name": "the_fake_subcompany",
"hydraters": [
"https://deduplicator-staging.anyfetch.com/hydrate",
Expand All @@ -21,6 +21,6 @@
"user_count": 1,
"subcompany_count": 0,
"documents_per_update": 5000,
"last_update": "2014-12-10T14:59:34.390Z",
"last_update": "2014-12-10T15:09:14.862Z",
"childs": []
}
4 changes: 2 additions & 2 deletions lib/test-server/mocks/get-subcompanies.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"_type": "Company",
"id": "54885fd6e782a7946271d03f",
"id": "5488621ae181a1a20b5aa579",
"name": "the_fake_subcompany",
"hydraters": [
"https://deduplicator-staging.anyfetch.com/hydrate",
Expand All @@ -22,7 +22,7 @@
"user_count": 1,
"subcompany_count": 0,
"documents_per_update": 5000,
"last_update": "2014-12-10T14:59:34.390Z",
"last_update": "2014-12-10T15:09:14.862Z",
"childs": []
}
]
8 changes: 5 additions & 3 deletions lib/test-server/mocks/post-company-update.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"53234698c8318cc5d100004f": 202,
"5320a682c8318cba94000040": 202,
"5320a6abc8318cc5d1000049": 429
"52f0bb24c8318c2d65000036": {},
"5460f239fc0973bc40c19b23": {},
"5409823bee7d24ef49b598fa": {},
"542d1639ecc49603190b329b": {},
"542d1758ecc49603190b32a7": {}
}
8 changes: 4 additions & 4 deletions lib/test-server/mocks/post-documents.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"_type": "Document",
"id": "54885fd6caef098362955f54",
"id": "5488621a42d43c8b0b302733",
"identifier": "the \"unique\" document identifier (éüà)",
"creation_date": "2014-12-10T14:59:34.132Z",
"modification_date": "2014-12-10T14:59:34.132Z",
"creation_date": "2014-12-10T15:09:14.626Z",
"modification_date": "2014-12-10T15:09:14.626Z",
"provider": {
"_type": "AccessToken",
"id": "54885c04e782a7946271cf00",
Expand Down Expand Up @@ -42,7 +42,7 @@
}
},
"actions": {},
"document_url": "https://api-staging.anyfetch.com/documents/54885fd6caef098362955f54",
"document_url": "https://api-staging.anyfetch.com/documents/5488621a42d43c8b0b302733",
"projection_type": "raw",
"data": {
"foo": "some_string"
Expand Down
4 changes: 2 additions & 2 deletions lib/test-server/mocks/post-subcompanies.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_type": "Company",
"id": "54885fd6e782a7946271d03f",
"id": "5488621ae181a1a20b5aa579",
"name": "the_fake_subcompany",
"hydraters": [
"https://deduplicator-staging.anyfetch.com/hydrate",
Expand All @@ -21,5 +21,5 @@
"user_count": 1,
"subcompany_count": 0,
"documents_per_update": 5000,
"last_update": "2014-12-10T14:59:34.390Z"
"last_update": "2014-12-10T15:09:14.862Z"
}
6 changes: 3 additions & 3 deletions lib/test-server/mocks/post-users.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"_type": "User",
"id": "54885fd6e782a7946271d03e",
"email": "thechuck329@norris.com",
"id": "5488621a42d43c8b0b302732",
"email": "thechuck562@norris.com",
"name": "Chuck Norris",
"is_admin": true,
"user_url": "https://api-staging.anyfetch.com/users/54885fd6e782a7946271d03e"
"user_url": "https://api-staging.anyfetch.com/users/5488621a42d43c8b0b302732"
}

0 comments on commit 34a5784

Please sign in to comment.