mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-28 16:24:42 +02:00
Guillermo - path / staff/get-all[skip ci]
This commit is contained in:
parent
b2547ce5f8
commit
1a3adfe418
@ -7,6 +7,8 @@ require_once 'staff/get-new-tickets.php';
|
||||
require_once 'staff/get-all-tickets.php';
|
||||
require_once 'staff/search-tickets.php';
|
||||
require_once 'staff/add.php';
|
||||
require_once 'staff/get-all.php';
|
||||
require_once 'staff/delete.php';
|
||||
|
||||
$systemControllerGroup = new ControllerGroup();
|
||||
$systemControllerGroup->setGroupPath('/staff');
|
||||
@ -19,5 +21,7 @@ $systemControllerGroup->addController(new GetNewTicketsStaffController);
|
||||
$systemControllerGroup->addController(new GetAllTicketsStaffController);
|
||||
$systemControllerGroup->addController(new SearchTicketStaffController);
|
||||
$systemControllerGroup->addController(new AddStaffController);
|
||||
$systemControllerGroup->addController(new GetAllStaffController);
|
||||
$systemControllerGroup->addController(new DeleteStaffController);
|
||||
|
||||
$systemControllerGroup->finalize();
|
18
server/controllers/staff/delete.php
Normal file
18
server/controllers/staff/delete.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
use Respect\Validation\Validator as DataValidator;
|
||||
|
||||
class DeleteStaffController extends Controller {
|
||||
const PATH = '/delete';
|
||||
|
||||
public function validations() {
|
||||
return [
|
||||
'permission' => 'staff_3',
|
||||
'requestData' => []
|
||||
];
|
||||
}
|
||||
|
||||
public function handler (){
|
||||
|
||||
}
|
||||
|
||||
}
|
27
server/controllers/staff/get-all.php
Normal file
27
server/controllers/staff/get-all.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
use Respect\Validation\Validator as DataValidator;
|
||||
|
||||
|
||||
class GetAllStaffController extends Controller {
|
||||
const PATH ='/get-all';
|
||||
|
||||
public function validations() {
|
||||
return [
|
||||
'permission' => 'staff_3',
|
||||
'requestData' => []
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function handler() {
|
||||
$staffs = Staff::getAll();
|
||||
$staffArray = [];
|
||||
|
||||
foreach($staffs as $staff) {
|
||||
$staffArray[] = $staff->toArray();
|
||||
}
|
||||
|
||||
Response::respondSuccess($staffArray);
|
||||
|
||||
}
|
||||
}
|
@ -30,4 +30,15 @@ class Staff extends DataStore {
|
||||
public static function getUser($value, $property = 'id') {
|
||||
return parent::getDataStore($value, $property);
|
||||
}
|
||||
public function toArray() {
|
||||
return [
|
||||
'name'=> $this->name,
|
||||
'email' => $this->email,
|
||||
'password' => $this->password,
|
||||
'profilePic' => $this->profilePic,
|
||||
'level' => $this->level,
|
||||
'departments' => $this->sharedDepartmentList->toArray(),
|
||||
'tickets' => $this->sharedTicketList->toArray(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user