Backend Issue 1: Add Forgejo Database Models #1

Closed
opened 2026-05-19 02:22:20 -05:00 by null · 0 comments
Owner

Goal

Add the database foundation for Forgejo connections and tracked repositories.

Scope

  • Add SQLModel models for Forgejo connections and tracked repositories.
  • Add an Alembic migration.
  • Add model imports where Pipeline expects metadata discovery.
  • Do not add API routes in this issue.

Suggested Implementation References

  • Existing models: backend/app/models/gateways.py, backend/app/models/boards.py
  • Existing migrations: backend/migrations/versions/*
  • Model registry import patterns: backend/app/models/__init__.py

Suggested Model Shape

  • ForgejoConnection
    • id, organization_id, name, base_url, token, token_last_eight, active, created_at, updated_at
  • ForgejoRepository
    • id, organization_id, connection_id, owner, repo, display_name, default_branch, active, last_sync_at, last_sync_error, created_at, updated_at

Acceptance Criteria

  • Migration creates forgejo_connections and forgejo_repositories.
  • Foreign keys and indexes support organization-scoped lookup.
  • Token is nullable only if intentionally supported by validation later.
  • Store a token hint such as the last eight characters so admins can identify which token is configured without exposing it.
  • Prefer encrypted token storage if Pipeline already has a secret-encryption utility available; otherwise document that this batch follows the existing gateway-token storage pattern and leave encryption as a separate security hardening issue.
  • No API routes are added.
  • A focused model/migration test or metadata test passes.

Out Of Scope

  • CRUD endpoints.
  • Forgejo HTTP calls.
  • Issue syncing.
  • Frontend UI.
## Goal Add the database foundation for Forgejo connections and tracked repositories. ## Scope - Add SQLModel models for Forgejo connections and tracked repositories. - Add an Alembic migration. - Add model imports where Pipeline expects metadata discovery. - Do not add API routes in this issue. ## Suggested Implementation References - Existing models: `backend/app/models/gateways.py`, `backend/app/models/boards.py` - Existing migrations: `backend/migrations/versions/*` - Model registry import patterns: `backend/app/models/__init__.py` ## Suggested Model Shape - `ForgejoConnection` - `id`, `organization_id`, `name`, `base_url`, `token`, `token_last_eight`, `active`, `created_at`, `updated_at` - `ForgejoRepository` - `id`, `organization_id`, `connection_id`, `owner`, `repo`, `display_name`, `default_branch`, `active`, `last_sync_at`, `last_sync_error`, `created_at`, `updated_at` ## Acceptance Criteria - Migration creates `forgejo_connections` and `forgejo_repositories`. - Foreign keys and indexes support organization-scoped lookup. - Token is nullable only if intentionally supported by validation later. - Store a token hint such as the last eight characters so admins can identify which token is configured without exposing it. - Prefer encrypted token storage if Pipeline already has a secret-encryption utility available; otherwise document that this batch follows the existing gateway-token storage pattern and leave encryption as a separate security hardening issue. - No API routes are added. - A focused model/migration test or metadata test passes. ## Out Of Scope - CRUD endpoints. - Forgejo HTTP calls. - Issue syncing. - Frontend UI.
null closed this issue 2026-05-19 03:17:07 -05:00
null added the
backend
database
forgejo
labels 2026-05-19 03:31:59 -05:00
Sign in to join this conversation.
No description provided.