feat: add UserId value object and update ClassifiedAd to use it

This commit is contained in:
2026-07-26 07:09:37 -04:00
parent 69ab1233e6
commit fb8c221ee9
7 changed files with 57 additions and 29 deletions

View File

@@ -1,35 +1,27 @@
# Plan: ClassifiedAd Domain Entity
# Plan: UserId Value Object
## Status: COMPLETED
## Objective
Create the first Domain Entity representing a ClassifiedAd with the specified attributes.
Create a UserId value object in the marketplace domain with an immutable UUID value.
## Decisions Made
- **Location**: `domain/marketplace/classified_ad.py`
- **Location**: `domain/marketplace/user_id.py`
- **Class style**: `@dataclass(frozen=True)` for immutability
- **Validation**: No validation, just hold data
- **Tests**: Yes, create unit tests
- **Tests**: Yes
## Entity Structure
## Value Object Structure
```python
@dataclass(frozen=True)
class ClassifiedAd:
id: UUID
_ownerId: UUID
title: str
text: str
_price: Decimal
class UserId:
value: UUID
```
## Files Created
- `domain/__init__.py`
- `domain/marketplace/__init__.py`
- `domain/marketplace/classified_ad.py`
- `tests/test_classified_ad.py`
- `pyproject.toml`
- `domain/marketplace/user_id.py`
- `tests/test_user_id.py`
## Test Results
- `test_classified_ad_creation` - PASSED
- `test_classified_ad_is_immutable` - PASSED
- `test_classified_ad_equality` - PASSED
- `test_user_id_creation` - PASSED
- `test_user_id_is_immutable` - PASSED
- `test_user_id_equality` - PASSED