mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Merge branch 'master' into PHRAS-3598-webhook-emit-improvement
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
# How to update the documentation in swaggerhub :
|
# How to update the documentation in swaggerhub :
|
||||||
|
|
||||||
The doc is composed of 3 files
|
The doc is composed of many files
|
||||||
- `api.yaml` (main file)
|
- `api.yaml` (main file)
|
||||||
- `responses.yaml`
|
|
||||||
- `schemas.yaml`
|
- `schemas.yaml`
|
||||||
|
- `common.yaml`
|
||||||
|
- `record.yaml`
|
||||||
|
- ...
|
||||||
|
|
||||||
to update in swaggerhub (single file) :
|
to update in swaggerhub (single file) :
|
||||||
- install swagger-cli
|
- install swagger-cli
|
||||||
|
@@ -143,7 +143,291 @@ paths:
|
|||||||
|
|
||||||
To get smaller / faster response, facets and stories children are ommited by default.
|
To get smaller / faster response, facets and stories children are ommited by default.
|
||||||
|
|
||||||
Add _include_ parameters to get those if needed.
|
Add __include__ parameters to get those if needed.
|
||||||
|
|
||||||
|
each __include__ parameter maps a matching sub-object in the response data.
|
||||||
|
|
||||||
|
Since records and stories results are dispatched into 2 separated arrays `response.results.records[]` or
|
||||||
|
`response.results.stories[]` (depending on the `search_type=0|1` parameter), one must use the correct __include(s)__
|
||||||
|
that match the result structure.
|
||||||
|
|
||||||
|
### facets
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"response": {
|
||||||
|
"facets": [
|
||||||
|
{
|
||||||
|
"name": "_base",
|
||||||
|
"field": "database",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"value": "Base Beta Version 3.0",
|
||||||
|
"raw_value": "Base Beta Version 3.0",
|
||||||
|
"count": 2902,
|
||||||
|
"query": "database:\"Base Beta Version 3.0\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "Base test demo support",
|
||||||
|
"raw_value": "Base test demo support",
|
||||||
|
"count": 1120,
|
||||||
|
"query": "database:\"Base test demo support\""
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Categorie",
|
||||||
|
"field": "field.Categorie",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"value": "USA Août 2018",
|
||||||
|
"raw_value": "USA Août 2018",
|
||||||
|
"count": 268,
|
||||||
|
"query": "field.Categorie=\"USA Août 2018\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "Voyage Bahamas",
|
||||||
|
"raw_value": "Voyage Bahamas",
|
||||||
|
"count": 83,
|
||||||
|
"query": "field.Categorie=\"Voyage Bahamas\""
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "MotsCles",
|
||||||
|
"field": "field.MotsCles",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"value": "USA",
|
||||||
|
"raw_value": "USA",
|
||||||
|
"count": 914,
|
||||||
|
"query": "field.MotsCles=\"USA\""
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### suggestions
|
||||||
|
flatened facets
|
||||||
|
```
|
||||||
|
"response": {
|
||||||
|
"suggestions": [
|
||||||
|
{
|
||||||
|
"suggestion": "Demo Online",
|
||||||
|
"query": "collection:\"Demo Online\"",
|
||||||
|
"hits": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"suggestion": "Voyage Bahamas",
|
||||||
|
"query": "field.Categorie=\"Voyage Bahamas\"",
|
||||||
|
"hits": 83
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### results.records.subdefs ; results.stories.subdefs
|
||||||
|
```
|
||||||
|
"response": {
|
||||||
|
"results": {
|
||||||
|
"records": [
|
||||||
|
{
|
||||||
|
"subdefs": [
|
||||||
|
{
|
||||||
|
"name": "document",
|
||||||
|
"permalink": {
|
||||||
|
"created_on": "2021-09-23T16:04:25+02:00",
|
||||||
|
"id": 12539,
|
||||||
|
"is_activated": false,
|
||||||
|
"label": "TX9329_23",
|
||||||
|
"updated_on": "2021-09-23T16:05:34+02:00",
|
||||||
|
"page_url": "https://demo.alchemyasp.com/permalink/v1/43/82227/document/?token=xxx",
|
||||||
|
"download_url": "https://demo.alchemyasp.com/permalink/v1/43/82227/document/TX9329_23.tif?token=xxx&download=1",
|
||||||
|
"url": "https://demo.alchemyasp.com/permalink/v1/43/82227/document/TX9329_23.tif?token=xxx"
|
||||||
|
},
|
||||||
|
"height": 3181,
|
||||||
|
"width": 3181,
|
||||||
|
"filesize": 30439108,
|
||||||
|
"devices": [
|
||||||
|
"all"
|
||||||
|
],
|
||||||
|
"player_type": "UNKNOWN",
|
||||||
|
"mime_type": "image/tiff",
|
||||||
|
"substituted": false,
|
||||||
|
"created_on": "2021-09-23T16:04:25+02:00",
|
||||||
|
"updated_on": "2021-09-23T16:04:25+02:00",
|
||||||
|
"url": "https://demo.alchemyasp.com/medias/xxxx.yyyy.zzzz",
|
||||||
|
"url_ttl": 7200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "preview",
|
||||||
|
"permalink": {
|
||||||
|
"created_on": "2021-09-23T16:04:46+02:00",
|
||||||
|
"id": 12541,
|
||||||
|
"is_activated": false,
|
||||||
|
"label": "TX9329_23",
|
||||||
|
"updated_on": "2021-09-23T16:05:34+02:00",
|
||||||
|
"page_url": "https://demo.alchemyasp.com/permalink/v1/43/82227/preview/?token=xxx",
|
||||||
|
"download_url": "https://demo.alchemyasp.com/permalink/v1/43/82227/preview/TX9329_23.jpg?token=xxx&download=1",
|
||||||
|
"url": "https://demo.alchemyasp.com/permalink/v1/43/82227/preview/TX9329_23.jpg?token=xxx"
|
||||||
|
},
|
||||||
|
"height": 800,
|
||||||
|
"width": 800,
|
||||||
|
"filesize": 112906,
|
||||||
|
"devices": [
|
||||||
|
"screen"
|
||||||
|
],
|
||||||
|
"player_type": "IMAGE",
|
||||||
|
"mime_type": "image/jpeg",
|
||||||
|
"substituted": false,
|
||||||
|
"created_on": "2021-09-23T16:04:46+02:00",
|
||||||
|
"updated_on": "2021-09-23T16:04:46+02:00",
|
||||||
|
"url": "https://demo.alchemyasp.com/medias/xxxx.yyyy.zzzz",
|
||||||
|
"url_ttl": 7200
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### results.records.caption ; results.stories.caption
|
||||||
|
simple metadata
|
||||||
|
```
|
||||||
|
"response": {
|
||||||
|
"results": {
|
||||||
|
"records": [
|
||||||
|
{
|
||||||
|
"caption": [
|
||||||
|
{
|
||||||
|
"meta_structure_id": 12,
|
||||||
|
"name": "Titre",
|
||||||
|
"value": "New demo pictures - Oceans"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"meta_structure_id": 4,
|
||||||
|
"name": "MotsCles",
|
||||||
|
"value": "Bahamas ; mer ; Nassau ; plage ; nuage ; turquoise ; ocean ; sea ; Atlantic"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### results.records.metadata ; results.stories.metadata
|
||||||
|
complete metadata with labels
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"response": {
|
||||||
|
"results": {
|
||||||
|
"records": [
|
||||||
|
{
|
||||||
|
"metadata": [
|
||||||
|
{
|
||||||
|
"meta_structure_id": 12,
|
||||||
|
"name": "Titre",
|
||||||
|
"labels": {
|
||||||
|
"fr": "Titre principal",
|
||||||
|
"en": "Headline title",
|
||||||
|
"de": "Titre",
|
||||||
|
"nl": "Titre"
|
||||||
|
},
|
||||||
|
"meta_id": 346744,
|
||||||
|
"value": "New demo pictures - Oceans"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"meta_structure_id": 4,
|
||||||
|
"name": "MotsCles",
|
||||||
|
"labels": {
|
||||||
|
"fr": "Mots Clés",
|
||||||
|
"en": "Keywords",
|
||||||
|
"de": "MotsCles",
|
||||||
|
"nl": "MotsCles"
|
||||||
|
},
|
||||||
|
"meta_id": 346745,
|
||||||
|
"value": "Bahamas"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### results.records.status ; results.stories.status
|
||||||
|
```
|
||||||
|
"response": {
|
||||||
|
"results": {
|
||||||
|
"records": [
|
||||||
|
{
|
||||||
|
"status": [
|
||||||
|
{
|
||||||
|
"bit": 8,
|
||||||
|
"state": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bit": 9,
|
||||||
|
"state": true
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### results.records.thumbnail ; results.stories.thumbnail
|
||||||
|
always included
|
||||||
|
|
||||||
|
### results.records.technical_informations
|
||||||
|
always included
|
||||||
|
|
||||||
|
_nb:_ since stories are not related to a document, there is no technical_informations for stories.
|
||||||
|
|
||||||
|
### results.records.children
|
||||||
|
In story search mode, will publish a children[] array for each result. See _story_children_limit_ parameter.
|
||||||
|
|
||||||
|
children is an array of records, with same structure as a result record.
|
||||||
|
```
|
||||||
|
"response": {
|
||||||
|
"results": {
|
||||||
|
"stories": [
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
// record structure
|
||||||
|
},
|
||||||
|
...
|
||||||
|
],
|
||||||
|
...
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
### results.records.children.thumbnail
|
||||||
|
### results.records.children.technical_informations
|
||||||
|
### results.records.children.subdefs
|
||||||
|
### results.records.children.caption
|
||||||
|
### results.records.children.metadata
|
||||||
|
### results.records.children.status
|
||||||
|
see result.records.* includes.
|
||||||
parameters:
|
parameters:
|
||||||
- name: query
|
- name: query
|
||||||
in: query
|
in: query
|
||||||
@@ -378,6 +662,13 @@ paths:
|
|||||||
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
story_id:
|
||||||
|
type: integer
|
||||||
|
example: 1400
|
||||||
|
cover_record_id:
|
||||||
|
type: integer
|
||||||
|
description: id of the record chosen as "cover" (or null)
|
||||||
|
example: 55
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
default: null
|
default: null
|
||||||
@@ -511,6 +802,9 @@ paths:
|
|||||||
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
record_id:
|
||||||
|
type: integer
|
||||||
|
example: 34
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
example: image/jpeg
|
example: image/jpeg
|
||||||
@@ -647,6 +941,9 @@ paths:
|
|||||||
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
record_id:
|
||||||
|
type: integer
|
||||||
|
example: 34
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
example: image/jpeg
|
example: image/jpeg
|
||||||
@@ -850,8 +1147,10 @@ paths:
|
|||||||
properties:
|
properties:
|
||||||
record_id:
|
record_id:
|
||||||
type: integer
|
type: integer
|
||||||
|
example: 555
|
||||||
collection_id:
|
collection_id:
|
||||||
type: integer
|
type: integer
|
||||||
|
example: 123
|
||||||
uuid:
|
uuid:
|
||||||
type: string
|
type: string
|
||||||
example: dcee40ea-ee26-4d8b-b0c2-d61305b03bc0
|
example: dcee40ea-ee26-4d8b-b0c2-d61305b03bc0
|
||||||
@@ -869,6 +1168,10 @@ paths:
|
|||||||
type:
|
type:
|
||||||
type: string
|
type: string
|
||||||
example: image
|
example: image
|
||||||
|
cover_record_id:
|
||||||
|
type: integer
|
||||||
|
description: 'for a story, id of the record chosen as "cover" (or null)'
|
||||||
|
example: null
|
||||||
created_on:
|
created_on:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
@@ -879,6 +1182,7 @@ paths:
|
|||||||
example: '2021-01-01 15:30:00'
|
example: '2021-01-01 15:30:00'
|
||||||
coll_id:
|
coll_id:
|
||||||
type: integer
|
type: integer
|
||||||
|
example: '123'
|
||||||
collection_name:
|
collection_name:
|
||||||
type: string
|
type: string
|
||||||
example: collection de test
|
example: collection de test
|
||||||
@@ -1196,6 +1500,9 @@ paths:
|
|||||||
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
record_id:
|
||||||
|
type: integer
|
||||||
|
example: 34
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
example: image/jpeg
|
example: image/jpeg
|
||||||
@@ -1364,6 +1671,9 @@ paths:
|
|||||||
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
record_id:
|
||||||
|
type: integer
|
||||||
|
example: 34
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
example: image/jpeg
|
example: image/jpeg
|
||||||
@@ -2053,6 +2363,9 @@ paths:
|
|||||||
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
record_id:
|
||||||
|
type: integer
|
||||||
|
example: 34
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
example: image/jpeg
|
example: image/jpeg
|
||||||
@@ -2409,6 +2722,13 @@ paths:
|
|||||||
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
story_id:
|
||||||
|
type: integer
|
||||||
|
example: 1400
|
||||||
|
cover_record_id:
|
||||||
|
type: integer
|
||||||
|
description: id of the record chosen as "cover" (or null)
|
||||||
|
example: 55
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
default: null
|
default: null
|
||||||
@@ -2542,6 +2862,9 @@ paths:
|
|||||||
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
record_id:
|
||||||
|
type: integer
|
||||||
|
example: 34
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
example: image/jpeg
|
example: image/jpeg
|
||||||
@@ -2710,6 +3033,13 @@ paths:
|
|||||||
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
story_id:
|
||||||
|
type: integer
|
||||||
|
example: 1400
|
||||||
|
cover_record_id:
|
||||||
|
type: integer
|
||||||
|
description: id of the record chosen as "cover" (or null)
|
||||||
|
example: 55
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
default: null
|
default: null
|
||||||
@@ -2843,6 +3173,9 @@ paths:
|
|||||||
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
example: 5b079f33-0851-4aec-a978-b7f8d7204e5a
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
record_id:
|
||||||
|
type: integer
|
||||||
|
example: 34
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
example: image/jpeg
|
example: image/jpeg
|
||||||
@@ -3000,7 +3333,7 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- story
|
- story
|
||||||
summary: Returns uri of each record (child) contained in the story ; Optional pagination
|
summary: Returns uri of each record (child) contained in the story ; Optional pagination
|
||||||
description: Returns children of a story
|
description: Returns children of a story.
|
||||||
operationId: getStoryChildren
|
operationId: getStoryChildren
|
||||||
parameters:
|
parameters:
|
||||||
- name: sbas_id
|
- name: sbas_id
|
||||||
|
@@ -175,7 +175,291 @@ paths:
|
|||||||
|
|
||||||
To get smaller / faster response, facets and stories children are ommited by default.
|
To get smaller / faster response, facets and stories children are ommited by default.
|
||||||
|
|
||||||
Add _include_ parameters to get those if needed.
|
Add __include__ parameters to get those if needed.
|
||||||
|
|
||||||
|
each __include__ parameter maps a matching sub-object in the response data.
|
||||||
|
|
||||||
|
Since records and stories results are dispatched into 2 separated arrays `response.results.records[]` or
|
||||||
|
`response.results.stories[]` (depending on the `search_type=0|1` parameter), one must use the correct __include(s)__
|
||||||
|
that match the result structure.
|
||||||
|
|
||||||
|
### facets
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"response": {
|
||||||
|
"facets": [
|
||||||
|
{
|
||||||
|
"name": "_base",
|
||||||
|
"field": "database",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"value": "Base Beta Version 3.0",
|
||||||
|
"raw_value": "Base Beta Version 3.0",
|
||||||
|
"count": 2902,
|
||||||
|
"query": "database:\"Base Beta Version 3.0\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "Base test demo support",
|
||||||
|
"raw_value": "Base test demo support",
|
||||||
|
"count": 1120,
|
||||||
|
"query": "database:\"Base test demo support\""
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Categorie",
|
||||||
|
"field": "field.Categorie",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"value": "USA Août 2018",
|
||||||
|
"raw_value": "USA Août 2018",
|
||||||
|
"count": 268,
|
||||||
|
"query": "field.Categorie=\"USA Août 2018\""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "Voyage Bahamas",
|
||||||
|
"raw_value": "Voyage Bahamas",
|
||||||
|
"count": 83,
|
||||||
|
"query": "field.Categorie=\"Voyage Bahamas\""
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "MotsCles",
|
||||||
|
"field": "field.MotsCles",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"value": "USA",
|
||||||
|
"raw_value": "USA",
|
||||||
|
"count": 914,
|
||||||
|
"query": "field.MotsCles=\"USA\""
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### suggestions
|
||||||
|
flatened facets
|
||||||
|
```
|
||||||
|
"response": {
|
||||||
|
"suggestions": [
|
||||||
|
{
|
||||||
|
"suggestion": "Demo Online",
|
||||||
|
"query": "collection:\"Demo Online\"",
|
||||||
|
"hits": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"suggestion": "Voyage Bahamas",
|
||||||
|
"query": "field.Categorie=\"Voyage Bahamas\"",
|
||||||
|
"hits": 83
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### results.records.subdefs ; results.stories.subdefs
|
||||||
|
```
|
||||||
|
"response": {
|
||||||
|
"results": {
|
||||||
|
"records": [
|
||||||
|
{
|
||||||
|
"subdefs": [
|
||||||
|
{
|
||||||
|
"name": "document",
|
||||||
|
"permalink": {
|
||||||
|
"created_on": "2021-09-23T16:04:25+02:00",
|
||||||
|
"id": 12539,
|
||||||
|
"is_activated": false,
|
||||||
|
"label": "TX9329_23",
|
||||||
|
"updated_on": "2021-09-23T16:05:34+02:00",
|
||||||
|
"page_url": "https://demo.alchemyasp.com/permalink/v1/43/82227/document/?token=xxx",
|
||||||
|
"download_url": "https://demo.alchemyasp.com/permalink/v1/43/82227/document/TX9329_23.tif?token=xxx&download=1",
|
||||||
|
"url": "https://demo.alchemyasp.com/permalink/v1/43/82227/document/TX9329_23.tif?token=xxx"
|
||||||
|
},
|
||||||
|
"height": 3181,
|
||||||
|
"width": 3181,
|
||||||
|
"filesize": 30439108,
|
||||||
|
"devices": [
|
||||||
|
"all"
|
||||||
|
],
|
||||||
|
"player_type": "UNKNOWN",
|
||||||
|
"mime_type": "image/tiff",
|
||||||
|
"substituted": false,
|
||||||
|
"created_on": "2021-09-23T16:04:25+02:00",
|
||||||
|
"updated_on": "2021-09-23T16:04:25+02:00",
|
||||||
|
"url": "https://demo.alchemyasp.com/medias/xxxx.yyyy.zzzz",
|
||||||
|
"url_ttl": 7200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "preview",
|
||||||
|
"permalink": {
|
||||||
|
"created_on": "2021-09-23T16:04:46+02:00",
|
||||||
|
"id": 12541,
|
||||||
|
"is_activated": false,
|
||||||
|
"label": "TX9329_23",
|
||||||
|
"updated_on": "2021-09-23T16:05:34+02:00",
|
||||||
|
"page_url": "https://demo.alchemyasp.com/permalink/v1/43/82227/preview/?token=xxx",
|
||||||
|
"download_url": "https://demo.alchemyasp.com/permalink/v1/43/82227/preview/TX9329_23.jpg?token=xxx&download=1",
|
||||||
|
"url": "https://demo.alchemyasp.com/permalink/v1/43/82227/preview/TX9329_23.jpg?token=xxx"
|
||||||
|
},
|
||||||
|
"height": 800,
|
||||||
|
"width": 800,
|
||||||
|
"filesize": 112906,
|
||||||
|
"devices": [
|
||||||
|
"screen"
|
||||||
|
],
|
||||||
|
"player_type": "IMAGE",
|
||||||
|
"mime_type": "image/jpeg",
|
||||||
|
"substituted": false,
|
||||||
|
"created_on": "2021-09-23T16:04:46+02:00",
|
||||||
|
"updated_on": "2021-09-23T16:04:46+02:00",
|
||||||
|
"url": "https://demo.alchemyasp.com/medias/xxxx.yyyy.zzzz",
|
||||||
|
"url_ttl": 7200
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### results.records.caption ; results.stories.caption
|
||||||
|
simple metadata
|
||||||
|
```
|
||||||
|
"response": {
|
||||||
|
"results": {
|
||||||
|
"records": [
|
||||||
|
{
|
||||||
|
"caption": [
|
||||||
|
{
|
||||||
|
"meta_structure_id": 12,
|
||||||
|
"name": "Titre",
|
||||||
|
"value": "New demo pictures - Oceans"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"meta_structure_id": 4,
|
||||||
|
"name": "MotsCles",
|
||||||
|
"value": "Bahamas ; mer ; Nassau ; plage ; nuage ; turquoise ; ocean ; sea ; Atlantic"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### results.records.metadata ; results.stories.metadata
|
||||||
|
complete metadata with labels
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"response": {
|
||||||
|
"results": {
|
||||||
|
"records": [
|
||||||
|
{
|
||||||
|
"metadata": [
|
||||||
|
{
|
||||||
|
"meta_structure_id": 12,
|
||||||
|
"name": "Titre",
|
||||||
|
"labels": {
|
||||||
|
"fr": "Titre principal",
|
||||||
|
"en": "Headline title",
|
||||||
|
"de": "Titre",
|
||||||
|
"nl": "Titre"
|
||||||
|
},
|
||||||
|
"meta_id": 346744,
|
||||||
|
"value": "New demo pictures - Oceans"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"meta_structure_id": 4,
|
||||||
|
"name": "MotsCles",
|
||||||
|
"labels": {
|
||||||
|
"fr": "Mots Clés",
|
||||||
|
"en": "Keywords",
|
||||||
|
"de": "MotsCles",
|
||||||
|
"nl": "MotsCles"
|
||||||
|
},
|
||||||
|
"meta_id": 346745,
|
||||||
|
"value": "Bahamas"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### results.records.status ; results.stories.status
|
||||||
|
```
|
||||||
|
"response": {
|
||||||
|
"results": {
|
||||||
|
"records": [
|
||||||
|
{
|
||||||
|
"status": [
|
||||||
|
{
|
||||||
|
"bit": 8,
|
||||||
|
"state": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bit": 9,
|
||||||
|
"state": true
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### results.records.thumbnail ; results.stories.thumbnail
|
||||||
|
always included
|
||||||
|
|
||||||
|
### results.records.technical_informations
|
||||||
|
always included
|
||||||
|
|
||||||
|
_nb:_ since stories are not related to a document, there is no technical_informations for stories.
|
||||||
|
|
||||||
|
### results.records.children
|
||||||
|
In story search mode, will publish a children[] array for each result. See _story_children_limit_ parameter.
|
||||||
|
|
||||||
|
children is an array of records, with same structure as a result record.
|
||||||
|
```
|
||||||
|
"response": {
|
||||||
|
"results": {
|
||||||
|
"stories": [
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
// record structure
|
||||||
|
},
|
||||||
|
...
|
||||||
|
],
|
||||||
|
...
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
### results.records.children.thumbnail
|
||||||
|
### results.records.children.technical_informations
|
||||||
|
### results.records.children.subdefs
|
||||||
|
### results.records.children.caption
|
||||||
|
### results.records.children.metadata
|
||||||
|
### results.records.children.status
|
||||||
|
see result.records.* includes.
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: '#/components/parameters/query'
|
- $ref: '#/components/parameters/query'
|
||||||
@@ -735,7 +1019,7 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- story
|
- story
|
||||||
summary: Returns uri of each record (child) contained in the story ; Optional pagination
|
summary: Returns uri of each record (child) contained in the story ; Optional pagination
|
||||||
description: Returns children of a story
|
description: Returns children of a story.
|
||||||
operationId: getStoryChildren
|
operationId: getStoryChildren
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: '#/components/parameters/sbas_id'
|
- $ref: '#/components/parameters/sbas_id'
|
||||||
|
@@ -35,8 +35,10 @@ ESRecordSource:
|
|||||||
properties:
|
properties:
|
||||||
record_id:
|
record_id:
|
||||||
$ref: 'common.yaml#/ID'
|
$ref: 'common.yaml#/ID'
|
||||||
|
example: 555
|
||||||
collection_id:
|
collection_id:
|
||||||
$ref: 'common.yaml#/ID'
|
$ref: 'common.yaml#/ID'
|
||||||
|
example: 123
|
||||||
uuid:
|
uuid:
|
||||||
type: string
|
type: string
|
||||||
example:
|
example:
|
||||||
@@ -59,6 +61,10 @@ ESRecordSource:
|
|||||||
type: string
|
type: string
|
||||||
example:
|
example:
|
||||||
'image'
|
'image'
|
||||||
|
cover_record_id:
|
||||||
|
$ref: 'common.yaml#/ID'
|
||||||
|
description: 'for a story, id of the record chosen as "cover" (or null)'
|
||||||
|
example: null
|
||||||
created_on:
|
created_on:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
@@ -71,18 +77,17 @@ ESRecordSource:
|
|||||||
'2021-01-01 15:30:00'
|
'2021-01-01 15:30:00'
|
||||||
coll_id:
|
coll_id:
|
||||||
$ref: 'common.yaml#/ID'
|
$ref: 'common.yaml#/ID'
|
||||||
|
example: '123'
|
||||||
collection_name:
|
collection_name:
|
||||||
type: string
|
type: string
|
||||||
example:
|
example:
|
||||||
'collection de test'
|
'collection de test'
|
||||||
witdh:
|
witdh:
|
||||||
type: integer
|
type: integer
|
||||||
example:
|
example: 5616
|
||||||
5616
|
|
||||||
height:
|
height:
|
||||||
type: integer
|
type: integer
|
||||||
example:
|
example: 3744
|
||||||
3744
|
|
||||||
size:
|
size:
|
||||||
type: integer
|
type: integer
|
||||||
example:
|
example:
|
||||||
|
@@ -83,6 +83,10 @@
|
|||||||
- $ref: '#/_Record_'
|
- $ref: '#/_Record_'
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
record_id:
|
||||||
|
type: integer
|
||||||
|
example:
|
||||||
|
34
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
example:
|
example:
|
||||||
@@ -134,6 +138,14 @@
|
|||||||
- $ref: '#/_Record_'
|
- $ref: '#/_Record_'
|
||||||
- type: object
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
|
story_id:
|
||||||
|
type: integer
|
||||||
|
example:
|
||||||
|
1400
|
||||||
|
cover_record_id:
|
||||||
|
$ref: 'common.yaml#/ID'
|
||||||
|
description: 'id of the record chosen as "cover" (or null)'
|
||||||
|
example: 55
|
||||||
mime_type:
|
mime_type:
|
||||||
type: string
|
type: string
|
||||||
default: null
|
default: null
|
||||||
|
@@ -182,3 +182,7 @@ services:
|
|||||||
- ${PHRASEANET_DB_DIR}:/var/lib/mysql:rw
|
- ${PHRASEANET_DB_DIR}:/var/lib/mysql:rw
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
|
|
||||||
|
elasticsearch:
|
||||||
|
ports:
|
||||||
|
- 9200:9200
|
@@ -30,23 +30,22 @@ use Alchemy\Phrasea\Search\SubdefTransformer;
|
|||||||
use Alchemy\Phrasea\Search\SubdefView;
|
use Alchemy\Phrasea\Search\SubdefView;
|
||||||
use Alchemy\Phrasea\Search\TechnicalDataTransformer;
|
use Alchemy\Phrasea\Search\TechnicalDataTransformer;
|
||||||
use Alchemy\Phrasea\Search\TechnicalDataView;
|
use Alchemy\Phrasea\Search\TechnicalDataView;
|
||||||
use Alchemy\Phrasea\Search\V1SearchCompositeResultTransformer;
|
use Alchemy\Phrasea\Search\V3SearchCompositeResultTransformer;
|
||||||
use Alchemy\Phrasea\Search\V3SearchResultTransformer;
|
use Alchemy\Phrasea\Search\V3SearchResultTransformer;
|
||||||
use Alchemy\Phrasea\Search\V3StoryTransformer;
|
use Alchemy\Phrasea\Search\V3StoryTransformer;
|
||||||
use Alchemy\Phrasea\SearchEngine\SearchEngineInterface;
|
use Alchemy\Phrasea\SearchEngine\SearchEngineInterface;
|
||||||
use Alchemy\Phrasea\SearchEngine\SearchEngineLogger;
|
use Alchemy\Phrasea\SearchEngine\SearchEngineLogger;
|
||||||
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
||||||
use Alchemy\Phrasea\SearchEngine\SearchEngineResult;
|
use Alchemy\Phrasea\SearchEngine\SearchEngineResult;
|
||||||
|
use Alchemy\Phrasea\Utilities\Stopwatch;
|
||||||
use caption_record;
|
use caption_record;
|
||||||
use League\Fractal\Manager as FractalManager;
|
use League\Fractal\Manager as FractalManager;
|
||||||
use League\Fractal\Resource\Item;
|
use League\Fractal\Resource\Item;
|
||||||
use League\Fractal\Serializer\ArraySerializer;
|
|
||||||
use media_Permalink_Adapter;
|
use media_Permalink_Adapter;
|
||||||
use media_subdef;
|
use media_subdef;
|
||||||
use record_adapter;
|
use record_adapter;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Alchemy\Phrasea\Utilities\Stopwatch;
|
|
||||||
|
|
||||||
class V3SearchController extends Controller
|
class V3SearchController extends Controller
|
||||||
{
|
{
|
||||||
@@ -67,8 +66,8 @@ class V3SearchController extends Controller
|
|||||||
$subdefTransformer = new SubdefTransformer($this->app['acl'], $this->getAuthenticatedUser(), new PermalinkTransformer());
|
$subdefTransformer = new SubdefTransformer($this->app['acl'], $this->getAuthenticatedUser(), new PermalinkTransformer());
|
||||||
$technicalDataTransformer = new TechnicalDataTransformer();
|
$technicalDataTransformer = new TechnicalDataTransformer();
|
||||||
$recordTransformer = new RecordTransformer($subdefTransformer, $technicalDataTransformer);
|
$recordTransformer = new RecordTransformer($subdefTransformer, $technicalDataTransformer);
|
||||||
$storyTransformer = new V3StoryTransformer($subdefTransformer, $recordTransformer);
|
$storyTransformer = new V3StoryTransformer($recordTransformer);
|
||||||
$compositeTransformer = new V1SearchCompositeResultTransformer($recordTransformer, $storyTransformer);
|
$compositeTransformer = new V3SearchCompositeResultTransformer($recordTransformer, $storyTransformer);
|
||||||
$searchTransformer = new V3SearchResultTransformer($compositeTransformer);
|
$searchTransformer = new V3SearchResultTransformer($compositeTransformer);
|
||||||
|
|
||||||
$transformerResolver = new SearchResultTransformerResolver([
|
$transformerResolver = new SearchResultTransformerResolver([
|
||||||
@@ -77,9 +76,6 @@ class V3SearchController extends Controller
|
|||||||
'facets' => new CallbackTransformer(),
|
'facets' => new CallbackTransformer(),
|
||||||
'suggestions' => new CallbackTransformer(),
|
'suggestions' => new CallbackTransformer(),
|
||||||
'results.stories' => $storyTransformer,
|
'results.stories' => $storyTransformer,
|
||||||
'results.stories.thumbnail' => $subdefTransformer,
|
|
||||||
'results.stories.metadatas' => new CallbackTransformer(),
|
|
||||||
'results.stories.caption' => new CallbackTransformer(),
|
|
||||||
'results.stories.children' => $recordTransformer,
|
'results.stories.children' => $recordTransformer,
|
||||||
'results.stories.children.thumbnail' => $subdefTransformer,
|
'results.stories.children.thumbnail' => $subdefTransformer,
|
||||||
'results.stories.children.technical_informations' => $technicalDataTransformer,
|
'results.stories.children.technical_informations' => $technicalDataTransformer,
|
||||||
@@ -89,11 +85,19 @@ class V3SearchController extends Controller
|
|||||||
'results.stories.children.caption' => new CallbackTransformer(),
|
'results.stories.children.caption' => new CallbackTransformer(),
|
||||||
'results.records' => $recordTransformer,
|
'results.records' => $recordTransformer,
|
||||||
'results.records.thumbnail' => $subdefTransformer,
|
'results.records.thumbnail' => $subdefTransformer,
|
||||||
|
'results.stories.thumbnail' => $subdefTransformer,
|
||||||
'results.records.technical_informations' => $technicalDataTransformer,
|
'results.records.technical_informations' => $technicalDataTransformer,
|
||||||
|
// 'results.stories.technical_informations' => $technicalDataTransformer, // no ti on story
|
||||||
'results.records.subdefs' => $subdefTransformer,
|
'results.records.subdefs' => $subdefTransformer,
|
||||||
|
'results.stories.subdefs' => $subdefTransformer,
|
||||||
'results.records.metadata' => new CallbackTransformer(),
|
'results.records.metadata' => new CallbackTransformer(),
|
||||||
'results.records.status' => new CallbackTransformer(),
|
'results.stories.metadata' => new CallbackTransformer(),
|
||||||
|
'results.records.metadatas' => new CallbackTransformer(),
|
||||||
|
'results.stories.metadatas' => new CallbackTransformer(),
|
||||||
'results.records.caption' => new CallbackTransformer(),
|
'results.records.caption' => new CallbackTransformer(),
|
||||||
|
'results.stories.caption' => new CallbackTransformer(),
|
||||||
|
'results.records.status' => new CallbackTransformer(),
|
||||||
|
'results.stories.status' => new CallbackTransformer(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$includeResolver = new IncludeResolver($transformerResolver);
|
$includeResolver = new IncludeResolver($transformerResolver);
|
||||||
@@ -269,7 +273,7 @@ class V3SearchController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array('results.stories.metadatas', $includes, true) ||
|
if (in_array('results.stories.metadata', $includes, true) ||
|
||||||
in_array('results.stories.caption', $includes, true)) {
|
in_array('results.stories.caption', $includes, true)) {
|
||||||
$captions = $this->app['service.caption']->findByReferenceCollection($stories);
|
$captions = $this->app['service.caption']->findByReferenceCollection($stories);
|
||||||
$canSeeBusiness = $this->retrieveSeeBusinessPerDatabox($stories);
|
$canSeeBusiness = $this->retrieveSeeBusinessPerDatabox($stories);
|
||||||
|
@@ -25,12 +25,12 @@ class CollectionChangedEvent extends RecordEvent
|
|||||||
|
|
||||||
$this->beforeCollection = [
|
$this->beforeCollection = [
|
||||||
'collection_name' => $beforeCol->get_name(),
|
'collection_name' => $beforeCol->get_name(),
|
||||||
'collection_id' => $beforeCol->get_base_id()
|
'base_id' => $beforeCol->get_base_id()
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->afterCollection = [
|
$this->afterCollection = [
|
||||||
'collection_name' => $afterCol->get_name(),
|
'collection_name' => $afterCol->get_name(),
|
||||||
'collection_id' => $afterCol->get_base_id()
|
'base_id' => $afterCol->get_base_id()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,9 +14,21 @@ use League\Fractal\TransformerAbstract;
|
|||||||
|
|
||||||
class RecordTransformer extends TransformerAbstract
|
class RecordTransformer extends TransformerAbstract
|
||||||
{
|
{
|
||||||
protected $availableIncludes = ['thumbnail', 'technical_informations', 'subdefs', 'metadata', 'status', 'caption'];
|
protected $availableIncludes = [
|
||||||
|
'thumbnail',
|
||||||
|
'technical_informations',
|
||||||
|
'subdefs',
|
||||||
|
'metadata',
|
||||||
|
// 'metadatas',
|
||||||
|
'status',
|
||||||
|
'caption'
|
||||||
|
];
|
||||||
|
|
||||||
protected $defaultIncludes = ['thumbnail', 'technical_informations'];
|
protected $defaultIncludes = [
|
||||||
|
'thumbnail',
|
||||||
|
'technical_informations',
|
||||||
|
// 'metadatas',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SubdefTransformer
|
* @var SubdefTransformer
|
||||||
@@ -34,8 +46,9 @@ class RecordTransformer extends TransformerAbstract
|
|||||||
$this->technicalDataTransformer = $technicalDataTransformer;
|
$this->technicalDataTransformer = $technicalDataTransformer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transform(RecordView $recordView)
|
public function transform($recordView)
|
||||||
{
|
{
|
||||||
|
/** @var RecordView $recordView */
|
||||||
$record = $recordView->getRecord();
|
$record = $recordView->getRecord();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -54,19 +67,29 @@ class RecordTransformer extends TransformerAbstract
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getSubdefTransformer()
|
||||||
|
{
|
||||||
|
return $this->subdefTransformer;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getTechnicalDataTransformer()
|
||||||
|
{
|
||||||
|
return $this->technicalDataTransformer;
|
||||||
|
}
|
||||||
|
|
||||||
public function includeThumbnail(RecordView $recordView)
|
public function includeThumbnail(RecordView $recordView)
|
||||||
{
|
{
|
||||||
return $this->item($recordView->getSubdef('thumbnail'), $this->subdefTransformer);
|
return $this->item($recordView->getSubdef('thumbnail'), $this->getSubdefTransformer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function includeTechnicalInformations(RecordView $recordView)
|
public function includeTechnicalInformations(RecordView $recordView)
|
||||||
{
|
{
|
||||||
return $this->collection($recordView->getTechnicalDataView()->getDataSet(), $this->technicalDataTransformer);
|
return $this->collection($recordView->getTechnicalDataView()->getDataSet(), $this->getTechnicalDataTransformer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function includeSubdefs(RecordView $recordView)
|
public function includeSubdefs(RecordView $recordView)
|
||||||
{
|
{
|
||||||
return $this->collection($recordView->getSubdefs(), $this->subdefTransformer);
|
return $this->collection($recordView->getSubdefs(), $this->getSubdefTransformer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function includeMetadata(RecordView $recordView)
|
public function includeMetadata(RecordView $recordView)
|
||||||
|
@@ -18,7 +18,7 @@ class RecordView
|
|||||||
/**
|
/**
|
||||||
* @var \record_adapter
|
* @var \record_adapter
|
||||||
*/
|
*/
|
||||||
private $record;
|
protected $record;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var TechnicalDataView
|
* @var TechnicalDataView
|
||||||
|
@@ -23,16 +23,11 @@ use Assert\Assertion;
|
|||||||
* @package Alchemy\Phrasea\Search
|
* @package Alchemy\Phrasea\Search
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class StoryView
|
class StoryView extends RecordView
|
||||||
{
|
{
|
||||||
use SubdefsAware;
|
use SubdefsAware;
|
||||||
use CaptionAware;
|
use CaptionAware;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \record_adapter
|
|
||||||
*/
|
|
||||||
private $story;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var RecordView[]
|
* @var RecordView[]
|
||||||
* may be a subset of all children (only visibles for a user and/or paginated)
|
* may be a subset of all children (only visibles for a user and/or paginated)
|
||||||
@@ -51,7 +46,7 @@ class StoryView
|
|||||||
*/
|
*/
|
||||||
public function __construct(\record_adapter $story)
|
public function __construct(\record_adapter $story)
|
||||||
{
|
{
|
||||||
$this->story = $story;
|
parent::__construct($story);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,7 +54,7 @@ class StoryView
|
|||||||
*/
|
*/
|
||||||
public function getStory()
|
public function getStory()
|
||||||
{
|
{
|
||||||
return $this->story;
|
return $this->record;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2016 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Search;
|
||||||
|
|
||||||
|
use League\Fractal\TransformerAbstract;
|
||||||
|
|
||||||
|
class V3SearchCompositeResultTransformer extends TransformerAbstract
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
protected $availableIncludes = ['stories', 'records'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
protected $defaultIncludes = ['stories', 'records'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var RecordTransformer
|
||||||
|
*/
|
||||||
|
private $recordTransformer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var V3StoryTransformer
|
||||||
|
*/
|
||||||
|
private $storyTransformer;
|
||||||
|
|
||||||
|
public function __construct(RecordTransformer $recordTransformer, V3StoryTransformer $storyTransformer)
|
||||||
|
{
|
||||||
|
$this->recordTransformer = $recordTransformer;
|
||||||
|
$this->storyTransformer = $storyTransformer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function transform()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function includeRecords(SearchResultView $resultView)
|
||||||
|
{
|
||||||
|
return $this->collection($resultView->getRecords(), $this->recordTransformer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function includeStories(SearchResultView $resultView)
|
||||||
|
{
|
||||||
|
return $this->collection($resultView->getStories(), $this->storyTransformer);
|
||||||
|
}
|
||||||
|
}
|
@@ -10,9 +10,7 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea\Search;
|
namespace Alchemy\Phrasea\Search;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Utilities\NullableDateTime;
|
class V3StoryTransformer extends RecordTransformer
|
||||||
|
|
||||||
class V3StoryTransformer extends StoryTransformer
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var RecordTransformer
|
* @var RecordTransformer
|
||||||
@@ -23,43 +21,57 @@ class V3StoryTransformer extends StoryTransformer
|
|||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $availableIncludes = ['thumbnail', 'metadatas', 'children', 'caption'];
|
protected $availableIncludes = [
|
||||||
|
'thumbnail',
|
||||||
|
'subdefs',
|
||||||
|
'metadata',
|
||||||
|
'status',
|
||||||
|
'caption',
|
||||||
|
'children'
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $defaultIncludes = ['thumbnail', 'metadatas'];
|
protected $defaultIncludes = [
|
||||||
|
'thumbnail',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SubdefTransformer $subdefTransformer
|
|
||||||
* @param RecordTransformer $recordTransformer
|
* @param RecordTransformer $recordTransformer
|
||||||
*/
|
*/
|
||||||
public function __construct(SubdefTransformer $subdefTransformer, RecordTransformer $recordTransformer)
|
public function __construct(RecordTransformer $recordTransformer)
|
||||||
{
|
{
|
||||||
parent::__construct($subdefTransformer, $recordTransformer);
|
|
||||||
$this->recordTransformer = $recordTransformer;
|
$this->recordTransformer = $recordTransformer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transform(StoryView $storyView)
|
public function transform($storyView)
|
||||||
{
|
{
|
||||||
|
/** @var StoryView $storyView */
|
||||||
$story = $storyView->getStory();
|
$story = $storyView->getStory();
|
||||||
|
|
||||||
return [
|
return array_merge(
|
||||||
'databox_id' => $story->getDataboxId(),
|
$this->recordTransformer->transform($storyView),
|
||||||
'story_id' => $story->getRecordId(),
|
[
|
||||||
'cover_record_id' => $story->getCoverRecordId(),
|
'children_offset' => $storyView->getData('childrenOffset'),
|
||||||
'updated_on' => NullableDateTime::format($story->getUpdated()),
|
'children_limit' => $storyView->getData('childrenLimit'),
|
||||||
'created_on' => NullableDateTime::format($story->getUpdated()),
|
'children_count' => count($storyView->getChildren()),
|
||||||
'collection_id' => $story->getCollectionId(),
|
'children_total' => $storyView->getData('childrenCount') // fix V1 wrong count
|
||||||
'base_id' => $story->getBaseId(),
|
]
|
||||||
'uuid' => $story->getUuid(),
|
);
|
||||||
'children_offset' => $storyView->getData('childrenOffset'),
|
|
||||||
'children_limit' => $storyView->getData('childrenLimit'),
|
|
||||||
'children_count' => count($storyView->getChildren()),
|
|
||||||
'children_total' => $storyView->getData('childrenCount') // fix V1 wrong count
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getSubdefTransformer()
|
||||||
|
{
|
||||||
|
return $this->recordTransformer->getSubdefTransformer();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getTechnicalDataTransformer()
|
||||||
|
{
|
||||||
|
return $this->recordTransformer->getTechnicalDataTransformer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function includeChildren(StoryView $storyView)
|
public function includeChildren(StoryView $storyView)
|
||||||
{
|
{
|
||||||
return $this->collection($storyView->getChildren(), $this->recordTransformer);
|
return $this->collection($storyView->getChildren(), $this->recordTransformer);
|
||||||
|
Reference in New Issue
Block a user