Guillermo - staff/dellete[skip ci]
This commit is contained in:
parent
630e121bfb
commit
d57baa6cd8
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue