(Guillermo) Create path /ticket/create
This commit is contained in:
parent
9295554dd1
commit
839265e852
|
@ -31,16 +31,16 @@ class CreateController extends Controller {
|
|||
|
||||
private function validateData() {
|
||||
if (strlen($this->title) < 3) {
|
||||
return 'title is too short';
|
||||
Response::respondError(ERRORS::SHORT_TITLE);
|
||||
}
|
||||
if (strlen($this->title) > 30) {
|
||||
return 'title is very long';
|
||||
Response::respondError(ERRORS::LONG_TITLE);
|
||||
}
|
||||
if (strlen($this->content) < 5) {
|
||||
return 'content is too short';
|
||||
Response::respondError(ERRORS::SHORT_CONTENT);
|
||||
}
|
||||
if (strlen($this->content) > 500) {
|
||||
return 'content is very long';
|
||||
Response::respondError(ERRORS::LONG_CONTENT);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -2,4 +2,8 @@
|
|||
class ERRORS {
|
||||
const INVALID_CREDENTIALS = 'User or password is not defined';
|
||||
const SESSION_EXISTS = 'User is already logged in';
|
||||
const SHORT_TITLE = 'Title is too short';
|
||||
const LONG_TITLE = 'Title is very long';
|
||||
const SHORT_CONTENT = 'Content is too short';
|
||||
const LONG_CONTENT = 'Content is very long';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue