Bổ sung api cho chức năng profile and criterias
This commit is contained in:
parent
780d3f63fe
commit
fb47cc509d
|
|
@ -193,7 +193,8 @@ class JiraController extends Controller
|
|||
], 200);
|
||||
}
|
||||
|
||||
private function customSort($a, $b, $order) {
|
||||
private function customSort($a, $b, $order)
|
||||
{
|
||||
$pos_a = array_search(strtolower($a), $order);
|
||||
$pos_b = array_search(strtolower($b), $order);
|
||||
|
||||
|
|
@ -260,4 +261,46 @@ class JiraController extends Controller
|
|||
return response()->json(['error' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDetailsProjectsById(Request $request)
|
||||
{
|
||||
$id = $request->input('id');
|
||||
$projects = $this->jiraService->getDetailsProjectsById($id);
|
||||
return response()->json([
|
||||
'data' => $projects,
|
||||
'status' => true
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function getAllBoardByIdProjects(Request $request)
|
||||
{
|
||||
$id = $request->input('id');
|
||||
$projects = $this->jiraService->getAllBoardByIdProjects($id);
|
||||
|
||||
return response()->json([
|
||||
'data' => $projects,
|
||||
'status' => true
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function getAllSprintByIdBoard(Request $request)
|
||||
{
|
||||
$id = $request->input('id');
|
||||
$projects = $this->jiraService->getAllSprintByIdBoard($id);
|
||||
|
||||
return response()->json([
|
||||
'data' => $projects,
|
||||
'status' => true
|
||||
], 200);
|
||||
}
|
||||
public function getAllIssueByIdSprint(Request $request)
|
||||
{
|
||||
$id = $request->input('id');
|
||||
$projects = $this->jiraService->getAllIssueByIdSprint($id);
|
||||
|
||||
return response()->json([
|
||||
'data' => $projects,
|
||||
'status' => true
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Admin\app\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Traits\AnalyzeData;
|
||||
use App\Traits\HasFilterRequest;
|
||||
use App\Traits\HasOrderByRequest;
|
||||
use App\Traits\HasSearchRequest;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
use HasOrderByRequest;
|
||||
use HasFilterRequest;
|
||||
use HasSearchRequest;
|
||||
use AnalyzeData;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -103,6 +103,11 @@ Route::middleware('api')
|
|||
], function () {
|
||||
Route::get('/fetch-issues', [JiraController::class, 'fetchAllIssues']);
|
||||
Route::get('/all-project', [JiraController::class, 'getAllProject']);
|
||||
Route::get('/get-detail-project-by-id', [JiraController::class, 'getDetailsProjectsById']);
|
||||
Route::get('/get-all-board-by-id-project', [JiraController::class, 'getAllBoardByIdProjects']);
|
||||
Route::get('/get-all-sprint-by-id-board', [JiraController::class, 'getAllSprintByIdBoard']);
|
||||
Route::get('/get-all-issue-by-id-sprint', [JiraController::class, 'getAllIssueByIdSprint']);
|
||||
|
||||
Route::get('/all-issue-by-project', [JiraController::class, 'fetchIssuesByProject']);
|
||||
Route::get('/worklogs', [JiraController::class, 'getAllUserWorkLogs'])->middleware('check.permission:admin.staff');
|
||||
Route::get('/allocation', [JiraController::class, 'getAllUserDoing'])->middleware('check.permission:admin.staff');
|
||||
|
|
|
|||
|
|
@ -289,4 +289,25 @@ class JiraService
|
|||
return ['projects' => $groupedIssues, 'users' => $users_data, 'warningList' => $user_warning];
|
||||
// return $projects;
|
||||
}
|
||||
|
||||
public function getDetailsProjectsById($id)
|
||||
{
|
||||
$response = $this->client->get('/rest/api/3/project/' . $id);
|
||||
return json_decode($response->getBody()->getContents(), true);
|
||||
}
|
||||
public function getAllBoardByIdProjects($id)
|
||||
{
|
||||
$response = $this->client->get('/rest/agile/1.0/board?projectKeyOrI=/' . $id);
|
||||
return json_decode($response->getBody()->getContents(), true);
|
||||
}
|
||||
public function getAllSprintByIdBoard($id)
|
||||
{
|
||||
$response = $this->client->get('/rest/agile/1.0/board/' . $id . '/sprint');
|
||||
return json_decode($response->getBody()->getContents(), true);
|
||||
}
|
||||
public function getAllIssueByIdSprint($id)
|
||||
{
|
||||
$response = $this->client->get('/rest/agile/1.0/sprint/' . $id . '/issue');
|
||||
return json_decode($response->getBody()->getContents(), true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue