. */ namespace SP\Domain\User; use Defuse\Crypto\Exception\CryptoException; use SP\Core\Exceptions\ConstraintException; use SP\Core\Exceptions\QueryException; use SP\Core\Exceptions\SPException; use SP\DataModel\ItemSearchData; use SP\DataModel\UserData; use SP\DataModel\UserPreferencesData; use SP\Domain\User\Services\UserLoginRequest; use SP\Domain\User\Services\UserService; use SP\Infrastructure\Common\Repositories\DuplicatedItemException; use SP\Infrastructure\Common\Repositories\NoSuchItemException; use SP\Infrastructure\Database\QueryResult; /** * Class UserService * * @package SP\Domain\User\Services */ interface UserServiceInterface { /** * Actualiza el último inicio de sesión del usuario en la BBDD. * * @throws ConstraintException * @throws NoSuchItemException * @throws QueryException */ public function updateLastLoginById(int $id): int; /** * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function checkExistsByLogin(string $login): bool; /** * Returns the item for given id * * @throws SPException */ public function getById(int $id): UserData; /** * Returns the item for given id * * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Infrastructure\Common\Repositories\NoSuchItemException */ public function getByLogin(string $login): ?UserData; /** * Deletes an item * * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Infrastructure\Common\Repositories\NoSuchItemException */ public function delete(int $id): UserService; /** * @param int[] $ids * * @throws \SP\Domain\Common\Services\ServiceException * @throws ConstraintException * @throws QueryException */ public function deleteByIdBatch(array $ids): int; /** * Creates an item * * @throws SPException */ public function createOnLogin(UserLoginRequest $userLoginRequest): int; /** * Creates an item * * @throws SPException */ public function create(UserData $itemData): int; /** * Creates an item * * @throws SPException * @throws CryptoException */ public function createWithMasterPass(UserData $itemData, string $userPass, string $masterPass): int; /** * Searches for items by a given filter * * @throws ConstraintException * @throws QueryException */ public function search(ItemSearchData $searchData): QueryResult; /** * Updates an item * * @throws ConstraintException * @throws QueryException * @throws DuplicatedItemException * @throws \SP\Domain\Common\Services\ServiceException */ public function update(UserData $userData): void; /** * Updates a user's pass * * @throws ConstraintException * @throws QueryException * @throws \SP\Domain\Common\Services\ServiceException */ public function updatePass(int $userId, string $pass): void; /** * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function updatePreferencesById(int $userId, UserPreferencesData $userPreferencesData): int; /** * @throws ConstraintException * @throws QueryException */ public function updateOnLogin(UserLoginRequest $userLoginRequest): int; /** * Get all items from the service's repository * * @return UserData[] * @throws ConstraintException * @throws QueryException */ public function getAllBasic(): array; /** * Obtener el email de los usuarios de un grupo * * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException */ public function getUserEmailForGroup(int $groupId): array; /** * Obtener el email de los usuarios de un grupo * * @throws ConstraintException * @throws QueryException **/ public function getUserEmailForAll(): array; /** * Return the email of the given user's id * * @param int[] $ids * * @throws ConstraintException * @throws QueryException */ public function getUserEmailById(array $ids): array; /** * Returns the usage of the given user's id * * @throws ConstraintException * @throws QueryException */ public function getUsageForUser(int $id): array; }