From 946a1af9fd20d12a2ee6240ad2ae24827a22278c Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Thu, 12 Jan 2023 15:47:20 +0100 Subject: add 'last used timestamp' management for reference providers Signed-off-by: Julien Veyssier --- core/Controller/ReferenceApiController.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'core/Controller/ReferenceApiController.php') diff --git a/core/Controller/ReferenceApiController.php b/core/Controller/ReferenceApiController.php index 098940187a8..9c3a212e8d7 100644 --- a/core/Controller/ReferenceApiController.php +++ b/core/Controller/ReferenceApiController.php @@ -31,10 +31,15 @@ use OCP\IRequest; class ReferenceApiController extends \OCP\AppFramework\OCSController { private IReferenceManager $referenceManager; + private ?string $userId; - public function __construct(string $appName, IRequest $request, IReferenceManager $referenceManager) { + public function __construct(string $appName, + IRequest $request, + IReferenceManager $referenceManager, + ?string $userId) { parent::__construct($appName, $request); $this->referenceManager = $referenceManager; + $this->userId = $userId; } /** @@ -102,4 +107,17 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController { }, $providers); return new DataResponse($jsonProviders); } + + /** + * @NoAdminRequired + * + * @param string $providerId + * @return DataResponse + */ + public function touchProvider(string $providerId, ?int $timestamp = null): DataResponse { + if ($this->userId !== null) { + $this->referenceManager->touchProvider($this->userId, $providerId, $timestamp); + } + return new DataResponse(['success' => true]); + } } -- cgit v1.2.3