Added application IDs

This commit is contained in:
Pinga 2023-12-19 09:20:25 +02:00
parent 3a6319fe6d
commit 8bb3ed7900
5 changed files with 33 additions and 1 deletions

View file

@ -339,6 +339,18 @@ class ApplicationsController extends Controller
]);
$domain_id = $db->getlastInsertId();
$uuid = createUuidFromId($domain_id);
$db->update(
'application',
[
'application_id' => $uuid
],
[
'id' => $domain_id
]
);
$db->insert('application_status', [
'domain_id' => $domain_id,
'status' => 'pendingValidation'

View file

@ -11,6 +11,9 @@ use League\Flysystem\Local\LocalFilesystemAdapter;
use League\Flysystem\Filesystem;
use MatthiasMullie\Scrapbook\Adapters\Flysystem as ScrapbookFlysystem;
use MatthiasMullie\Scrapbook\Psr6\Pool;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\Guid\Guid;
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
/**
* @return mixed|string|string[]
@ -368,3 +371,17 @@ function getDomainPrice($db, $domain_name, $tld_id, $date_add = 12, $command = '
return ['type' => 'not_found', 'price' => 0];
}
function createUuidFromId($id) {
// Define a namespace UUID; this should be a UUID that is unique to your application
$namespace = '123e4567-e89b-12d3-a456-426614174000';
// Generate a UUIDv5 based on the namespace and a name (in this case, the $id)
try {
$uuid5 = Uuid::uuid5($namespace, (string)$id);
return $uuid5->toString();
} catch (UnsatisfiedDependencyException $e) {
// Handle exception
return null;
}
}

View file

@ -43,7 +43,8 @@
"matthiasmullie/scrapbook": "^1.5",
"guzzlehttp/guzzle": "^7.8",
"league/flysystem": "^3.23",
"mpociot/vat-calculator": "^3.6"
"mpociot/vat-calculator": "^3.6",
"ramsey/uuid": "^4.7"
},
"autoload": {
"psr-4": {

View file

@ -373,6 +373,7 @@ CREATE TABLE IF NOT EXISTS `registry`.`application` (
`transfer_exdate` datetime(3) default NULL,
`idnlang` varchar(16) default NULL,
`delTime` datetime(3) default NULL,
`application_id` varchar(36) default NULL,
`authtype` enum('pw','ext') NOT NULL default 'pw',
`authinfo` varchar(64) NOT NULL,
`phase_name` VARCHAR(75) DEFAULT NULL,

View file

@ -371,6 +371,7 @@ CREATE TABLE registry.application (
"transfer_exdate" timestamp(3) without time zone default NULL,
"idnlang" varchar(16) default NULL,
"deltime" timestamp(3) without time zone default NULL,
"application_id" varchar(36) default NULL,
"authtype" varchar CHECK ("authtype" IN ( 'pw','ext' )) NOT NULL default 'pw',
"authinfo" varchar(64) NOT NULL,
"phase_name" VARCHAR(75) DEFAULT NULL,