I can have tags for files
Overview
The FileMetadata model has been updated to include new functionality related to tagging files. These changes include a new tags field, new query parameters for filtering based on tags, and the use of tags for marking canceled files during tenant leave processes. Below are the details of these changes and how to use them.
1. New tags[] Field in FileMetadata
I have:
- A new field
tags[]in theFileMetadataclass. The data type for the tags is an array ofCatalogValueobjects.
I can:
- Store multiple tags associated with a
FileMetadataobject. - Each tag is represented by a
CatalogValuethat includes:type: The type of catalog value (always"CatalogValue").id: The unique identifier for the tag.
2. Updating Tags with PATCH Request
I can:
- Update the tags of a specific
FileMetadatausing aPATCHrequest.
Request Format:
To update the tags of a file, send a PATCH request to the following endpoint:
Request URL:
PATCH /adb-files/files/metadata/{fileMetadataId}/tags
Request Body:
{
"tags": [
{
"type": "CatalogValue",
"id": "FILE_TAG.CANCELED"
}
]
}
tags[]: An array of CatalogValue objects to be added to the FileMetadata.- In the above example, the tag
FILE_TAG.CANCELEDis added to the FileMetadata.
3. New Query Parameters for FileMetadata Search
I have:
- Two new query parameters for searching FileMetadata based on tags:
includeTags[]: Filters FileMetadata that contain the specified tags.excludeTags[]: Filters FileMetadata that do not contain the specified tags.
I can:
- Use the
includeTags[]parameter to filter files that have a specific tag. - Use the
excludeTags[]parameter to filter files that do not have a specific tag.
Example Query:
To retrieve a list of FileMetadata that includes the tag FILE_TAG.CANCELED, you can send the following GET request:
Request URL:
GET /adb-files/files/metadata?q={
"pageable": {
"sorts": [{"fieldName": "id", "sortOrder": "ASC"}],
"pageNumber": 0,
"pageSize": 15
},
"target": {
"type": "TargetObject",
"targetId": "{$CONTRACT_ID}",
"targetType": "RentalContract"
},
"includeTags": [
{
"type": "CatalogValue",
"id": "FILE_TAG.CANCELED"
}
]
}
This query will return a list of FileMetadata where the tags field contains the FILE_TAG.CANCELED tag.
Exclude Tags Example:
To retrieve FileMetadata that does not contain the FILE_TAG.CANCELED tag, use the excludeTags[] parameter.
Example Query URL:
GET /adb-files/files/metadata?q={
"excludeTags": [
{
"type": "CatalogValue",
"id": "FILE_TAG.CANCELED"
}
]
}
4. Use of Tags for Tenant Leave Cancellation
I have:
- A tagging system that is used to mark files associated with tenant leave processes.
- Specifically, the
FILE_TAG.CANCELEDtag is used to cancel files created when a RentalContract transitions from SIGNED to NOTICED.
I can:
- Use the
FILE_TAG.CANCELEDtag to mark files for cancellation. - This happens when the state of a rental contract changes from NOTICED back to SIGNED, indicating the cancellation of the tenant leave.
Example Use Case:
During tenant leave, files are created when the rental contract moves from the SIGNED state to the NOTICED state. If the tenant leave is canceled (i.e., the contract moves back from NOTICED to SIGNED), all related files are canceled. To mark these files as canceled, the FILE_TAG.CANCELED tag is added to them.