Add API endpoints for listing tagged versions and artifacts
- Enhanced GET /api/v1/project/{project}/{package}/tags with pagination,
search, sort, order parameters and artifact metadata
- Added GET /api/v1/project/{project}/{package}/tags/{tag_name} for
single tag with full artifact details
- Added GET /api/v1/project/{project}/{package}/tags/{tag_name}/history
for tag change history
- Added GET /api/v1/project/{project}/{package}/artifacts for listing
all artifacts in a package with filtering by content_type and date range
- Enhanced GET /api/v1/artifact/{artifact_id} to include list of
packages/tags referencing the artifact
- Added new schemas: TagDetailResponse, TagHistoryResponse,
ArtifactDetailResponse, ArtifactTagInfo, PackageArtifactResponse
This commit is contained in:
@@ -129,6 +129,78 @@ class TagResponse(BaseModel):
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class TagDetailResponse(BaseModel):
|
||||
"""Tag with embedded artifact metadata"""
|
||||
id: UUID
|
||||
package_id: UUID
|
||||
name: str
|
||||
artifact_id: str
|
||||
created_at: datetime
|
||||
created_by: str
|
||||
# Artifact metadata
|
||||
artifact_size: int
|
||||
artifact_content_type: Optional[str]
|
||||
artifact_original_name: Optional[str]
|
||||
artifact_created_at: datetime
|
||||
artifact_format_metadata: Optional[Dict[str, Any]] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class TagHistoryResponse(BaseModel):
|
||||
"""History entry for tag changes"""
|
||||
id: UUID
|
||||
tag_id: UUID
|
||||
old_artifact_id: Optional[str]
|
||||
new_artifact_id: str
|
||||
changed_at: datetime
|
||||
changed_by: str
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ArtifactTagInfo(BaseModel):
|
||||
"""Tag info for embedding in artifact responses"""
|
||||
id: UUID
|
||||
name: str
|
||||
package_id: UUID
|
||||
package_name: str
|
||||
project_name: str
|
||||
|
||||
|
||||
class ArtifactDetailResponse(BaseModel):
|
||||
"""Artifact with list of tags/packages referencing it"""
|
||||
id: str
|
||||
size: int
|
||||
content_type: Optional[str]
|
||||
original_name: Optional[str]
|
||||
created_at: datetime
|
||||
created_by: str
|
||||
ref_count: int
|
||||
format_metadata: Optional[Dict[str, Any]] = None
|
||||
tags: List[ArtifactTagInfo] = []
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class PackageArtifactResponse(BaseModel):
|
||||
"""Artifact with tags for package artifact listing"""
|
||||
id: str
|
||||
size: int
|
||||
content_type: Optional[str]
|
||||
original_name: Optional[str]
|
||||
created_at: datetime
|
||||
created_by: str
|
||||
format_metadata: Optional[Dict[str, Any]] = None
|
||||
tags: List[str] = [] # Tag names pointing to this artifact
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
# Upload response
|
||||
class UploadResponse(BaseModel):
|
||||
artifact_id: str
|
||||
|
||||
Reference in New Issue
Block a user