Migrate backend to Porto architecture and fix minor bugs

- Fully transitioned the backend to the Porto architectural pattern
- Improved code organization and maintainability
- Fixed minor bugs and inconsistencies
This commit is contained in:
F4ilji
2025-05-12 08:47:43 +05:00
parent 76deaf75f3
commit c01016a154
620 changed files with 16218 additions and 6073 deletions
@@ -2,9 +2,10 @@
namespace App\Services\Filament\Domain\Posts;
use App\Enums\PostStatus;
use App\Containers\Article\Enums\PostStatus;
use App\Containers\Article\Models\Post;
use App\Jobs\CreateVkPost;
use App\Models\Post;
use App\Jobs\UpdateVkPost;
use Illuminate\Support\Facades\Storage;
class VkPostPublisher
@@ -18,18 +19,31 @@ class VkPostPublisher
*/
public function publish(array $settings, Post $post): void
{
if ($post->status === PostStatus::PUBLISHED) {
if ($post->status->value === PostStatus::PUBLISHED->value) {
if ($settings['vk']) {
$text = $this->generateContentForVk($post->content);
$images = $this->generateImageLinksForVk($post->images);
$publishDate = $post->publish_at > now() ? $post->publish_at->timestamp : null;
dispatch(new CreateVkPost($post->title, $text, $images, $post->id, $publishDate));
}
}
}
public function update(array $settings, Post $post): void
{
if ($post->status->value === PostStatus::PUBLISHED->value) {
if ($settings['vk']) {
$text = $this->generateContentForVk($post->content);
$images = $this->generateImageLinksForVk($post->images);
$publishDate = $post->publish_at > now() ? $post->publish_at->timestamp : null;
dispatch(new UpdateVkPost($post->title, $text, $images, $post->id, $publishDate));
}
}
}
/**
* Генерирует текстовый контент для ВКонтакте.
*