mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-13 16:16:59 +02:00
Added launch phase management in cp; allocation tokens in db
This commit is contained in:
parent
b20a44ecb0
commit
34fe2a866f
6 changed files with 221 additions and 10 deletions
|
@ -56,7 +56,7 @@
|
||||||
"set @audit_rownum = ifnull(@audit_rownum, 0) + 1;"
|
"set @audit_rownum = ifnull(@audit_rownum, 0) + 1;"
|
||||||
],
|
],
|
||||||
"tables": {
|
"tables": {
|
||||||
"launch_phase": {
|
"launch_phases": {
|
||||||
"audit": true,
|
"audit": true,
|
||||||
"skip": null
|
"skip": null
|
||||||
},
|
},
|
||||||
|
@ -76,6 +76,10 @@
|
||||||
"audit": true,
|
"audit": true,
|
||||||
"skip": null
|
"skip": null
|
||||||
},
|
},
|
||||||
|
"allocation_tokens": {
|
||||||
|
"audit": null,
|
||||||
|
"skip": null
|
||||||
|
},
|
||||||
"error_log": {
|
"error_log": {
|
||||||
"audit": null,
|
"audit": null,
|
||||||
"skip": null
|
"skip": null
|
||||||
|
|
|
@ -783,6 +783,8 @@ class SystemController extends Controller
|
||||||
$premium_categories = $db->select('SELECT * FROM premium_domain_categories');
|
$premium_categories = $db->select('SELECT * FROM premium_domain_categories');
|
||||||
$promotions = $db->select('SELECT * FROM promotion_pricing WHERE tld_id = ?',
|
$promotions = $db->select('SELECT * FROM promotion_pricing WHERE tld_id = ?',
|
||||||
[ $tld['id'] ]);
|
[ $tld['id'] ]);
|
||||||
|
$launch_phases = $db->select('SELECT * FROM launch_phases WHERE tld_id = ?',
|
||||||
|
[ $tld['id'] ]);
|
||||||
|
|
||||||
// Mapping of regex patterns to script names
|
// Mapping of regex patterns to script names
|
||||||
$regexToScriptName = [
|
$regexToScriptName = [
|
||||||
|
@ -812,6 +814,7 @@ class SystemController extends Controller
|
||||||
'premium_pricing' => $premium_pricing,
|
'premium_pricing' => $premium_pricing,
|
||||||
'premium_categories' => $premium_categories,
|
'premium_categories' => $premium_categories,
|
||||||
'promotions' => $promotions,
|
'promotions' => $promotions,
|
||||||
|
'launch_phases' => $launch_phases,
|
||||||
'currentUri' => $uri
|
'currentUri' => $uri
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -989,5 +992,77 @@ class SystemController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function managePhases(Request $request, Response $response)
|
||||||
|
{
|
||||||
|
if ($_SESSION["auth_roles"] != 0) {
|
||||||
|
return $response->withHeader('Location', '/dashboard')->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->getMethod() === 'POST') {
|
||||||
|
// Retrieve POST data
|
||||||
|
$data = $request->getParsedBody();
|
||||||
|
$db = $this->container->get('db');
|
||||||
|
|
||||||
|
$sData = array();
|
||||||
|
|
||||||
|
$sData['tldid'] = filter_var($data['tldid'], FILTER_SANITIZE_NUMBER_INT);
|
||||||
|
$sData['extension'] = substr(trim($data['extension']), 0, 10);
|
||||||
|
$sData['phaseName'] = substr(trim($data['phaseName']), 0, 255);
|
||||||
|
$sData['phaseType'] = substr(trim($data['phaseType']), 0, 255);
|
||||||
|
$sData['phaseDescription'] = substr(trim($data['phaseDescription']), 0, 1000);
|
||||||
|
$sData['phaseStart'] = date('Y-m-d', strtotime($data['phaseStart']));
|
||||||
|
$sData['phaseEnd'] = date('Y-m-d', strtotime($data['phaseEnd']));
|
||||||
|
|
||||||
|
try {
|
||||||
|
$currentDateTime = new \DateTime();
|
||||||
|
$update = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
||||||
|
|
||||||
|
$db->beginTransaction();
|
||||||
|
|
||||||
|
$existingPhaseType = $db->selectValue(
|
||||||
|
'SELECT COUNT(*) FROM launch_phases WHERE tld_id = ? AND phase_type = ?',
|
||||||
|
[
|
||||||
|
$sData['tldid'],
|
||||||
|
$sData['phaseType']
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($existingPhaseType > 0) {
|
||||||
|
// phase_type already exists for the tldid
|
||||||
|
$db->rollBack();
|
||||||
|
$this->container->get('flash')->addMessage('error', 'The phase type already exists for this TLD.');
|
||||||
|
return $response->withHeader('Location', '/registry/tld/'.$sData['extension'])->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->insert(
|
||||||
|
'launch_phases',
|
||||||
|
[
|
||||||
|
'tld_id' => $sData['tldid'],
|
||||||
|
'phase_name' => $sData['phaseName'],
|
||||||
|
'phase_type' => $sData['phaseType'],
|
||||||
|
'phase_description' => $sData['phaseDescription'],
|
||||||
|
'start_date' => $sData['phaseStart'],
|
||||||
|
'end_date' => $sData['phaseEnd'],
|
||||||
|
'lastupdate' => $update
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$db->commit();
|
||||||
|
|
||||||
|
$this->container->get('flash')->addMessage('success', 'Launch phase updates for the ' . $sData['extension'] . ' TLD have been successfully applied');
|
||||||
|
return $response->withHeader('Location', '/registry/tlds')->withStatus(302);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$db->rollBack();
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Database failure: ' . $e->getMessage());
|
||||||
|
return $response->withHeader('Location', '/registry/tld/'.$sData['extension'])->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Redirect to the tlds view
|
||||||
|
return $response->withHeader('Location', '/registry/tlds')->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -191,7 +191,7 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h5 class="card-title">Manage Promotions</h5>
|
<h5 class="card-title">Manage Promotions</h5>
|
||||||
</div>
|
</div>
|
||||||
|
@ -284,6 +284,88 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title">Manage Launch Phases</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="table-responsive mb-3">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Phase Type</th>
|
||||||
|
<th>Phase Name</th>
|
||||||
|
<th>Phase Description</th>
|
||||||
|
<th>Start Date</th>
|
||||||
|
<th>End Date</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for phase in launch_phases %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ phase.id }}</td>
|
||||||
|
<td>{{ phase.phase_type }}</td>
|
||||||
|
<td>{{ phase.phase_name }}</td>
|
||||||
|
<td>{{ phase.phase_description }}</td>
|
||||||
|
<td>{{ phase.start_date }}</td>
|
||||||
|
<td>{{ phase.end_date }}</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">No launch phases found.</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<h4 class="card-subtitle mt-3 mb-3">Create New Phase</h4>
|
||||||
|
<form action="/registry/phases" method="post">
|
||||||
|
{{ csrf.field | raw }}
|
||||||
|
<input type="hidden" name="tldid" value="{{ tld.id }}"><input type="hidden" name="extension" value="{{ tld.tld }}">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="phaseType" class="form-label required">Phase Type</label>
|
||||||
|
<select class="form-select" id="phaseType" name="phaseType" required>
|
||||||
|
<option value="sunrise">Sunrise</option>
|
||||||
|
<option value="landrush">Landrush</option>
|
||||||
|
<option value="claims">Claims</option>
|
||||||
|
<option value="open">Open</option>
|
||||||
|
<option value="custom">Custom</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="phaseName" class="form-label required">Phase Name</label>
|
||||||
|
<input type="text" class="form-control" id="phaseName" name="phaseName" placeholder="Enter phase name" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="phaseDescription" class="form-label required">Phase Description</label>
|
||||||
|
<textarea class="form-control" id="phaseDescription" name="phaseDescription" rows="3" placeholder="Enter phase description" required></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6 col-md-6">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="phaseStart" class="form-label required">Phase Start Date</label>
|
||||||
|
<input type="date" class="form-control" placeholder="e.g., 01/01/2023" id="phaseStart" name="phaseStart" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6 col-md-6">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="phaseEnd" class="form-label">Phase End Date</label>
|
||||||
|
<input type="date" class="form-control" placeholder="e.g., 01/01/2023" id="phaseEnd" name="phaseEnd">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-auto">
|
||||||
|
<button type="submit" class="btn btn-primary">Update Phases</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -101,6 +101,7 @@ $app->group('', function ($route) {
|
||||||
$route->get('/registry/tlds', SystemController::class .':listTlds')->setName('listTlds');
|
$route->get('/registry/tlds', SystemController::class .':listTlds')->setName('listTlds');
|
||||||
$route->map(['GET', 'POST'], '/registry/reserved', SystemController::class .':manageReserved')->setName('manageReserved');
|
$route->map(['GET', 'POST'], '/registry/reserved', SystemController::class .':manageReserved')->setName('manageReserved');
|
||||||
$route->post('/registry/promotions', SystemController::class . ':managePromo')->setName('managePromo');
|
$route->post('/registry/promotions', SystemController::class . ':managePromo')->setName('managePromo');
|
||||||
|
$route->post('/registry/phases', SystemController::class . ':managePhases')->setName('managePhases');
|
||||||
|
|
||||||
$route->get('/support', SupportController::class .':view')->setName('ticketview');
|
$route->get('/support', SupportController::class .':view')->setName('ticketview');
|
||||||
$route->map(['GET', 'POST'], '/support/new', SupportController::class .':newticket')->setName('newticket');
|
$route->map(['GET', 'POST'], '/support/new', SupportController::class .':newticket')->setName('newticket');
|
||||||
|
|
|
@ -2,12 +2,17 @@ SET FOREIGN_KEY_CHECKS=0;
|
||||||
|
|
||||||
CREATE DATABASE IF NOT EXISTS `registry`;
|
CREATE DATABASE IF NOT EXISTS `registry`;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`launch_phase` (
|
CREATE TABLE IF NOT EXISTS `registry`.`launch_phases` (
|
||||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
`phase_name` VARCHAR(255) NOT NULL,
|
`tld_id` int(10) unsigned DEFAULT NULL,
|
||||||
|
`phase_name` VARCHAR(75) NOT NULL,
|
||||||
|
`phase_type` VARCHAR(50) NOT NULL,
|
||||||
`phase_description` TEXT,
|
`phase_description` TEXT,
|
||||||
`start_date` DATETIME(3),
|
`start_date` DATETIME(3) NOT NULL,
|
||||||
`end_date` DATETIME(3),
|
`end_date` DATETIME(3) DEFAULT NULL,
|
||||||
|
`lastupdate` TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
KEY `tld_id` (`tld_id`),
|
||||||
|
FOREIGN KEY (`tld_id`) REFERENCES `domain_tld`(`id`),
|
||||||
UNIQUE(`phase_name`)
|
UNIQUE(`phase_name`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='launch phases';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='launch phases';
|
||||||
|
|
||||||
|
@ -57,6 +62,21 @@ CREATE TABLE IF NOT EXISTS `registry`.`domain_restore_price` (
|
||||||
CONSTRAINT `domain_restore_price_ibfk_1` FOREIGN KEY (`tldid`) REFERENCES `domain_tld` (`id`) ON DELETE RESTRICT
|
CONSTRAINT `domain_restore_price_ibfk_1` FOREIGN KEY (`tldid`) REFERENCES `domain_tld` (`id`) ON DELETE RESTRICT
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='domain restore price';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='domain restore price';
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `registry`.`allocation_tokens` (
|
||||||
|
token VARCHAR(255) NOT NULL,
|
||||||
|
domain_name VARCHAR(255) DEFAULT NULL,
|
||||||
|
tokenStatus VARCHAR(100) DEFAULT NULL,
|
||||||
|
tokenType VARCHAR(100) DEFAULT NULL,
|
||||||
|
createDateTime TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
lastUpdate DATETIME(3) DEFAULT NULL,
|
||||||
|
registrars JSON DEFAULT NULL,
|
||||||
|
tlds JSON DEFAULT NULL,
|
||||||
|
eppActions JSON DEFAULT NULL,
|
||||||
|
reducePremium TINYINT(1) NOT NULL,
|
||||||
|
reduceYears INT NOT NULL CHECK (reduceYears BETWEEN 0 AND 10),
|
||||||
|
PRIMARY KEY (token)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='allocation tokens';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `registry`.`error_log` (
|
CREATE TABLE IF NOT EXISTS `registry`.`error_log` (
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
`registrar_id` INT(10) unsigned NOT NULL,
|
`registrar_id` INT(10) unsigned NOT NULL,
|
||||||
|
|
|
@ -3,15 +3,29 @@ CREATE SCHEMA registryTransaction;
|
||||||
|
|
||||||
SET search_path TO registry, registryTransaction, public;
|
SET search_path TO registry, registryTransaction, public;
|
||||||
|
|
||||||
CREATE TABLE registry.launch_phase (
|
CREATE TABLE registry.launch_phases (
|
||||||
"id" SERIAL PRIMARY KEY,
|
"id" SERIAL PRIMARY KEY,
|
||||||
"phase_name" VARCHAR(255) NOT NULL,
|
"tld_id" INT CHECK ("tld_id" >= 0),
|
||||||
|
"phase_name" VARCHAR(75) NOT NULL,
|
||||||
|
"phase_type" VARCHAR(50) NOT NULL,
|
||||||
"phase_description" TEXT,
|
"phase_description" TEXT,
|
||||||
"start_date" TIMESTAMP(3),
|
"start_date" TIMESTAMP(3) NOT NULL,
|
||||||
"end_date" TIMESTAMP(3),
|
"end_date" TIMESTAMP(3) DEFAULT NULL,
|
||||||
|
"lastupdate" timestamp(3),
|
||||||
|
FOREIGN KEY ("tld_id") REFERENCES registry.domain_tld("id"),
|
||||||
UNIQUE(phase_name)
|
UNIQUE(phase_name)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION update_phases() RETURNS trigger AS '
|
||||||
|
BEGIN
|
||||||
|
NEW.lastupdate := CURRENT_TIMESTAMP;
|
||||||
|
RETURN NEW;
|
||||||
|
END;
|
||||||
|
' LANGUAGE 'plpgsql';
|
||||||
|
|
||||||
|
CREATE TRIGGER add_current_date_to_launch_phases BEFORE UPDATE ON registry.launch_phases FOR EACH ROW EXECUTE PROCEDURE
|
||||||
|
update_phases();
|
||||||
|
|
||||||
CREATE TABLE registry.domain_tld (
|
CREATE TABLE registry.domain_tld (
|
||||||
"id" SERIAL PRIMARY KEY,
|
"id" SERIAL PRIMARY KEY,
|
||||||
"tld" varchar(32) NOT NULL,
|
"tld" varchar(32) NOT NULL,
|
||||||
|
@ -53,6 +67,21 @@ CREATE TABLE registry.domain_restore_price (
|
||||||
unique ("tldid")
|
unique ("tldid")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE registry.allocation_tokens (
|
||||||
|
"token" VARCHAR(255) NOT NULL,
|
||||||
|
"domain_name" VARCHAR(255),
|
||||||
|
"tokenStatus" VARCHAR(100),
|
||||||
|
"tokenType" VARCHAR(100),
|
||||||
|
"createDateTime" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"lastUpdate" TIMESTAMP(3),
|
||||||
|
"registrars" JSON,
|
||||||
|
"tlds" JSON,
|
||||||
|
"eppActions" JSON,
|
||||||
|
"reducePremium" BOOLEAN NOT NULL,
|
||||||
|
"reduceYears" INT NOT NULL CHECK (reduceYears BETWEEN 0 AND 10),
|
||||||
|
PRIMARY KEY (token)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE registry.error_log (
|
CREATE TABLE registry.error_log (
|
||||||
"id" INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
"id" INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
"registrar_id" int CHECK ("registrar_id" >= 0) NOT NULL,,
|
"registrar_id" int CHECK ("registrar_id" >= 0) NOT NULL,,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue