Source code for examples.shopvertical.events

from __future__ import annotations

from collections.abc import Sequence
from decimal import Decimal  # noqa: TC003
from typing import TYPE_CHECKING
from uuid import UUID  # noqa: TC003

from examples.aggregate7.immutablemodel import Immutable

if TYPE_CHECKING:
    from typing_extensions import TypeAlias


[docs] class DomainEvent(Immutable): originator_id: UUID originator_version: int
DomainEvents: TypeAlias = Sequence[DomainEvent]
[docs] class AddedProductToShop(DomainEvent): name: str description: str price: Decimal
[docs] class AdjustedProductInventory(DomainEvent): adjustment: int
[docs] class AddedItemToCart(DomainEvent): product_id: UUID name: str description: str price: Decimal
[docs] class RemovedItemFromCart(DomainEvent): product_id: UUID
[docs] class ClearedCart(DomainEvent): pass
[docs] class SubmittedCart(DomainEvent): pass