|
@@ -8,7 +8,9 @@ use App\Models\Action;
|
|
|
use App\Models\Enums\ActionObjectType;
|
|
|
use App\Models\Enums\FileObjectType;
|
|
|
use App\Models\Enums\ObjectAction;
|
|
|
+use App\Models\File;
|
|
|
use App\Repositories\ActionRepository;
|
|
|
+use App\Repositories\ContainerFileRepository;
|
|
|
use App\Services\File\FileAssociationService;
|
|
|
use App\Services\File\ImageUrlService;
|
|
|
use DOMDocument;
|
|
@@ -21,10 +23,17 @@ class ActionController extends Controller
|
|
|
{
|
|
|
$actionObjectType = ActionObjectType::from($objectType);
|
|
|
|
|
|
- $actionObjectType->modelBuilder()->where("company_id", Auth::user()->company_id)->findOrFail($objectId);
|
|
|
+ $model = $actionObjectType->modelBuilder()->where("company_id", Auth::user()->company_id)->findOrFail($objectId);
|
|
|
+
|
|
|
+ $objectIds = [$objectId];
|
|
|
+ if (ActionObjectType::CONTAINER_FILE->value == $objectType) {
|
|
|
+ ContainerFileRepository::getAllVersionFiles($model)->each(function ($file) use (&$objectIds) {
|
|
|
+ $objectIds[] = $file->id;
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
return $this->success([
|
|
|
- 'data' => ActionRepository::actionWithHistory($actionObjectType, $objectId),
|
|
|
+ 'data' => ActionRepository::actionWithHistory($actionObjectType, $objectIds),
|
|
|
]);
|
|
|
}
|
|
|
|