From f46ee43d4cf6aa4804e9b5fd6932466d506e20d6 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Tue, 5 Nov 2024 16:48:48 -0300 Subject: [PATCH] feat: Save file to LibeSign every when a new file is uploaded Signed-off-by: Vitor Mattos --- lib/Controller/FileController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Controller/FileController.php b/lib/Controller/FileController.php index b91f13e9f1..8b68dcee74 100644 --- a/lib/Controller/FileController.php +++ b/lib/Controller/FileController.php @@ -10,6 +10,7 @@ use OCA\Files_Sharing\SharedStorage; use OCA\Libresign\AppInfo\Application; +use OCA\Libresign\Db\File as FileEntity; use OCA\Libresign\Db\SignRequestMapper; use OCA\Libresign\Exception\LibresignException; use OCA\Libresign\Helper\JSActions; @@ -19,6 +20,7 @@ use OCA\Libresign\Service\AccountService; use OCA\Libresign\Service\FileService; use OCA\Libresign\Service\IdentifyMethodService; +use OCA\Libresign\Service\RequestSignatureService; use OCA\Libresign\Service\SessionService; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; @@ -59,6 +61,7 @@ public function __construct( private SessionService $sessionService, private SignRequestMapper $signRequestMapper, private IdentifyMethodService $identifyMethodService, + private RequestSignatureService $requestSignatureService, private AccountService $accountService, private IRootFolder $root, private IPreview $preview, @@ -370,6 +373,15 @@ public function save(array $file, string $name = '', array $settings = []): Data 'file' => $file, 'settings' => $settings ]); + $data = [ + 'file' => [ + 'fileNode' => $node, + ], + 'name' => $name, + 'userManager' => $this->userSession->getUser(), + 'status' => FileEntity::STATUS_DRAFT, + ]; + $file = $this->requestSignatureService->save($data); return new DataResponse( [