ynput / ayon-kitsu

Official AYON<->Kitsu intetgration (WIP)
Apache License 2.0
7 stars 4 forks source link

Enhancement/project entity #57

Closed scottmcdonnell closed 1 month ago

scottmcdonnell commented 1 month ago

The project_update was using the Ayon api via httpx, but this is mixed with the existing server/kitsu/utils.py which uses Entity models to save and update. This PR moves the update to the utils.py and changes it from an API call to an Entity.save(). The utils is currently a mixture of entity and api, this and a few more planned PRs can convert them all to entity calls for consistency. As the code is run server-side it is simpler to use entity and the model approach so that is what I went for here. Plus it makes the test cases easier.

Previously the project_update change just the project.attrib for the AYON project - this allows fps, resolution etc to be updated in Kitsu and those changes to update the Ayon project. This PR extends this to also update the Ayon statuses and taskTypes based on changes to statuses and taskTypes in Kitsu once the project.update event is fired.

Tests and mocks are added to ensure the project is updating correctly.

cd tests
poetry run pytest tests/test_push_project.py
martastain commented 1 month ago

I've managed to resolve merge conflicts and fix a few minor issues in the process, so this is the last of those 3 PRs. i merged develop here, so it is testable as is. Could you @scottmcdonnell and @iLLiCiTiT (possibly @MilaKudr ) check if i haven't screwed something up? If we successfully merge this, I'll try to replace httpx calls with native server functions.

scottmcdonnell commented 1 month ago

I've managed to resolve merge conflicts and fix a few minor issues in the process, so this is the last of those 3 PRs. i merged develop here, so it is testable as is. Could you @scottmcdonnell and @iLLiCiTiT (possibly @MilaKudr ) check if i haven't screwed something up? If we successfully merge this, I'll try to replace httpx calls with native server functions.

Excellent, tests passing for me. I have all of the httpx calls replaced with entities + tests in the big PR #35 - so I can add a new PR with more entity changes shortly if that suits.