-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Adds Validation for status label creation through the API #15713
base: develop
Are you sure you want to change the base?
Conversation
PR Summary
|
As I mentioned in the previous PR, why aren't we just using normal validation here? If we were, we'd get that for free without having to translate it. |
Validation added, and translation removed. 👍 |
@@ -166,7 +167,22 @@ public static function getStatuslabelTypesForDB($type) | |||
|
|||
return $statustype; | |||
} | |||
public function validate() | |||
{ | |||
$validator = Validator::make($this->attributes, $this->rules); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we do it this way, we're not actually checking for type though, no? We don't have that constraint in the model $rules
:
protected $rules = [
'name' => 'required|string|unique_undeleted',
'notes' => 'string|nullable',
'deployable' => 'required',
'pending' => 'required',
'archived' => 'required',
];
since type
isn't an actual field on the table.
Description
Validation check:
![image](https://private-user-images.githubusercontent.com/47435081/379427340-b2dd30d6-f49f-46d7-a66c-23858a3f7d95.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjIzNjksIm5iZiI6MTczOTM2MjA2OSwicGF0aCI6Ii80NzQzNTA4MS8zNzk0MjczNDAtYjJkZDMwZDYtZjQ5Zi00NmQ3LWE2NmMtMjM4NThhM2Y3ZDk1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDEyMDc0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThjYTRhNzAwNjRhZTEwYzQ0ODRhNDI3YzllZWViMDdlZDViZGZiZWE3YWI4YjMzMDU4Y2NlMDE5ODFkYjVhMjkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.dbiIitzHy_hS4jZN9qoypFHz_FDujANRmdgRggT6Uxs)
![image](https://private-user-images.githubusercontent.com/47435081/379427524-e51f3560-da24-4759-84a2-e07e75791858.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjIzNjksIm5iZiI6MTczOTM2MjA2OSwicGF0aCI6Ii80NzQzNTA4MS8zNzk0Mjc1MjQtZTUxZjM1NjAtZGEyNC00NzU5LTg0YTItZTA3ZTc1NzkxODU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDEyMDc0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk3OGRlYzczY2FmZDM3MDk3YjBmZmI3YTMwYmY1ODFhNDJkMjk1MTZkMjRkZTAzYmU1NmU2MTc0ZGRmYmE2OTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.8D3DDlqWSO-oovnyua5Oq0D0VabjPIy5RhwMV3NSzzs)
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: