Fix command validation rules

This commit is contained in:
James Brooks
2016-10-19 12:29:35 +01:00
parent ebf3c8656f
commit 468b2a0b7a
14 changed files with 70 additions and 72 deletions

View File

@@ -69,12 +69,12 @@ final class AddComponentCommand
*/
public $rules = [
'name' => 'required|string',
'description' => 'string',
'status' => 'int|min:1|max:4',
'link' => 'url',
'order' => 'int',
'group_id' => 'int',
'enabled' => 'bool',
'description' => 'required|string',
'status' => 'required|int|min:1|max:4',
'link' => 'nullable|url',
'order' => 'nullable|int',
'group_id' => 'nullable|int',
'enabled' => 'nullable|bool',
];
/**

View File

@@ -77,13 +77,13 @@ final class UpdateComponentCommand
* @var string[]
*/
public $rules = [
'name' => 'string',
'description' => 'string',
'status' => 'int|min:1|max:4',
'link' => 'url',
'order' => 'int',
'group_id' => 'int',
'enabled' => 'bool',
'name' => 'nullable|string',
'description' => 'nullable|string',
'status' => 'nullable|int|min:1|max:4',
'link' => 'nullable|url',
'order' => 'nullable|int',
'group_id' => 'nullable|int',
'enabled' => 'nullable|bool',
];
/**

View File

@@ -53,9 +53,9 @@ final class AddComponentGroupCommand
*/
public $rules = [
'name' => 'required|string',
'order' => 'int',
'collapsed' => 'int|between:0,3',
'visible' => 'bool',
'order' => 'required|int',
'collapsed' => 'required|int|between:0,3',
'visible' => 'required|bool',
];
/**

View File

@@ -61,10 +61,10 @@ final class UpdateComponentGroupCommand
* @var string[]
*/
public $rules = [
'name' => 'string',
'order' => 'int',
'collapsed' => 'int|between:0,3',
'visible' => 'bool',
'name' => 'nullable|string',
'order' => 'nullable|int',
'collapsed' => 'nullable|int|between:0,3',
'visible' => 'nullable|bool',
];
/**

View File

@@ -104,14 +104,14 @@ final class ReportIncidentCommand
public $rules = [
'name' => 'required|string',
'status' => 'required|int|min:0|max:4',
'message' => 'string',
'visible' => 'bool',
'component_id' => 'int|required_with:component_status',
'component_status' => 'int|min:1|max:4|required_with:component_id',
'notify' => 'bool',
'stickied' => 'bool',
'incident_date' => 'string',
'template' => 'string',
'message' => 'required|string',
'visible' => 'nullable|bool',
'component_id' => 'nullable|required_with:component_status|int',
'component_status' => 'nullable|required_with:component_id|int|min:1|max:4',
'notify' => 'nullable|bool',
'stickied' => 'required|bool',
'incident_date' => 'nullable|string',
'template' => 'nullable|string',
];
/**

View File

@@ -48,9 +48,9 @@ final class ReportMaintenanceCommand
*/
public $rules = [
'name' => 'required|string',
'message' => 'string',
'notify' => 'bool',
'timestamp' => 'string',
'message' => 'required|string',
'notify' => 'nullable|bool',
'timestamp' => 'required|string',
];
/**

View File

@@ -105,15 +105,15 @@ final class UpdateIncidentCommand
* @var string[]
*/
public $rules = [
'name' => 'string',
'status' => 'int|min:0|max:4',
'message' => 'string',
'visible' => 'bool',
'component_id' => 'int',
'component_status' => 'int|min:1|max:4|required_with:component_id',
'notify' => 'bool',
'stickied' => 'bool',
'template' => 'string',
'name' => 'nullable|string',
'status' => 'nullable|int|min:0|max:4',
'message' => 'nullable|string',
'visible' => 'nullable|bool',
'component_id' => 'nullable|int',
'component_status' => 'nullable|int|min:1|max:4|required_with:component_id',
'notify' => 'nullable|bool',
'stickied' => 'nullable|bool',
'template' => 'nullable|string',
];
/**

View File

@@ -55,10 +55,8 @@ final class UpdateIncidentUpdateCommand
* @var string[]
*/
public $rules = [
'update' => 'required',
'status' => 'int|min:1|max:4',
'message' => 'string',
'user' => 'required',
'status' => 'nullable|int|min:1|max:4',
'message' => 'nullable|string',
];
/**

View File

@@ -91,15 +91,15 @@ final class AddMetricCommand
public $rules = [
'name' => 'required|string',
'suffix' => 'required|string',
'description' => 'string',
'display_chart' => 'bool',
'default_value' => 'int',
'calc_type' => 'int',
'display_chart' => 'int',
'places' => 'int|between:0,4',
'default_view' => 'int|between:0,3',
'threshold' => 'numeric|between:0,10',
'order' => 'int',
'description' => 'nullable|string',
'display_chart' => 'nullable|bool',
'default_value' => 'required|int',
'calc_type' => 'required|int',
'display_chart' => 'nullable|int',
'places' => 'nullable|int|between:0,4',
'default_view' => 'required|int|between:0,3',
'threshold' => 'nullable|numeric|between:0,10',
'order' => 'nullable|int',
];
/**

View File

@@ -42,8 +42,8 @@ final class AddMetricPointCommand
* @var string[]
*/
public $rules = [
'value' => 'numeric',
'created_at' => 'string',
'value' => 'required|numeric',
'created_at' => 'required|string',
];
/**

View File

@@ -98,17 +98,17 @@ final class UpdateMetricCommand
* @var string[]
*/
public $rules = [
'name' => 'string',
'suffix' => 'string',
'description' => 'string',
'display_chart' => 'bool',
'default_value' => 'numeric',
'calc_type' => 'int|in:0,1',
'display_chart' => 'int',
'places' => 'numeric|between:0,4',
'default_view' => 'numeric|between:0,4',
'threshold' => 'numeric|between:0,10',
'order' => 'int',
'name' => 'nullable|string',
'suffix' => 'nullable|string',
'description' => 'nullable|string',
'display_chart' => 'nullable|bool',
'default_value' => 'nullable|numeric',
'calc_type' => 'nullable|int|in:0,1',
'display_chart' => 'nullable|int',
'places' => 'nullable|numeric|between:0,4',
'default_view' => 'nullable|numeric|between:0,4',
'threshold' => 'nullable|numeric|between:0,10',
'order' => 'nullable|int',
];
/**

View File

@@ -55,8 +55,8 @@ final class UpdateMetricPointCommand
* @var string[]
*/
public $rules = [
'value' => 'numeric',
'created_at' => 'string',
'value' => 'nullable|numeric',
'created_at' => 'nullable|string',
];
/**

View File

@@ -53,8 +53,8 @@ final class AddUserCommand
*/
public $rules = [
'username' => 'required|string',
'password' => 'string',
'level' => 'int',
'password' => 'required|string',
'level' => 'required|int',
];
/**

View File

@@ -48,9 +48,9 @@ final class SignupUserCommand
*/
public $rules = [
'username' => 'required|string',
'password' => 'string',
'password' => 'required|string',
'email' => 'required|string|email',
'level' => 'int',
'level' => 'required|int',
];
/**