. */ namespace SP\Domain\Account\In; use SP\Core\Exceptions\ConstraintException; use SP\Core\Exceptions\QueryException; use SP\Core\Exceptions\SPException; use SP\DataModel\AccountHistoryData; use SP\Domain\Account\Search\AccountSearchFilter; use SP\Domain\Account\Services\AccountPasswordRequest; use SP\Domain\Account\Services\AccountRequest; use SP\Domain\Common\In\RepositoryInterface; use SP\Domain\Common\Out\SimpleModel; use SP\Infrastructure\Database\QueryResult; use SP\Mvc\Model\QueryCondition; /** * Class AccountRepository * * @package Services */ interface AccountRepositoryInterface extends RepositoryInterface { /** * Devolver el número total de cuentas * * @throws QueryException * @throws ConstraintException */ public function getTotalNumAccounts(): SimpleModel; /** * @param int $id * * @return QueryResult * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function getPasswordForId(int $id): QueryResult; /** * @param int $id * * @return QueryResult * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function getPasswordHistoryForId(int $id): QueryResult; /** * Incrementa el contador de vista de clave de una cuenta en la BBDD * * @param int $id * * @return bool * @throws ConstraintException * @throws QueryException */ public function incrementDecryptCounter(int $id): bool; /** * Actualiza la clave de una cuenta en la BBDD. * * @param AccountRequest $accountRequest * * @return int * @throws ConstraintException * @throws QueryException */ public function editPassword(AccountRequest $accountRequest): int; /** * Actualiza la clave de una cuenta en la BBDD. * * @param AccountPasswordRequest $request * * @return bool * @throws ConstraintException * @throws QueryException */ public function updatePassword(AccountPasswordRequest $request): bool; /** * Restaurar una cuenta desde el histórico. * * @param \SP\DataModel\AccountHistoryData $accountHistoryData * @param int $userId User's Id * * @return bool * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function editRestore(AccountHistoryData $accountHistoryData, int $userId): bool; /** * Updates an item for bulk action * * @param AccountRequest $itemData * * @return int * @throws SPException */ public function updateBulk(AccountRequest $itemData): int; /** * Incrementa el contador de visitas de una cuenta en la BBDD * * @param int $id * * @return bool * @throws ConstraintException * @throws QueryException */ public function incrementViewCounter(int $id): bool; /** * Obtener los datos de una cuenta. * * @param int $id * * @return QueryResult * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function getDataForLink(int $id): QueryResult; /** * @param int|null $accountId * * @return QueryResult * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function getForUser(?int $accountId = null): QueryResult; /** * @param int $accountId * * @return QueryResult * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function getLinked(int $accountId): QueryResult; /** * Obtener los datos relativos a la clave de todas las cuentas. * * @return \SP\Infrastructure\Database\QueryResult * @throws ConstraintException * @throws QueryException */ public function getAccountsPassData(): QueryResult; }