diff --git a/changelog/60_UNRELEASED_2020-xx-xx.md b/changelog/60_UNRELEASED_2020-xx-xx.md index 915a197a..013b4827 100644 --- a/changelog/60_UNRELEASED_2020-xx-xx.md +++ b/changelog/60_UNRELEASED_2020-xx-xx.md @@ -73,6 +73,7 @@ - Performance improvements of the `/stock/products/*` endpoints (thanks @fipwmaqzufheoxq92ebc) - Fixed that the endpoint `/objects/{entity}/{objectId}` always returned successfully, even when the given object not exists (now returns `404` when the object is not found) (thanks @fipwmaqzufheoxq92ebc) - Fixed that the endpoint `/stock/volatile` didn't include products which expire today (thanks @fipwmaqzufheoxq92ebc) +- Fixed that the endpoint `/objects/{entity}` did not include Userfields for Userentities (so the effective endpoint `/objects/userobjects`) - Fixed (again) that CORS was broken ### General & other improvements/fixes diff --git a/migrations/0113.sql b/migrations/0113.sql new file mode 100644 index 00000000..c48371c5 --- /dev/null +++ b/migrations/0113.sql @@ -0,0 +1,36 @@ +DROP VIEW userfield_values_resolved; +CREATE VIEW userfield_values_resolved +AS +SELECT + u.id, -- Dummy, LessQL needs an id column + u.entity, + u.name, + u.caption, + u.type, + u.show_as_column_in_tables, + u.row_created_timestamp, + u.config, + uv.object_id, + uv.value +FROM userfields u +JOIN userfield_values uv + ON u.id = uv.field_id + +UNION + +-- Kind of a hack, include userentity userfields also for the table userobjects +SELECT + u.id, -- Dummy, LessQL needs an id column, + 'userobjects', + u.name, + u.caption, + u.type, + u.show_as_column_in_tables, + u.row_created_timestamp, + u.config, + uv.object_id, + uv.value +FROM userfields u +JOIN userfield_values uv + ON u.id = uv.field_id +WHERE u.entity like 'userentity-%';