52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
"""Artifact + ArtifactRelationship domain events."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Dict, Optional
|
|
from uuid import UUID
|
|
|
|
from asf_events.base import ASFEvent
|
|
|
|
|
|
class ArtifactCreated(ASFEvent):
|
|
event_type: str = "artifact.created"
|
|
artifact_id: UUID
|
|
artifact_type: str
|
|
project_id: UUID
|
|
payload: Dict[str, Any]
|
|
|
|
|
|
class ArtifactUpdated(ASFEvent):
|
|
event_type: str = "artifact.updated"
|
|
artifact_id: UUID
|
|
artifact_type: str
|
|
project_id: UUID
|
|
changed_fields: list[str]
|
|
previous_version: int
|
|
payload: Dict[str, Any]
|
|
|
|
|
|
class ArtifactDeleted(ASFEvent):
|
|
event_type: str = "artifact.deleted"
|
|
artifact_id: UUID
|
|
artifact_type: str
|
|
project_id: UUID
|
|
|
|
|
|
class ArtifactRelationshipCreated(ASFEvent):
|
|
event_type: str = "artifact.relationship.created"
|
|
relationship_id: UUID
|
|
source_artifact_id: UUID
|
|
target_artifact_id: UUID
|
|
relationship_type: str
|
|
source_project_id: UUID
|
|
target_project_id: UUID
|
|
payload: Dict[str, Any] = {}
|
|
|
|
|
|
class ArtifactRelationshipDeleted(ASFEvent):
|
|
event_type: str = "artifact.relationship.deleted"
|
|
relationship_id: UUID
|
|
source_artifact_id: UUID
|
|
target_artifact_id: UUID
|