feat(api): add tag filtering to nodes and templates endpoints

- Add optional `tags` query parameter to `/nodes` and `/templates` endpoints
- Support filtering by tags in format "key:value" with multiple tags ANDed together
- Example: `?tags=vendor:cisco&tags=model:7200` filters nodes/templates with both tags
- Maintain backward compatibility for existing API usage without tags parameter
This commit is contained in:
YueGuobin committed 2026-02-22 22:52:28 +08:00
1 parent 56ece7ce88
commit a3616e6d33
6 files changed
+93 -16

No files matched your search

+2 -4
View File
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from sqlalchemy import Boolean, Column, String, Integer, Float, ForeignKey, PickleType
from sqlalchemy import Boolean, Column, String, Integer, Float, ForeignKey, PickleType, JSON
from sqlalchemy.orm import relationship
from .base import BaseTable, generate_uuid, GUID
@@ -36,9 +36,7 @@ class Template(BaseTable):
builtin = Column(Boolean, default=False)
usage = Column(String)
template_type = Column(String)
vendor = Column(String)
model = Column(String)
netmiko_device_type = Column(String)
tags = Column(JSON, default='{}')
compute_id = Column(String)
images = relationship("Image", secondary=image_template_map, back_populates="templates")