diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/TextToImage/Db/Task.php | 10 | ||||
-rw-r--r-- | lib/public/TextToImage/Task.php | 22 |
2 files changed, 29 insertions, 3 deletions
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; } } diff --git a/lib/public/TextToImage/Task.php b/lib/public/TextToImage/Task.php index 2f9869bc55a..20ae32e0f6b 100644 --- a/lib/public/TextToImage/Task.php +++ b/lib/public/TextToImage/Task.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace OCP\TextToImage; +use DateTime; use OCP\Files\AppData\IAppDataFactory; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; @@ -39,6 +40,8 @@ use OCP\Image; final class Task implements \JsonSerializable { protected ?int $id = null; + protected DateTime $completionExpectedAt; + /** * @since 28.0.0 */ @@ -125,6 +128,22 @@ final class Task implements \JsonSerializable { } /** + * @param DateTime $at + * @since 28.0.0 + */ + final public function setCompletionExpectedAt(DateTime $at): void { + $this->completionExpectedAt = $at; + } + + /** + * @return DateTime + * @since 28.0.0 + */ + final public function getCompletionExpectedAt(): DateTime { + return $this->completionExpectedAt; + } + + /** * @return int|null * @since 28.0.0 */ @@ -173,7 +192,7 @@ final class Task implements \JsonSerializable { } /** - * @psalm-return array{id: ?int, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, identifier: ?string, numberOfImages: int} + * @psalm-return array{id: ?int, status: 0|1|2|3|4, userId: ?string, appId: string, input: string, identifier: ?string, numberOfImages: int, completionExpectedAt: int} * @since 28.0.0 */ public function jsonSerialize(): array { @@ -185,6 +204,7 @@ final class Task implements \JsonSerializable { 'numberOfImages' => $this->getNumberOfImages(), 'input' => $this->getInput(), 'identifier' => $this->getIdentifier(), + 'completionExpectedAt' => $this->getCompletionExpectedAt()->getTimestamp(), ]; } } |