| ... | @@ -12,7 +12,7 @@ The IronAPI supports these options: |
... | @@ -12,7 +12,7 @@ The IronAPI supports these options: |
|
|
- [(+)as](#select-and-as)
|
|
- [(+)as](#select-and-as)
|
|
|
- [order_by](#ordering)
|
|
- [order_by](#ordering)
|
|
|
- [group_by](#group-by)
|
|
- [group_by](#group-by)
|
|
|
- collapse
|
|
- [collapse](#collapse)
|
|
|
- having
|
|
- having
|
|
|
|
|
|
|
|
|
|
|
| ... | @@ -406,7 +406,7 @@ This will return a list of modules names and how many entites each modules has: |
... | @@ -406,7 +406,7 @@ This will return a list of modules names and how many entites each modules has: |
|
|
|
|
|
|
|
`POST /data/system/module/query`
|
|
`POST /data/system/module/query`
|
|
|
|
|
|
|
|
```
|
|
```json
|
|
|
{
|
|
{
|
|
|
"attrs": {
|
|
"attrs": {
|
|
|
"join": "system__entity__module",
|
|
"join": "system__entity__module",
|
| ... | @@ -447,97 +447,88 @@ A list of how many users have which value in the json attribute `settings->>'en |
... | @@ -447,97 +447,88 @@ A list of how many users have which value in the json attribute `settings->>'en |
|
|
When "collape" is set to a true value, indicates that any rows fetched from joined has_many relationships
|
|
When "collape" is set to a true value, indicates that any rows fetched from joined has_many relationships
|
|
|
are to be aggregated into the corresponding "parent" object:
|
|
are to be aggregated into the corresponding "parent" object:
|
|
|
|
|
|
|
|
Parameters:
|
|
## Restrictions
|
|
|
|
|
|
|
|
```JSON
|
|
The only valid values are `0` and `1`.
|
|
|
{
|
|
|
|
|
"attrs" :
|
|
|
|
|
{
|
|
|
|
|
"collapse": "0",
|
|
|
|
|
"join" : ["contracts__working_time_constraint"],
|
|
|
|
|
"+columns": ["contracts__working_time_constraint.id"]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Reply:
|
|
### Examples
|
|
|
|
|
|
|
|
```JSON
|
|
This fetches all entities and lists them as an array for each module
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"modification_time": "2017-09-20 08:38:17.652733",
|
|
|
|
|
"name": "Kollektivvertrag Arbeiterinnen und Arbeiter im Hotel- und Gastgewerbe",
|
|
|
|
|
"url": "https://www.wko.at/branchen/tourismus-freizeitwirtschaft/gastronomie/KV-Rahmen_Mai-2017.pdf",
|
|
|
|
|
"instance_entity": "91",
|
|
|
|
|
"contracts__working_time_constraint": {
|
|
|
|
|
"id": "2"
|
|
|
|
|
},
|
|
|
|
|
"modifying_action": "325",
|
|
|
|
|
"valid_from": "2017-01-05",
|
|
|
|
|
"region": "1",
|
|
|
|
|
"description": "Kollektivvertrag für Arbeiter im Hotel- und Gastgewerbe abgeschlossen zwischen dem Fachverband Gastronomie und dem Fachverband Hotellerie, beide 1045 Wien, Wiedner Hauptstraße 63, einerseits und der Gewerkschaft vida, 1020 Wien, Johann Böhm-Platz 1, andererseits.",
|
|
|
|
|
"id": "1",
|
|
|
|
|
"modifying_client": "1",
|
|
|
|
|
"successor": null
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"modification_time": "2017-09-20 08:38:17.652733",
|
|
|
|
|
"name": "Kollektivvertrag Arbeiterinnen und Arbeiter im Hotel- und Gastgewerbe",
|
|
|
|
|
"url": "https://www.wko.at/branchen/tourismus-freizeitwirtschaft/gastronomie/KV-Rahmen_Mai-2017.pdf",
|
|
|
|
|
"instance_entity": "91",
|
|
|
|
|
"contracts__working_time_constraint": {
|
|
|
|
|
"id": "1"
|
|
|
|
|
},
|
|
|
|
|
"modifying_action": "325",
|
|
|
|
|
"valid_from": "2017-01-05",
|
|
|
|
|
"region": "1",
|
|
|
|
|
"description": "Kollektivvertrag für Arbeiter im Hotel- und Gastgewerbe abgeschlossen zwischen dem Fachverband Gastronomie und dem Fachverband Hotellerie, beide 1045 Wien, Wiedner Hauptstraße 63, einerseits und der Gewerkschaft vida, 1020 Wien, Johann Böhm-Platz 1, andererseits.",
|
|
|
|
|
"modifying_client": "1",
|
|
|
|
|
"id": "1",
|
|
|
|
|
"successor": null
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Parameters:
|
|
`POST /data/system/module/query`
|
|
|
|
|
|
|
|
```JSON
|
|
```json
|
|
|
{
|
|
{
|
|
|
"attrs" :
|
|
"attrs": {
|
|
|
{
|
|
"join": "system__entity__module",
|
|
|
"collapse": "1",
|
|
"columns": [
|
|
|
"join" : ["contracts__working_time_constraint"],
|
|
"me.id",
|
|
|
"+columns": ["contracts__working_time_constraint.id"]
|
|
"me.name",
|
|
|
|
"system__entity__module.id",
|
|
|
|
"system__entity__module.name"
|
|
|
|
],
|
|
|
|
"collapse": 1,
|
|
|
|
"order_by" : ["me.id","system__entity__module.id"]
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Reply:
|
|
```json
|
|
|
|
|
|
|
|
```JSON
|
|
|
|
|
{
|
|
{
|
|
|
"description": "Kollektivvertrag für Arbeiter im Hotel- und Gastgewerbe abgeschlossen zwischen dem Fachverband Gastronomie und dem Fachverband Hotellerie, beide 1045 Wien, Wiedner Hauptstraße 63, einerseits und der Gewerkschaft vida, 1020 Wien, Johann Böhm-Platz 1, andererseits.",
|
|
"data": [
|
|
|
"valid_from": "2017-01-05",
|
|
{
|
|
|
"region": "1",
|
|
"name": "system",
|
|
|
"successor": null,
|
|
"id": 1,
|
|
|
"id": "1",
|
|
"system__entity__module": [
|
|
|
"modifying_client": "1",
|
|
|
|
|
"url": "https://www.wko.at/branchen/tourismus-freizeitwirtschaft/gastronomie/KV-Rahmen_Mai-2017.pdf",
|
|
|
|
|
"modification_time": "2017-09-20 08:38:17.652733",
|
|
|
|
|
"name": "Kollektivvertrag Arbeiterinnen und Arbeiter im Hotel- und Gastgewerbe",
|
|
|
|
|
"instance_entity": "91",
|
|
|
|
|
"contracts__working_time_constraint": [
|
|
|
|
|
{
|
|
{
|
|
|
"id": "1"
|
|
"name": "module",
|
|
|
|
"id": 2
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
"id": "2"
|
|
"name": "entity",
|
|
|
}
|
|
"id": 3
|
|
|
],
|
|
},
|
|
|
"modifying_action": "325"
|
|
{
|
|
|
}
|
|
"id": 4,
|
|
|
|
"name": "attribute"
|
|
|
|
},
|
|
|
|
...
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
Without "collapse", there would be an entry for each module+entity combination:
|
|
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"data": [
|
|
|
|
{
|
|
|
|
"id": 1,
|
|
|
|
"name": "system",
|
|
|
|
"system__entity__module": {
|
|
|
|
"id": 2,
|
|
|
|
"name": "module"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 1,
|
|
|
|
"name": "system",
|
|
|
|
"system__entity__module": {
|
|
|
|
"id": 3,
|
|
|
|
"name": "entity"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 1,
|
|
|
|
"name": "system",
|
|
|
|
"system__entity__module": {
|
|
|
|
"id": 4,
|
|
|
|
"name": "attribute"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
...
|
|
|
|
|
|
|
|
````
|
|
|
|
|
|
|
Note that "prefetch" is a shortcut for "join", adding all columns from the joined related sources as "+columns" and setting "collapse" to a true value.
|
|
Note that "prefetch" is a shortcut for "join", adding all columns from the joined related sources as "+columns" and setting "collapse" to a true value.
|
|
|
|
|
|
|
|
https://metacpan.org/pod/distribution/DBIx-Class/lib/DBIx/Class/ResultSet.pm#collapse
|
|
https://metacpan.org/pod/distribution/DBIx-Class/lib/DBIx/Class/ResultSet.pm#collapse
|
| ... | | ... | |