• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LeTraceurSnorkLibrary / MessSaga / 23844646769

01 Apr 2026 10:42AM UTC coverage: 31.674% (+31.1%) from 0.549%
23844646769

push

github

web-flow
feat: media files import

431 of 801 new or added lines in 30 files covered. (53.81%)

4 existing lines in 4 files now uncovered.

439 of 1386 relevant lines covered (31.67%)

0.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/Http/Controllers/ChatImportController.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace App\Http\Controllers;
6

7
use App\Jobs\ProcessChatImport;
8
use App\Services\Import\DTO\ImportModeDTO;
9
use App\Services\Import\ImportStrategyFactory;
10
use Illuminate\Http\JsonResponse;
11
use Illuminate\Http\Request;
12

13
class ChatImportController extends Controller
14
{
15
    /**
16
     * @param ImportStrategyFactory $strategyFactory
17
     */
18
    public function __construct(
19
        private readonly ImportStrategyFactory $strategyFactory
20
    ) {
21
    }
×
22

23
    /**
24
     * Запускает импорт переписки с учётом выбранного режима.
25
     *
26
     * @param Request $request
27
     *
28
     * @return JsonResponse
29
     */
30
    public function store(Request $request): JsonResponse
31
    {
32
        $data = $request->validate([
×
33
            'messenger_type'         => 'required|string|in:telegram,whatsapp,viber',
×
NEW
34
            'file'                   => 'required|file|max:262144',
×
35
            'import_mode'            => 'required|string|in:auto,new,select',
×
36
            'target_conversation_id' => 'nullable|integer|exists:conversations,id',
×
37
        ]);
×
38

NEW
39
        $exportFileStoredPath = $request->file('file')->store('chat_imports');
×
40

41
        /**
42
         * @var string $import_mode
43
         */
44
        $import_mode          = $data['import_mode'];
×
45
        $requestUserId        = $request->user()->id;
×
46
        $targetConversationId = isset($data['target_conversation_id'])
×
47
            ? (int)$data['target_conversation_id']
×
48
            : null;
×
49
        $importModeDTO        = new ImportModeDTO(
×
50
            $import_mode,
×
51
            $requestUserId,
×
52
            $targetConversationId
×
53
        );
×
54

55
        $strategy = $this->strategyFactory
×
56
            ->createStrategy($importModeDTO);
×
57

58
        ProcessChatImport::dispatch(
×
59
            userId: $requestUserId,
×
60
            messengerType: $data['messenger_type'],
×
NEW
61
            exportFileStoredPath: $exportFileStoredPath,
×
62
            strategy: $strategy,
×
63
        );
×
64

65
        return response()->json([
×
66
            'status'  => 'queued',
×
67
            'message' => 'Импорт поставлен в очередь',
×
68
        ]);
×
69
    }
70
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc