File "DatabasePostEndpoint.php"

Full Path: /home/warrior1/public_html/wp-content/plugins/mailpoet/lib/Automation/Engine/Endpoints/System/DatabasePostEndpoint.php
File size: 674 bytes
MIME-type: text/x-php
Charset: utf-8

<?php declare(strict_types = 1);

namespace MailPoet\Automation\Engine\Endpoints\System;

if (!defined('ABSPATH')) exit;


use MailPoet\API\REST\Request;
use MailPoet\API\REST\Response;
use MailPoet\Automation\Engine\API\Endpoint;
use MailPoet\Automation\Engine\Migrations\Migrator;

/**
 * @ToDo Remove before MVP
 */
class DatabasePostEndpoint extends Endpoint {
  /** @var Migrator */
  private $migrator;

  public function __construct(
    Migrator $migrator
  ) {
    $this->migrator = $migrator;
  }

  public function handle(Request $request): Response {
    $this->migrator->deleteSchema();
    $this->migrator->createSchema();
    return new Response(null);
  }
}