# API Extensions - Tags & Virtual Folders
## Tags
### Create
**Scenarios**:
- [x] Create a tag with valid Name and valid FileType
- [x] Create a tag with empty Name and valid FileType
https://ateliere.atlassian.net/browse/CD-10930
- [x] Create a tag with empty FileType
`{
"errors":"message": "Variable \"$input\" got invalid value \"\" at \"input.fileType\"; Expected type FileType."`
- [ ] Create tags with all FileTypes (Image, Audio, Metadata, Timed Text etc)
- [x] Create a tag with invalid FileType
`"errors":"message": "Variable \"$input\" got invalid value \"media container\" at \"input.fileType\"; Expected type FileType. Did you mean media_container?"`
- [x] Create a tag which already exists in Connect
https://ateliere.atlassian.net/browse/CD-10931
----------------
### Read
**Scenarios**:
- [x] Search for an existing Tag
`{
"data": {
"fileDesignationByName": {
"id": "87737375-f49a-4fed-9f7e-98de6ce8ccfd",
"name": "raluca tag",
"fileType": "media_container"
}
}
}`
- [x] Search for a Tag which does not exist in Connect
`{
"errors": [
{
"message": "FileDesignation with name: raluca api testing was not found on organization: c8b2d689-90b5-4a81-8dfc-5ae0aff74f1e!"
}
],
"data": {
"fileDesignationByName": null
}
}`
----------------
### Update
**Scenarios**:
- [x] Update a Tag's Name which is not assigned to any media file
- [x] Update a Tag's Name which is assigned to any media file
- The tag Name is updated both on Title>Media level and also on Tag module
- [x] Update a Tag's FileType which is not assigned to any media file
- [x] Update a Tag's FileType which is assigned to any media file
- The tag's FileType is updated but on the Title>Media level it becomes as "INVALID TAG"
- [x] Update a Tag which does not exist on the organisation
`{
"errors": [
{
"message": "FileDesignation with name: api tagg was not found on organization: c8b2d689-90b5-4a81-8dfc-5ae0aff74f1e!"
}
],
"data": {
"updateFileDesignationByName": null
}
}`
- [x] Update a Tag with the same values as before, a "false" update
- Success response but nothing is actually updated
----------------
### Delete
- [x] Delete a tag which is not assigned
- [x] Delete a tag which is assigned to a media
`{
"errors": [
{
"message": "Could not delete this tag because it is used in these files: chloe-197235723.mov"
}
],
"data": {
"deleteFileDesignationByName": null
}
}`
------------------
## Virtual Folders
### Create
**Scenarios**:
- [x] Create a virtual folder giving valid name and titleMetadataLookup
- [x] Create a virtual folder and add it to an existing parent
- [x] Create a virtual folder and add it to a non-existing parent
- error: `"VirtualFolder with name: vf-parentss was not found on title: 0285f22b-ee9b-48b8-928e-274f94ef7c00!"`
- [x] Create a virtual folder and add it to a parent that's on a different title
- error: `"VirtualFolder with name: test-auto was not found on title: 0285f22b-ee9b-48b8-928e-274f94ef7c00!"`
- [x] Create a virtual folder without a name
- error: `"notNull Violation: virtual_folder.slug cannot be null"`
- [x] Create the same virtual folder twice
- error: `"Failure creating virtual_folder. Error: virtual_folder already exists"`
----------------
### Read
**Scenarios**:
- [x] Search for a folder without a name
- error: `"VirtualFolder with name: was not found on title: 0285f22b-ee9b-48b8-928e-274f94ef7c00!"`
- [x] Pass virtualFolderName: null
- error: `"Variable \"$virtualFolderName\" of non-null type \"String!\" must not be null."`
- [x] Search for an existing folder but from a wrong title
- error: `"VirtualFolder with name: test-vf was not found on title: 17b025ff-2f28-4b47-80ff-f5c12ae800e6!"`
- [x] Search for a virtual folder in Root
- [x] Search for a virtual folder that's inside a different virtual folder
- [x] Have multiple virtual folders on multiple titles - query returns only one
- [x] Have multiple virtual folders in the same title (at different depths) - query returns all of them
------------------
### Update
**Scenarios:**
- [x] Update a virtual folder's name and parent
- [x] Update multiple virtual folders that have the same name, with the same name and add them to the same parent. (ex: have 2 virtual folders with the same name, inside different virtual folders)
- query returns: "Validation error"
- only one folder is updated
- [x] Update multiple virtual folders that have the same name
- all folders are updated, query returns all of them
- [x] Move a virtual folder to a different virtual folder (same title)
- [x] Move a virtual folder (from a different folder) to Root, using `"parentName": "Root"`
- error: `"VirtualFolder with name: Root was not found on title: 17b025ff-2f28-4b47-80ff-f5c12ae800e6!"`
- [x] Move a virtual folder to Root using `"unset":"parentId"`
- moves the folder to Root
- [x] Move a virtual folder to a different title in Root
- [x] Move a virtual folder to a virtual folder of a different title
------------------
### Delete
**Scenarios:**
- [x] Delete a virtual folder from Root
- [x] Delete multiple virtual folders from different depths
- all are deleted
- [x] Delete virtual folders from multiple titles
- error: `"Multiple candidates found for key: api_extension_entity,Global,ohai"`
- [x] Delete a virtual folder twice
- error:`"VirtualFolder with name: test-vf was not found on title: 0285f22b-ee9b-48b8-928e-274f94ef7c00!"`
- [x] Delete a virtual folder that's inside another virtual folder and both have the same name
- both are deleted