Guillermo - staff/dellete[skip ci]

This commit is contained in:
Ivan Diaz 2016-12-07 17:24:42 -03:00
parent 630e121bfb
commit d57baa6cd8
2 changed files with 13 additions and 5 deletions

View File

@ -9,17 +9,24 @@ class DeleteStaffController extends Controller {
return [
'permission' => 'staff_3',
'requestData' => [
'staffId' => [
'validation' => DataValidator::dataStoreId('staff'),
'error' => ERRORS::INVALID_STAFF
]
]
];
}
public function handler() {
$staffId = Controller::request('userId');
$staffId = Controller::request('staffId');
$staff = Staff::getDataStore($staffId);
foreach($staff->sharedTicketList as $ticket) {
$ticket->owner = null;
$ticket->unread = true;
$ticket->store();
}
$staff->delete();
Response::respondSuccess();
}

View File

@ -28,4 +28,5 @@ class ERRORS {
const ALREADY_BANNED = 'ALREADY_BANNED';
const INVALID_LEVEL = 'INVALID_LEVEL';
const ALREADY_A_STAFF = 'ALREADY_A_STAFF';
const INVALID_STAFF = 'INVALID_STAFF';
}