feat(forgejo): add validation, cached issues, sync service, and human issue APIs (Issues 5-8); add connection and repository admin UI (Issues 3-4); fix migration graph and client bugs
Backend Issues 5-8:
- POST /forgejo/connections/{id}/validate and /repositories/{id}/validate
- ForgejoIssue model with unique constraint (repo_id, issue_number)
- IssueSyncService with pagination and upsert
- GET /forgejo/issues with filtering, search, pagination
- GET /forgejo/issues/{id} with org-scoped access
- Fixed ForgejoAPIClient /api/v1 path prefix
- Fixed get_forgejo_client async context (was async def, now regular def)
- Fixed Forgejo API response parsing (list, not dict with items)
- Fixed None-safe handling for labels/assignees
Frontend Issues 3-4:
- Connections list, new, edit pages with token masking
- Repositories list, new, edit pages with connection selector
- ForgejoConnectionForm, ForgejoConnectionsTable components
- ForgejoRepositoryForm, ForgejoRepositoriesTable components
- api-forgejo.ts client library
Migration cleanup:
- Consolidated forgejo_issues table into f5a2b3c4d5e6 migration
- Removed orphan branch migrations for already-existing tables
- Fixed migration graph to single head (f5a2b3c4d5e6)
- Stamped DB to correct revision
2026-05-19 03:10:32 -05:00
|
|
|
"""add forgejo models and issues tables
|
feat(forgejo): add DB models, CRUD APIs, client service, and Git Projects nav (Issues 1-4, FI2)
Backend:
- ForgejoConnection + ForgejoRepository SQLModel models with migration
- Admin CRUD API for connections (GET/POST/PATCH/DELETE)
- Admin CRUD API for repositories (GET/POST/PATCH/DELETE)
- Token redaction, URL normalization, duplicate prevention
- ForgejoAPIClient service (httpx async, list_issues, close_issue, get_repository)
- Removed stale feast import that crashed startup
Frontend:
- Git Projects sidebar nav item (FolderGit icon)
- /git-projects shell page with empty/loading/error states
Verified: all endpoints live, CRUD tested, migration applied.
2026-05-19 02:46:27 -05:00
|
|
|
|
|
|
|
|
Revision ID: f5a2b3c4d5e6
|
feat(forgejo): add validation, cached issues, sync service, and human issue APIs (Issues 5-8); add connection and repository admin UI (Issues 3-4); fix migration graph and client bugs
Backend Issues 5-8:
- POST /forgejo/connections/{id}/validate and /repositories/{id}/validate
- ForgejoIssue model with unique constraint (repo_id, issue_number)
- IssueSyncService with pagination and upsert
- GET /forgejo/issues with filtering, search, pagination
- GET /forgejo/issues/{id} with org-scoped access
- Fixed ForgejoAPIClient /api/v1 path prefix
- Fixed get_forgejo_client async context (was async def, now regular def)
- Fixed Forgejo API response parsing (list, not dict with items)
- Fixed None-safe handling for labels/assignees
Frontend Issues 3-4:
- Connections list, new, edit pages with token masking
- Repositories list, new, edit pages with connection selector
- ForgejoConnectionForm, ForgejoConnectionsTable components
- ForgejoRepositoryForm, ForgejoRepositoriesTable components
- api-forgejo.ts client library
Migration cleanup:
- Consolidated forgejo_issues table into f5a2b3c4d5e6 migration
- Removed orphan branch migrations for already-existing tables
- Fixed migration graph to single head (f5a2b3c4d5e6)
- Stamped DB to correct revision
2026-05-19 03:10:32 -05:00
|
|
|
Revises: a9b1c2d3e4f7
|
feat(forgejo): add DB models, CRUD APIs, client service, and Git Projects nav (Issues 1-4, FI2)
Backend:
- ForgejoConnection + ForgejoRepository SQLModel models with migration
- Admin CRUD API for connections (GET/POST/PATCH/DELETE)
- Admin CRUD API for repositories (GET/POST/PATCH/DELETE)
- Token redaction, URL normalization, duplicate prevention
- ForgejoAPIClient service (httpx async, list_issues, close_issue, get_repository)
- Removed stale feast import that crashed startup
Frontend:
- Git Projects sidebar nav item (FolderGit icon)
- /git-projects shell page with empty/loading/error states
Verified: all endpoints live, CRUD tested, migration applied.
2026-05-19 02:46:27 -05:00
|
|
|
Create Date: 2026-05-19 00:00:00.000000
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import sqlalchemy as sa
|
|
|
|
|
from alembic import op
|
|
|
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
|
|
|
revision = "f5a2b3c4d5e6"
|
|
|
|
|
down_revision = "a9b1c2d3e4f7"
|
|
|
|
|
branch_labels = None
|
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade() -> None:
|
|
|
|
|
bind = op.get_bind()
|
|
|
|
|
inspector = sa.inspect(bind)
|
|
|
|
|
|
|
|
|
|
if not inspector.has_table("forgejo_connections"):
|
|
|
|
|
op.create_table(
|
|
|
|
|
"forgejo_connections",
|
|
|
|
|
sa.Column("id", sa.Uuid(), nullable=False),
|
|
|
|
|
sa.Column("organization_id", sa.Uuid(), nullable=False),
|
|
|
|
|
sa.Column("name", sa.String(), nullable=False),
|
|
|
|
|
sa.Column("base_url", sa.String(), nullable=False),
|
|
|
|
|
sa.Column("token", sa.String(), nullable=True),
|
|
|
|
|
sa.Column("token_last_eight", sa.String(), nullable=True),
|
|
|
|
|
sa.Column("active", sa.Boolean(), nullable=False, server_default=sa.text("true")),
|
|
|
|
|
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
|
|
|
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
|
|
|
|
sa.PrimaryKeyConstraint("id"),
|
|
|
|
|
sa.ForeignKeyConstraint(["organization_id"], ["organizations.id"]),
|
|
|
|
|
)
|
|
|
|
|
op.create_index("ix_forgejo_connections_org_id", "forgejo_connections", ["organization_id"])
|
|
|
|
|
|
|
|
|
|
if not inspector.has_table("forgejo_repositories"):
|
|
|
|
|
op.create_table(
|
|
|
|
|
"forgejo_repositories",
|
|
|
|
|
sa.Column("id", sa.Uuid(), nullable=False),
|
|
|
|
|
sa.Column("organization_id", sa.Uuid(), nullable=False),
|
|
|
|
|
sa.Column("connection_id", sa.Uuid(), nullable=False),
|
|
|
|
|
sa.Column("owner", sa.String(), nullable=False),
|
|
|
|
|
sa.Column("repo", sa.String(), nullable=False),
|
|
|
|
|
sa.Column("display_name", sa.String(), nullable=False, server_default=""),
|
|
|
|
|
sa.Column("default_branch", sa.String(), nullable=False, server_default="main"),
|
|
|
|
|
sa.Column("active", sa.Boolean(), nullable=False, server_default=sa.text("true")),
|
|
|
|
|
sa.Column("last_sync_at", sa.DateTime(), nullable=True),
|
|
|
|
|
sa.Column("last_sync_error", sa.String(), nullable=True),
|
|
|
|
|
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
|
|
|
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
|
|
|
|
sa.PrimaryKeyConstraint("id"),
|
|
|
|
|
sa.ForeignKeyConstraint(["organization_id"], ["organizations.id"]),
|
|
|
|
|
sa.ForeignKeyConstraint(["connection_id"], ["forgejo_connections.id"]),
|
|
|
|
|
)
|
|
|
|
|
op.create_index("ix_forgejo_repos_org_id", "forgejo_repositories", ["organization_id"])
|
|
|
|
|
op.create_index("ix_forgejo_repos_conn_id", "forgejo_repositories", ["connection_id"])
|
|
|
|
|
|
feat(forgejo): add validation, cached issues, sync service, and human issue APIs (Issues 5-8); add connection and repository admin UI (Issues 3-4); fix migration graph and client bugs
Backend Issues 5-8:
- POST /forgejo/connections/{id}/validate and /repositories/{id}/validate
- ForgejoIssue model with unique constraint (repo_id, issue_number)
- IssueSyncService with pagination and upsert
- GET /forgejo/issues with filtering, search, pagination
- GET /forgejo/issues/{id} with org-scoped access
- Fixed ForgejoAPIClient /api/v1 path prefix
- Fixed get_forgejo_client async context (was async def, now regular def)
- Fixed Forgejo API response parsing (list, not dict with items)
- Fixed None-safe handling for labels/assignees
Frontend Issues 3-4:
- Connections list, new, edit pages with token masking
- Repositories list, new, edit pages with connection selector
- ForgejoConnectionForm, ForgejoConnectionsTable components
- ForgejoRepositoryForm, ForgejoRepositoriesTable components
- api-forgejo.ts client library
Migration cleanup:
- Consolidated forgejo_issues table into f5a2b3c4d5e6 migration
- Removed orphan branch migrations for already-existing tables
- Fixed migration graph to single head (f5a2b3c4d5e6)
- Stamped DB to correct revision
2026-05-19 03:10:32 -05:00
|
|
|
if not inspector.has_table("forgejo_issues"):
|
|
|
|
|
op.create_table(
|
|
|
|
|
"forgejo_issues",
|
|
|
|
|
sa.Column("id", sa.Uuid(), nullable=False),
|
|
|
|
|
sa.Column("organization_id", sa.Uuid(), nullable=False),
|
|
|
|
|
sa.Column("repository_id", sa.Uuid(), nullable=False),
|
|
|
|
|
sa.Column("forgejo_issue_number", sa.Integer(), nullable=False),
|
|
|
|
|
sa.Column("title", sa.String(), nullable=False),
|
|
|
|
|
sa.Column("body_preview", sa.String(1000), nullable=True),
|
|
|
|
|
sa.Column("state", sa.String(), nullable=False, server_default="open"),
|
|
|
|
|
sa.Column("is_pull_request", sa.Boolean(), nullable=False, server_default=sa.text("false")),
|
|
|
|
|
sa.Column("labels", sa.JSON(), nullable=True),
|
|
|
|
|
sa.Column("assignees", sa.JSON(), nullable=True),
|
|
|
|
|
sa.Column("author", sa.String(), nullable=False),
|
|
|
|
|
sa.Column("html_url", sa.String(), nullable=False),
|
|
|
|
|
sa.Column("forgejo_created_at", sa.DateTime(), nullable=False),
|
|
|
|
|
sa.Column("forgejo_updated_at", sa.DateTime(), nullable=False),
|
|
|
|
|
sa.Column("forgejo_closed_at", sa.DateTime(), nullable=True),
|
|
|
|
|
sa.Column("last_synced_at", sa.DateTime(), nullable=False),
|
|
|
|
|
sa.Column("created_at", sa.DateTime(), nullable=False),
|
|
|
|
|
sa.Column("updated_at", sa.DateTime(), nullable=False),
|
|
|
|
|
sa.PrimaryKeyConstraint("id"),
|
|
|
|
|
sa.ForeignKeyConstraint(["organization_id"], ["organizations.id"]),
|
|
|
|
|
sa.ForeignKeyConstraint(["repository_id"], ["forgejo_repositories.id"]),
|
|
|
|
|
)
|
|
|
|
|
op.create_index("ix_forgejo_issues_org_id", "forgejo_issues", ["organization_id"])
|
|
|
|
|
op.create_index("ix_forgejo_issues_repo_id", "forgejo_issues", ["repository_id"])
|
|
|
|
|
op.create_index("ix_forgejo_issues_repo_number", "forgejo_issues", ["repository_id", "forgejo_issue_number"], unique=True)
|
|
|
|
|
|
feat(forgejo): add DB models, CRUD APIs, client service, and Git Projects nav (Issues 1-4, FI2)
Backend:
- ForgejoConnection + ForgejoRepository SQLModel models with migration
- Admin CRUD API for connections (GET/POST/PATCH/DELETE)
- Admin CRUD API for repositories (GET/POST/PATCH/DELETE)
- Token redaction, URL normalization, duplicate prevention
- ForgejoAPIClient service (httpx async, list_issues, close_issue, get_repository)
- Removed stale feast import that crashed startup
Frontend:
- Git Projects sidebar nav item (FolderGit icon)
- /git-projects shell page with empty/loading/error states
Verified: all endpoints live, CRUD tested, migration applied.
2026-05-19 02:46:27 -05:00
|
|
|
|
|
|
|
|
def downgrade() -> None:
|
feat(forgejo): add validation, cached issues, sync service, and human issue APIs (Issues 5-8); add connection and repository admin UI (Issues 3-4); fix migration graph and client bugs
Backend Issues 5-8:
- POST /forgejo/connections/{id}/validate and /repositories/{id}/validate
- ForgejoIssue model with unique constraint (repo_id, issue_number)
- IssueSyncService with pagination and upsert
- GET /forgejo/issues with filtering, search, pagination
- GET /forgejo/issues/{id} with org-scoped access
- Fixed ForgejoAPIClient /api/v1 path prefix
- Fixed get_forgejo_client async context (was async def, now regular def)
- Fixed Forgejo API response parsing (list, not dict with items)
- Fixed None-safe handling for labels/assignees
Frontend Issues 3-4:
- Connections list, new, edit pages with token masking
- Repositories list, new, edit pages with connection selector
- ForgejoConnectionForm, ForgejoConnectionsTable components
- ForgejoRepositoryForm, ForgejoRepositoriesTable components
- api-forgejo.ts client library
Migration cleanup:
- Consolidated forgejo_issues table into f5a2b3c4d5e6 migration
- Removed orphan branch migrations for already-existing tables
- Fixed migration graph to single head (f5a2b3c4d5e6)
- Stamped DB to correct revision
2026-05-19 03:10:32 -05:00
|
|
|
op.drop_table("forgejo_issues")
|
feat(forgejo): add DB models, CRUD APIs, client service, and Git Projects nav (Issues 1-4, FI2)
Backend:
- ForgejoConnection + ForgejoRepository SQLModel models with migration
- Admin CRUD API for connections (GET/POST/PATCH/DELETE)
- Admin CRUD API for repositories (GET/POST/PATCH/DELETE)
- Token redaction, URL normalization, duplicate prevention
- ForgejoAPIClient service (httpx async, list_issues, close_issue, get_repository)
- Removed stale feast import that crashed startup
Frontend:
- Git Projects sidebar nav item (FolderGit icon)
- /git-projects shell page with empty/loading/error states
Verified: all endpoints live, CRUD tested, migration applied.
2026-05-19 02:46:27 -05:00
|
|
|
op.drop_table("forgejo_repositories")
|
|
|
|
|
op.drop_table("forgejo_connections")
|