feat(state-hub): v0.3 schema — contributions + sbom_entries migrations, models, schemas, routers
Migrations (chain: b1c2d3e4f5a6 → c2d3e4f5a6b7 → d3e4f5a6b7c8):
- c2d3e4f5a6b7: contributions table (contributiontype BR/FR/EP/UPR enum,
contributionstatus 7-state lifecycle, FKs to topics/workstreams)
- d3e4f5a6b7c8: sbom_entries table (ecosystem enum, snapshot-based replacement),
+ sbom_source + last_sbom_at columns on managed_repos
New models: Contribution (ContributionType, ContributionStatus), SBOMEntry (Ecosystem)
Modified: ManagedRepo (sbom_source, last_sbom_at columns)
New routers:
- /contributions/ — CRUD + lifecycle-guarded PATCH /status + soft-delete (withdrawn)
- /sbom/ — ingest (replace snapshot), list, per-repo view, licence report
Modified:
- /state/summary now includes contribution_counts and licence_risk_count
- main.py: registers contributions + sbom routers; bumps version to 0.6.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 17:28:27 +01:00
|
|
|
import uuid
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
|
2026-06-22 13:52:13 +02:00
|
|
|
from pydantic import AliasChoices, BaseModel, ConfigDict, Field, computed_field
|
feat(state-hub): v0.3 schema — contributions + sbom_entries migrations, models, schemas, routers
Migrations (chain: b1c2d3e4f5a6 → c2d3e4f5a6b7 → d3e4f5a6b7c8):
- c2d3e4f5a6b7: contributions table (contributiontype BR/FR/EP/UPR enum,
contributionstatus 7-state lifecycle, FKs to topics/workstreams)
- d3e4f5a6b7c8: sbom_entries table (ecosystem enum, snapshot-based replacement),
+ sbom_source + last_sbom_at columns on managed_repos
New models: Contribution (ContributionType, ContributionStatus), SBOMEntry (Ecosystem)
Modified: ManagedRepo (sbom_source, last_sbom_at columns)
New routers:
- /contributions/ — CRUD + lifecycle-guarded PATCH /status + soft-delete (withdrawn)
- /sbom/ — ingest (replace snapshot), list, per-repo view, licence report
Modified:
- /state/summary now includes contribution_counts and licence_risk_count
- main.py: registers contributions + sbom routers; bumps version to 0.6.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 17:28:27 +01:00
|
|
|
|
|
|
|
|
from api.models.contribution import ContributionStatus, ContributionType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ContributionCreate(BaseModel):
|
|
|
|
|
type: ContributionType
|
|
|
|
|
target_org: str | None = None
|
|
|
|
|
target_repo: str | None = None
|
|
|
|
|
slug: str | None = None
|
|
|
|
|
title: str
|
|
|
|
|
body_path: str | None = None
|
|
|
|
|
related_topic_id: uuid.UUID | None = None
|
2026-06-22 13:52:13 +02:00
|
|
|
related_workplan_id: uuid.UUID | None = Field(
|
|
|
|
|
default=None,
|
|
|
|
|
validation_alias=AliasChoices("related_workplan_id", "related_workstream_id"),
|
|
|
|
|
)
|
2026-03-02 23:39:17 +01:00
|
|
|
repo_id: uuid.UUID | None = None
|
feat(state-hub): v0.3 schema — contributions + sbom_entries migrations, models, schemas, routers
Migrations (chain: b1c2d3e4f5a6 → c2d3e4f5a6b7 → d3e4f5a6b7c8):
- c2d3e4f5a6b7: contributions table (contributiontype BR/FR/EP/UPR enum,
contributionstatus 7-state lifecycle, FKs to topics/workstreams)
- d3e4f5a6b7c8: sbom_entries table (ecosystem enum, snapshot-based replacement),
+ sbom_source + last_sbom_at columns on managed_repos
New models: Contribution (ContributionType, ContributionStatus), SBOMEntry (Ecosystem)
Modified: ManagedRepo (sbom_source, last_sbom_at columns)
New routers:
- /contributions/ — CRUD + lifecycle-guarded PATCH /status + soft-delete (withdrawn)
- /sbom/ — ingest (replace snapshot), list, per-repo view, licence report
Modified:
- /state/summary now includes contribution_counts and licence_risk_count
- main.py: registers contributions + sbom routers; bumps version to 0.6.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 17:28:27 +01:00
|
|
|
notes: str | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ContributionStatusPatch(BaseModel):
|
|
|
|
|
status: ContributionStatus
|
|
|
|
|
notes: str | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ContributionRead(BaseModel):
|
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
|
|
|
|
id: uuid.UUID
|
|
|
|
|
type: ContributionType
|
|
|
|
|
target_org: str | None = None
|
|
|
|
|
target_repo: str | None = None
|
|
|
|
|
slug: str | None = None
|
|
|
|
|
title: str
|
|
|
|
|
status: ContributionStatus
|
|
|
|
|
body_path: str | None = None
|
|
|
|
|
related_topic_id: uuid.UUID | None = None
|
2026-06-22 13:52:13 +02:00
|
|
|
related_workplan_id: uuid.UUID | None = None
|
2026-03-02 23:39:17 +01:00
|
|
|
repo_id: uuid.UUID | None = None
|
feat(state-hub): v0.3 schema — contributions + sbom_entries migrations, models, schemas, routers
Migrations (chain: b1c2d3e4f5a6 → c2d3e4f5a6b7 → d3e4f5a6b7c8):
- c2d3e4f5a6b7: contributions table (contributiontype BR/FR/EP/UPR enum,
contributionstatus 7-state lifecycle, FKs to topics/workstreams)
- d3e4f5a6b7c8: sbom_entries table (ecosystem enum, snapshot-based replacement),
+ sbom_source + last_sbom_at columns on managed_repos
New models: Contribution (ContributionType, ContributionStatus), SBOMEntry (Ecosystem)
Modified: ManagedRepo (sbom_source, last_sbom_at columns)
New routers:
- /contributions/ — CRUD + lifecycle-guarded PATCH /status + soft-delete (withdrawn)
- /sbom/ — ingest (replace snapshot), list, per-repo view, licence report
Modified:
- /state/summary now includes contribution_counts and licence_risk_count
- main.py: registers contributions + sbom routers; bumps version to 0.6.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 17:28:27 +01:00
|
|
|
submitted_at: datetime | None = None
|
|
|
|
|
resolved_at: datetime | None = None
|
|
|
|
|
notes: str | None = None
|
|
|
|
|
created_at: datetime
|
|
|
|
|
updated_at: datetime
|
2026-06-22 13:52:13 +02:00
|
|
|
|
|
|
|
|
@computed_field # type: ignore[prop-decorator]
|
|
|
|
|
@property
|
|
|
|
|
def related_workstream_id(self) -> uuid.UUID | None:
|
|
|
|
|
return self.related_workplan_id
|