From 9ee72633cf78a777756d2d4afe707f2539521ccc Mon Sep 17 00:00:00 2001
From: Marcel Klehr <mklehr@gmx.net>
Date: Fri, 20 Oct 2023 13:54:36 +0200
Subject: enh(Text2Image): Expose expected completion time

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
---
 lib/private/TextToImage/Db/Task.php | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'lib/private')

diff --git a/lib/private/TextToImage/Db/Task.php b/lib/private/TextToImage/Db/Task.php
index 8d857ce47ea..312ed07880b 100644
--- a/lib/private/TextToImage/Db/Task.php
+++ b/lib/private/TextToImage/Db/Task.php
@@ -46,6 +46,8 @@ use OCP\TextToImage\Task as OCPTask;
  * @method string|null getIdentifier()
  * @method setNumberOfImages(int $numberOfImages)
  * @method int getNumberOfImages()
+ * @method setCompletionExpectedAt(DateTime $at)
+ * @method DateTime getCompletionExpectedAt()
  */
 class Task extends Entity {
 	protected $lastUpdated;
@@ -56,16 +58,17 @@ class Task extends Entity {
 	protected $appId;
 	protected $identifier;
 	protected $numberOfImages;
+	protected $completionExpectedAt;
 
 	/**
 	 * @var string[]
 	 */
-	public static array $columns = ['id', 'last_updated', 'input', 'status', 'user_id', 'app_id', 'identifier', 'number_of_images'];
+	public static array $columns = ['id', 'last_updated', 'input', 'status', 'user_id', 'app_id', 'identifier', 'number_of_images', 'completion_expected_at'];
 
 	/**
 	 * @var string[]
 	 */
-	public static array $fields = ['id', 'lastUpdated', 'input', 'status', 'userId', 'appId', 'identifier', 'numberOfImages'];
+	public static array $fields = ['id', 'lastUpdated', 'input', 'status', 'userId', 'appId', 'identifier', 'numberOfImages', 'completionExpectedAt'];
 
 
 	public function __construct() {
@@ -78,6 +81,7 @@ class Task extends Entity {
 		$this->addType('appId', 'string');
 		$this->addType('identifier', 'string');
 		$this->addType('numberOfImages', 'integer');
+		$this->addType('completionExpectedAt', 'datetime');
 	}
 
 	public function toRow(): array {
@@ -97,6 +101,7 @@ class Task extends Entity {
 			'userId' => $task->getUserId(),
 			'appId' => $task->getAppId(),
 			'identifier' => $task->getIdentifier(),
+			'completionExpectedAt' => $task->getCompletionExpectedAt(),
 		]);
 		return $dbTask;
 	}
@@ -105,6 +110,7 @@ class Task extends Entity {
 		$task = new OCPTask($this->getInput(), $this->getAppId(), $this->getNumberOfImages(), $this->getuserId(), $this->getIdentifier());
 		$task->setId($this->getId());
 		$task->setStatus($this->getStatus());
+		$task->setCompletionExpectedAt($this->getCompletionExpectedAt());
 		return $task;
 	}
 }
-- 
cgit v1.2.3