James Cole
2024-11-09 06:23:28 +01:00
parent 2723e05d2a
commit 2714ee96f1
3 changed files with 8 additions and 2 deletions

View File

@@ -112,7 +112,12 @@ class StoreController extends Controller
return response()->json([], 422); return response()->json([], 422);
} }
$helper->saveAttachmentFromApi($attachment, $body); $result = $helper->saveAttachmentFromApi($attachment, $body);
if(false === $result) {
app('log')->error('Could not save attachment from API.');
return response()->json([], 422);
}
return response()->json([], 204); return response()->json([], 204);
} }

View File

@@ -93,7 +93,7 @@ trait AttachmentCollection
->where( ->where(
static function (EloquentBuilder $q1): void { // @phpstan-ignore-line static function (EloquentBuilder $q1): void { // @phpstan-ignore-line
$q1->where('attachments.attachable_type', TransactionJournal::class); $q1->where('attachments.attachable_type', TransactionJournal::class);
$q1->where('attachments.uploaded', true); // $q1->where('attachments.uploaded', true);
$q1->whereNull('attachments.deleted_at'); $q1->whereNull('attachments.deleted_at');
$q1->orWhereNull('attachments.attachable_type'); $q1->orWhereNull('attachments.attachable_type');
} }

View File

@@ -255,6 +255,7 @@ return [
'allowedMimes' => [ 'allowedMimes' => [
// plain files // plain files
'text/plain', 'text/plain',
'text/html',
// images // images
'image/jpeg', 'image/jpeg',