diff --git a/app/Contracts/Repository/ServerRepositoryInterface.php b/app/Contracts/Repository/ServerRepositoryInterface.php index a53f83ad7..0dfcd9cad 100644 --- a/app/Contracts/Repository/ServerRepositoryInterface.php +++ b/app/Contracts/Repository/ServerRepositoryInterface.php @@ -51,11 +51,6 @@ interface ServerRepositoryInterface extends RepositoryInterface */ public function getByUuid(string $uuid): Server; - /** - * Check if a given UUID and UUID-Short string are unique to a server. - */ - public function isUniqueUuidCombo(string $uuid, string $short): bool; - /** * Returns all the servers that exist for a given node in a paginated response. */ diff --git a/app/Repositories/Eloquent/ServerRepository.php b/app/Repositories/Eloquent/ServerRepository.php index 914edfb36..964bec250 100644 --- a/app/Repositories/Eloquent/ServerRepository.php +++ b/app/Repositories/Eloquent/ServerRepository.php @@ -134,14 +134,6 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt } } - /** - * Check if a given UUID and UUID-Short string are unique to a server. - */ - public function isUniqueUuidCombo(string $uuid, string $short): bool - { - return !$this->getBuilder()->where('uuid', '=', $uuid)->orWhere('uuidShort', '=', $short)->exists(); - } - /** * Returns all the servers that exist for a given node in a paginated response. */ diff --git a/app/Services/Servers/ServerCreationService.php b/app/Services/Servers/ServerCreationService.php index 2c9b4cf84..b959893e6 100644 --- a/app/Services/Servers/ServerCreationService.php +++ b/app/Services/Servers/ServerCreationService.php @@ -206,8 +206,9 @@ class ServerCreationService private function generateUniqueUuidCombo(): string { $uuid = Uuid::uuid4()->toString(); + $shortUuid = substr($uuid, 0, 8); - if (!$this->repository->isUniqueUuidCombo($uuid, substr($uuid, 0, 8))) { + if (!Server::query()->where('uuid', $uuid)->orWhere('uuidShort', $shortUuid)->exists()) { return $this->generateUniqueUuidCombo(); }