Closed andybak closed 2 months ago
OK. This is a bit tricky. This endpoint is used by the Sketchbook panel. It expects to be able to load a .tilt file.
So we need to have some way to filter likes by whether they have a .tilt or not
i.e. at least one item in the "formats" array has "format" set to "TILT"
Formats is currently just a text field. We could switch to a JSON field type? (EDIT - it already IS a JSON field. My bad...) Or add a new bool field and pre-process all existing files.
A JSON field would be more useful generally but if we want future sqlite support we'll need to check if Django and sqlite can do what we need:
https://docs.djangoproject.com/en/5.0/ref/databases/#enabling-json1-extension-on-sqlite
And even if we do want a JSON field - it might be worth also having a boolean for performance reasons.
According to at least one place in the FastAPI code "assets" is a JSONB field:
sqlalchemy.Column("formats", sqlalchemy.dialects.postgresql.JSONB)
(from database_schema.py)
Yep, formats is a JSON field
I think this is done. @andybak do you agree?
Example query:
/users/me/likedassets?format=TILT&orderBy=LIKED_TIME&pageSize=20