The data model I want to use for my next project is a rather unusual.
I want one table for Collections, One for Items.
A collection could be books, cars, jumpers, laptops etc.
Each item would store custom attributes in one field in json called Meta.
So the items table would have a title, description, userID, createdDate etc that were generic for all items.
(and of course have a itemTypeID to distinguish between items).
A book would have author, pages, publishedDate etc stored in json in the Meta field.
A laptop might have processor, ram, screensize in the Meta field.
I still want to have the REST URL look like /api/v2/book/… and /api/v2/laptop/…
However in this case book and laptop would be the same field but filtered for itemTypeID
Is this possible? What would be the easiest way to achieve this? Should I run a script pre the action or could I just use views?
I would also want to be able to run filters based on those attributes stored in the Meta field. For example books with over 100 pages.