diff --git a/server/controllers/staff.php b/server/controllers/staff.php index 0c1df4eb..64c583ca 100644 --- a/server/controllers/staff.php +++ b/server/controllers/staff.php @@ -2,6 +2,7 @@ require_once 'staff/get.php'; require_once 'staff/assign-ticket.php'; require_once 'staff/un-assign-ticket.php'; +require_once 'staff/get-tickets.php'; $systemControllerGroup = new ControllerGroup(); $systemControllerGroup->setGroupPath('/staff'); @@ -9,5 +10,6 @@ $systemControllerGroup->setGroupPath('/staff'); $systemControllerGroup->addController(new GetStaffController); $systemControllerGroup->addController(new AssignStaffController); $systemControllerGroup->addController(new UnAssignStaffController); +$systemControllerGroup->addController(new GetTicketStaffController); $systemControllerGroup->finalize(); \ No newline at end of file diff --git a/server/controllers/staff/get-tickets.php b/server/controllers/staff/get-tickets.php new file mode 100644 index 00000000..d9ff1289 --- /dev/null +++ b/server/controllers/staff/get-tickets.php @@ -0,0 +1,18 @@ + 'staff_1', + 'requestData' => [] + ]; + } + + public function handler() { + $user = Controller::getLoggedUser(); + Response::respondSuccess($user->sharedTicketList->toArray()); + } +} \ No newline at end of file diff --git a/tests/init.rb b/tests/init.rb index 7a0a00ad..3b931eeb 100644 --- a/tests/init.rb +++ b/tests/init.rb @@ -25,3 +25,4 @@ require './ticket/custom-response.rb' require './staff/get.rb' require './staff/assign-ticket.rb' require './staff/un-assign-ticket.rb' +require './staff/get-tickets.rb' diff --git a/tests/staff/get-tickets.rb b/tests/staff/get-tickets.rb new file mode 100644 index 00000000..a6ad8251 --- /dev/null +++ b/tests/staff/get-tickets.rb @@ -0,0 +1,26 @@ +describe '/staff/get-tickets' do + request('/user/logout') + Scripts.login($staff[:email], $staff[:password], true) + + it 'should get ticket list' do + + ticket = $database.getRow('ticket', 1 , 'id') + request('/staff/assign-ticket', { + ticketNumber: ticket['ticket_number'], + csrf_userid: $csrf_userid, + csrf_token: $csrf_token + }) + ticket = $database.getRow('ticket', 2 , 'id') + request('/staff/assign-ticket', { + ticketNumber: ticket['ticket_number'], + csrf_userid: $csrf_userid, + csrf_token: $csrf_token + }) + result = request('/staff/get-tickets', { + csrf_userid: $csrf_userid, + csrf_token: $csrf_token + }) + + (result['status']).should.equal('success') + end +end \ No newline at end of file