Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduled maintenance refactor #2220

Merged
merged 2 commits into from
Oct 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions app/Bus/Commands/Incident/ReportMaintenanceCommand.php

This file was deleted.

98 changes: 98 additions & 0 deletions app/Bus/Commands/Schedule/CreateScheduleCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Commands\Schedule;

/**
* This is the create schedule command.
*
* @author James Brooks <[email protected]>
*/
final class CreateScheduleCommand
{
/**
* The schedule name.
*
* @var string
*/
public $name;

/**
* The schedule message.
*
* @var string
*/
public $message;

/**
* The schedule status.
*
* @var int
*/
public $status;

/**
* The schedule date.
*
* @var string
*/
public $scheduled_at;

/**
* The completed at date.
*
* @var string
*/
public $completed_at;

/**
* The components affected by the schedule.
*
* @var array
*/
public $components;

/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'name' => 'required|string',
'message' => 'nullable|string',
'status' => 'required|int|min:0|max:2',
'scheduled_at' => 'required|string',
'completed_at' => 'nullable|string',
'components' => 'required|array',
];

/**
* Create a new create schedule command instance.
*
* @param string $name
* @param string $message
* @param int $status
* @param string $scheduled_at
* @param string $completed_at
* @param array $components
*
* @return void
*/
public function __construct($name, $message, $status, $scheduled_at, $completed_at, array $components)
{
$this->name = $name;
$this->message = $message;
$this->status = $status;
$this->scheduled_at = $scheduled_at;
$this->completed_at = $completed_at;
$this->components = $components;
}
}
50 changes: 50 additions & 0 deletions app/Bus/Commands/Schedule/DeleteScheduleCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Commands\Schedule;

use CachetHQ\Cachet\Models\Schedule;

/**
* This is the delete schedule command.
*
* @author James Brooks <[email protected]>
*/
final class DeleteScheduleCommand
{
/**
* The schedule to delete.
*
* @var \CachetHQ\Cachet\Models\Schedule
*/
public $schedule;

/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'schedule' => 'required',
];

/**
* Create a new delete schedule command instance.
*
* @param \CachetHQ\Cachet\Models\Schedule $schedule
*
* @return void
*/
public function __construct(Schedule $schedule)
{
$this->schedule = $schedule;
}
}
110 changes: 110 additions & 0 deletions app/Bus/Commands/Schedule/UpdateScheduleCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Commands\Schedule;

use CachetHQ\Cachet\Models\Schedule;

/**
* This is the update schedule command.
*
* @author James Brooks <[email protected]>
*/
final class UpdateScheduleCommand
{
/**
* The schedule to update.
*
* @param \CachetHQ\Cachet\Models\Schedule
*/
public $schedule;

/**
* The schedule name.
*
* @var string
*/
public $name;

/**
* The schedule message.
*
* @var string
*/
public $message;

/**
* The schedule status.
*
* @var int
*/
public $status;

/**
* The schedule date.
*
* @var string
*/
public $scheduled_at;

/**
* The completed at date.
*
* @var string
*/
public $completed_at;

/**
* The components affected by the schedule.
*
* @var array
*/
public $components;

/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'schedule' => 'required',
'name' => 'nullable|string',
'message' => 'nullable|string',
'status' => 'nullable|int|min:0|max:2',
'scheduled_at' => 'nullable|string',
'completed_at' => 'nullable|string',
'components' => 'nullable|array',
];

/**
* Create a new update schedule command instance.
*
* @param \CachetHQ\Cachet\Models\Schedule $schedule
* @param string $name
* @param string $message
* @param int $status
* @param string $scheduled_at
* @param string $completed_at
* @param array $components
*
* @return void
*/
public function __construct(Schedule $schedule, $name, $message, $status, $scheduled_at, $completed_at, array $components = [])
{
$this->schedule = $schedule;
$this->name = $name;
$this->message = $message;
$this->status = $status;
$this->scheduled_at = $scheduled_at;
$this->completed_at = $completed_at;
$this->components = $components;
}
}
36 changes: 0 additions & 36 deletions app/Bus/Events/Incident/MaintenanceWasScheduledEvent.php

This file was deleted.

24 changes: 24 additions & 0 deletions app/Bus/Events/Schedule/ScheduleEventInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CachetHQ\Cachet\Bus\Events\Schedule;

use CachetHQ\Cachet\Bus\Events\EventInterface;

/**
* This is the schedule event interface.
*
* @author James Brooks <[email protected]>
*/
interface ScheduleEventInterface extends EventInterface
{
//
}
Loading