From 49be935b5d9ee069799708f88b99a339c9984bda Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sat, 3 Jan 2026 14:38:10 +0100 Subject: [PATCH] feat: add link_type field to quick links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds link_type column to quick_links table for iframe vs new_tab behavior. Includes Alembic migration and schema updates. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- CHANGELOG.md | 6 +++++ ...349c95aa5d_add_link_type_to_quick_links.py | 26 +++++++++++++++++++ pyproject.toml | 2 +- src/domains/dashboard/models.py | 1 + src/domains/dashboard/schemas.py | 3 +++ 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 alembic/versions/20260103_1314_f0349c95aa5d_add_link_type_to_quick_links.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f02b84..033c1b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.6.1] - 2026-01-03 + +### Added + +- `link_type` field to quick links for iframe vs new tab behavior + ## [1.6.0] - 2026-01-03 ### Added diff --git a/alembic/versions/20260103_1314_f0349c95aa5d_add_link_type_to_quick_links.py b/alembic/versions/20260103_1314_f0349c95aa5d_add_link_type_to_quick_links.py new file mode 100644 index 0000000..4cbb931 --- /dev/null +++ b/alembic/versions/20260103_1314_f0349c95aa5d_add_link_type_to_quick_links.py @@ -0,0 +1,26 @@ +"""add_link_type_to_quick_links + +Revision ID: f0349c95aa5d +Revises: 003 +Create Date: 2026-01-03 13:14:46.911770+00:00 +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision: str = 'f0349c95aa5d' +down_revision: Union[str, None] = '003' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + op.add_column('quick_links', sa.Column('link_type', sa.String(length=20), nullable=True, server_default='iframe')) + # Update existing rows to have the default value + op.execute("UPDATE quick_links SET link_type = 'iframe' WHERE link_type IS NULL") + + +def downgrade() -> None: + op.drop_column('quick_links', 'link_type') diff --git a/pyproject.toml b/pyproject.toml index a703e68..607316e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "core-api" -version = "1.6.0" +version = "1.6.1" description = "Core Code API - Infrastructure management and tools API" readme = "README.md" requires-python = ">=3.12" diff --git a/src/domains/dashboard/models.py b/src/domains/dashboard/models.py index 92a12e3..b270455 100644 --- a/src/domains/dashboard/models.py +++ b/src/domains/dashboard/models.py @@ -31,6 +31,7 @@ class QuickLink(Base): # Ordering and display position = Column(Integer, default=0) is_visible = Column(Boolean, default=True) + link_type = Column(String(20), default="iframe") # "iframe", "new_tab", etc. # Styling color = Column(String(20), nullable=True) # Hex color for the link card diff --git a/src/domains/dashboard/schemas.py b/src/domains/dashboard/schemas.py index 4f160b3..acd3e65 100644 --- a/src/domains/dashboard/schemas.py +++ b/src/domains/dashboard/schemas.py @@ -26,6 +26,7 @@ class QuickLinkCreate(QuickLinkBase): """Schema for creating a quick link""" position: Optional[int] = Field(0, ge=0, description="Display position") is_visible: Optional[bool] = Field(True, description="Whether link is visible") + link_type: Optional[str] = Field("iframe", max_length=20, description="Link type: iframe, new_tab") class QuickLinkUpdate(BaseSchema): @@ -37,6 +38,7 @@ class QuickLinkUpdate(BaseSchema): category: Optional[str] = Field(None, max_length=50) position: Optional[int] = Field(None, ge=0) is_visible: Optional[bool] = None + link_type: Optional[str] = Field(None, max_length=20) color: Optional[str] = Field(None, max_length=20) background_color: Optional[str] = Field(None, max_length=20) @@ -47,6 +49,7 @@ class QuickLinkResponse(QuickLinkBase): user_id: Optional[str] = None position: int is_visible: bool + link_type: str = "iframe" created_at: datetime updated_at: datetime