# معماری — تسک ۰۴: ماژول بلاگ

## ساختار فایل‌ها
```
src/Module/Blog/
├── Controller/
│   ├── BlogController.php       ← CRUD بلاگ
│   └── BlogImageController.php  ← آپلود تصویر
├── Service/
│   ├── BlogService.php
│   └── ImageUploadService.php
├── Repository/
│   └── BlogRepository.php
├── Entity/
│   └── Blog.php
├── DTO/
│   ├── Request/
│   │   ├── CreateBlogRequest.php
│   │   └── UpdateBlogRequest.php
│   └── Response/
│       ├── BlogResponse.php
│       └── BlogListResponse.php
└── Voter/
    └── BlogVoter.php
```

## Entity: Blog
```php
#[ORM\Entity]
#[ORM\Table(name: 'blogs')]
class Blog
{
    #[ORM\Id, ORM\GeneratedValue, ORM\Column]
    private int $id;

    #[ORM\Column(type: UuidType::NAME, unique: true)]
    private Uuid $uuid;

    #[ORM\ManyToOne(targetEntity: User::class)]
    #[ORM\JoinColumn(nullable: false)]
    private User $author;

    #[ORM\Column(length: 300)]
    private string $title;

    #[ORM\Column(length: 300, unique: true)]
    private string $slug;

    #[ORM\Column(type: 'text')]
    private string $body;

    #[ORM\Column(type: 'text', nullable: true)]
    private ?string $summary;

    #[ORM\Column(length: 20, default: 'draft')]
    private string $status; // draft, published, archived

    #[ORM\Column(type: 'integer', default: 0)]
    private int $viewCount = 0;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $imagePath;

    #[ORM\ManyToMany(targetEntity: Category::class)]
    #[ORM\JoinTable(name: 'blog_tags')]
    private Collection $tags;

    // TimestampableTrait
}
```
