mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-29 16:54:53 +02:00
Adds validation for colors when editing/creating tags, and creates the INVALID_COLOR error
This commit is contained in:
parent
22efd7ea93
commit
ec3b1ec32a
@ -36,6 +36,10 @@ class CreateTagController extends Controller {
|
||||
'name' => [
|
||||
'validation' => DataValidator::length(2, 100),
|
||||
'error' => ERRORS::INVALID_NAME
|
||||
],
|
||||
'color' => [
|
||||
'validation' => DataValidator::hexRgbColor()->startsWith('#'),
|
||||
'error' => ERRORS::INVALID_COLOR
|
||||
]
|
||||
]
|
||||
];
|
||||
|
@ -37,6 +37,10 @@ class EditTagController extends Controller {
|
||||
'tagId' => [
|
||||
'validation' => DataValidator::dataStoreId('tag'),
|
||||
'error' => ERRORS::INVALID_TAG
|
||||
],
|
||||
'color' => [
|
||||
'validation' => DataValidator::hexRgbColor()->startsWith('#'),
|
||||
'error' => ERRORS::INVALID_COLOR
|
||||
]
|
||||
]
|
||||
];
|
||||
|
@ -247,6 +247,10 @@
|
||||
* @apiDefine UNAVAILABLE_STATS
|
||||
* @apiError {String} UNAVAILABLE_STATS Stats are currently unavailable
|
||||
*/
|
||||
/**
|
||||
* @apiDefine INVALID_COLOR
|
||||
* @apiError {String} INVALID_COLOR The color should be in hexadecimal, preceded by a '#'
|
||||
*/
|
||||
|
||||
class ERRORS {
|
||||
const INVALID_CREDENTIALS = 'INVALID_CREDENTIALS';
|
||||
@ -312,4 +316,5 @@ class ERRORS {
|
||||
const INVALID_CUSTOM_FIELD_OPTIONS = 'INVALID_CUSTOM_FIELD_OPTIONS';
|
||||
const INVALID_CUSTOM_FIELD_OPTION = 'INVALID_CUSTOM_FIELD_OPTION';
|
||||
const UNAVAILABLE_STATS = 'UNAVAILABLE_STATS';
|
||||
const INVALID_COLOR = 'INVALID_COLOR';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user