mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-18 05:20:45 +01:00
Move SignRequestStatus from lib/Db/ to lib/Enum/ to follow project convention of keeping all enums in a dedicated folder alongside CRLStatus, CRLReason, CertificateType, and DocMdpLevel. Updated namespace from OCA\Libresign\Db to OCA\Libresign\Enum and adjusted all imports and references across: - SignRequest entity (added import) - ValidateHelper (updated FQN references) - RequestSignatureService (updated FQN references) - SequentialSigningService (updated import) - SignFileService (updated FQN reference) This improves code organization by consolidating all enum types in one location. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
76 lines
2.4 KiB
PHP
76 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/**
|
|
* SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OCA\Libresign\Db;
|
|
|
|
use OCA\Libresign\Enum\SignRequestStatus;
|
|
use OCP\AppFramework\Db\Entity;
|
|
use OCP\DB\Types;
|
|
|
|
/**
|
|
* @method void setId(int $uid)
|
|
* @method int getId()
|
|
* @method void setFileId(int $fileId)
|
|
* @method ?int getFileId()
|
|
* @method void setUuid(string $uuid)
|
|
* @method string getUuid()
|
|
* @method void setDescription(string $description)
|
|
* @method ?string getDescription()
|
|
* @method void setCreatedAt(\DateTime $createdAt)
|
|
* @method \DateTime getCreatedAt()
|
|
* @method void setSigned(\DateTime $signed)
|
|
* @method ?\DateTime getSigned()
|
|
* @method void setSignedHash(string $hash)
|
|
* @method ?string getSignedHash()
|
|
* @method void setDisplayName(string $displayName)
|
|
* @method string getDisplayName()
|
|
* @method void setMetadata(array $metadata)
|
|
* @method ?array getMetadata()
|
|
* @method void setDocmdpLevel(int $docmdpLevel)
|
|
* @method int getDocmdpLevel()
|
|
* @method void setSigningOrder(int $signingOrder)
|
|
* @method int getSigningOrder()
|
|
* @method void setStatus(int $status)
|
|
* @method int getStatus()
|
|
*/
|
|
class SignRequest extends Entity {
|
|
protected ?int $fileId = null;
|
|
protected string $uuid = '';
|
|
protected string $displayName = '';
|
|
protected ?string $description = null;
|
|
protected ?\DateTime $createdAt = null;
|
|
protected ?\DateTime $signed = null;
|
|
protected ?string $signedHash = null;
|
|
protected ?array $metadata = null;
|
|
protected int $docmdpLevel = 0;
|
|
protected int $signingOrder = 1;
|
|
protected int $status = 0;
|
|
|
|
public function __construct() {
|
|
$this->addType('id', Types::INTEGER);
|
|
$this->addType('fileId', Types::INTEGER);
|
|
$this->addType('uuid', Types::STRING);
|
|
$this->addType('displayName', Types::STRING);
|
|
$this->addType('description', Types::STRING);
|
|
$this->addType('createdAt', Types::DATETIME);
|
|
$this->addType('signed', Types::DATETIME);
|
|
$this->addType('signedHash', Types::STRING);
|
|
$this->addType('metadata', Types::JSON);
|
|
$this->addType('docmdpLevel', Types::SMALLINT);
|
|
$this->addType('signingOrder', Types::INTEGER);
|
|
$this->addType('status', Types::SMALLINT);
|
|
}
|
|
|
|
public function getStatusEnum(): SignRequestStatus {
|
|
return SignRequestStatus::from($this->status);
|
|
}
|
|
|
|
public function setStatusEnum(SignRequestStatus $status): void {
|
|
$this->setStatus($status->value);
|
|
}
|
|
}
|