Also return Userfields for Userobjects (endpoint /objects/{entity}) (fixes #979)

This commit is contained in:
Bernd Bestel 2020-08-31 22:32:56 +02:00
parent ad4f8a19af
commit ae590fa910
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 37 additions and 0 deletions

View File

@ -73,6 +73,7 @@
- Performance improvements of the `/stock/products/*` endpoints (thanks @fipwmaqzufheoxq92ebc) - 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 `/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 `/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 - Fixed (again) that CORS was broken
### General & other improvements/fixes ### General & other improvements/fixes

36
migrations/0113.sql Normal file
View File

@ -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-%';