However, when the item is trashed using updateProjectMedia to test the function, it does not actually delete. How can trashed items be removed completely? (and on a side note, what exactly is the function of destroyProjectMedia?)
This happens because the URL was already added to this team. The url you get on response is the link for the existent item on your team.
When you send archived: 1 on updateProjectMedia you are only sending the item to trash. The item will still be on the team and if the same URL is sent again you’ll receive the error message you mentioned: 'This item already exists'
I need more info to help you with these errors.
For some items you are trying to delete you receive the first error and for other items you receive the other error?
Could you delete any item?
Can you paste here the mutation you are sending, please?
The query raises the error "No permission to delete Dynamic" when it thinks you don’t have permission to execute the query. As you are a team owner, you should be able to do this. It looks like a bug. I reported this error and I will notify here when it is fixed.
The other error message is displayed when the id you send is not from a ProjectMedia. You probably got the media id instead of the project_media. Can you verify if this is the case, please?
That is indeed the case for the "undefined method project" error. Thank you!
Also, I was experimenting with mutations and figured out how to bypass the "No permission to delete Dynamic". Like with updateProjectMedia, it appears that single queries for destroyProjectMedia require both id and ids fields to be filled out even when trashing individual items:
However, even when the mutation is successful, nothing seems to be happening. We are trying to destroy the first item in the below query, but before and after running the above mutation the item is still there. Our query to add items also gives the "This item already exists" error when we attempt to add the item after an error-free mutation. Unless there is a delay of more than a few minutes in performing the mutation, I don’t know what would cause this.
Good to know that was the case for the second error!
The destroyProjectMedia mutation accepts both queries:
only sending the id to delete a single item;
sending ids with a list of items to delete and the id that should be one of the list
This one is deprecated, soon this mutation won’t accept ids, you should not get used to this one.
As you can see in your second image, the item you are trying to destroy has archive: true. For now is not possible to send the destroyProjectMedia mutation for archived items.
Just to check if this is the only problem, could you try the mutation with a not-archived item?