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

LeTraceurSnorkLibrary / MessSaga / 23856747972

01 Apr 2026 03:31PM UTC coverage: 31.083% (-0.6%) from 31.674%
23856747972

Pull #15

github

web-flow
Merge 834925aa9 into a7d6f3637
Pull Request #15: feat: add s3 as storage

24 of 80 new or added lines in 10 files covered. (30.0%)

3 existing lines in 3 files now uncovered.

442 of 1422 relevant lines covered (31.08%)

0.73 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',
×
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
        $importsTmpDisk       = (string)config('filesystems.imports_tmp_disk', 'imports_tmp');
×
NEW
40
        $exportFileStoredPath = $request->file('file')->store('chat_imports', $importsTmpDisk);
×
41

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

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

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

66
        return response()->json([
×
67
            'status'  => 'queued',
×
68
            'message' => 'Импорт поставлен в очередь',
×
69
        ]);
×
70
    }
71
}
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