Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api): implement centralized tag collection #4517

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

heiytor
Copy link
Contributor

@heiytor heiytor commented Jan 23, 2025

partially fixes #4350

Create a dedicated tags collection to centralize tag management across the application. This replaces the previous string-based tag association with a reference-based model using tag IDs.

The schema for a tag is as follow:

{
    "_id": ObjectId,
    "tenant_id": String,
    "created_at": Time,
    "updated_at": Time,
    "name": String
}

Update all tag-related collections to use tag IDs instead of tag names. A migration handles the conversion of existing tag data to the new format.

API response format now includes tag objects:

{
    ...
    "tags": [
        { "name": String },
        { "name": String },
        { "name": String }
    ]
}

Implement generic tag management methods in the store layer to handle tag operations (push/pull) consistently across all taggable collections. Add new query options to filter items by tags.

Introduce dual tag representation in taggable entities:

  • TagsID: Internal array of tag IDs (not exposed via API)
  • Tags: Array of models.Tag objects for API responses

@heiytor heiytor self-assigned this Jan 23, 2025
@heiytor heiytor force-pushed the refactor/tag-collections branch 2 times, most recently from c417ddd to 91c3b13 Compare January 27, 2025 11:33
@heiytor heiytor changed the title refactor: tags structure refactor(api): implement centralized tag collection Jan 27, 2025
@heiytor heiytor marked this pull request as ready for review January 27, 2025 11:35
@heiytor heiytor requested review from a team as code owners January 27, 2025 11:35
@heiytor heiytor force-pushed the refactor/tag-collections branch from 91c3b13 to ebb731c Compare January 27, 2025 11:46
Create a dedicated `tags` collection to centralize tag management across
the application. This replaces the previous string-based tag association
with a reference-based model using tag IDs.

The schema for a tag is as follow:
```json
{
    "_id": ObjectId,
    "tenant_id": String,
    "created_at": Time,
    "updated_at": Time,
    "name": String
}
```

Update all tag-related collections to use tag IDs instead of tag names.
A migration handles the conversion of existing tag data to the new
format.

API response format now includes tag objects:
```json
{
    ...
    "tags": [
        { "name": String },
        { "name": String },
        { "name": String }
    ]
}
```

Implement generic tag management methods in the store layer to handle
tag operations (push/pull) consistently across all taggable collections.
Add new query options to filter items by tags.

Introduce dual tag representation in taggable entities:
- TagsID: Internal array of tag IDs (not exposed via API)
- Tags: Array of models.Tag objects for API responses
@heiytor heiytor force-pushed the refactor/tag-collections branch from ebb731c to 698398a Compare January 27, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement backend support for tag colors
1 participant