generated from coulomb/repo-seed
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>
55 lines
1.1 KiB
Python
55 lines
1.1 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
from api.models.sbom_entry import Ecosystem
|
|
|
|
|
|
class SBOMEntryCreate(BaseModel):
|
|
package_name: str
|
|
package_version: str | None = None
|
|
ecosystem: Ecosystem
|
|
license_spdx: str | None = None
|
|
is_direct: bool = True
|
|
is_dev: bool = False
|
|
|
|
|
|
class SBOMIngest(BaseModel):
|
|
repo_slug: str
|
|
entries: list[SBOMEntryCreate]
|
|
|
|
|
|
class SBOMEntryRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: uuid.UUID
|
|
repo_id: uuid.UUID
|
|
package_name: str
|
|
package_version: str | None = None
|
|
ecosystem: Ecosystem
|
|
license_spdx: str | None = None
|
|
is_direct: bool
|
|
is_dev: bool
|
|
snapshot_at: datetime
|
|
created_at: datetime
|
|
|
|
|
|
class LicenceGroup(BaseModel):
|
|
license_spdx: str | None
|
|
count: int
|
|
repos: list[str]
|
|
is_copyleft: bool
|
|
|
|
|
|
class LicenceReport(BaseModel):
|
|
groups: list[LicenceGroup]
|
|
copyleft_direct_count: int
|
|
|
|
|
|
class SBOMRepoView(BaseModel):
|
|
repo_slug: str
|
|
last_sbom_at: datetime | None = None
|
|
entry_count: int
|
|
entries: list[SBOMEntryRead]
|