perf: 所有项目列表支持筛选个人项目

This commit is contained in:
kuaifan
2022-07-04 16:13:57 +08:00
parent fb74ef4843
commit 824399bbf1
2 changed files with 37 additions and 7 deletions

View File

@@ -44,6 +44,10 @@ class ProjectController extends AbstractController
* @apiName lists
*
* @apiParam {String} [all] 是否查看所有项目(限制管理员)
* @apiParam {String} [type] 项目类型
* - all全部默认
* - team团队项目
* - personal个人项目
* @apiParam {String} [archived] 归档状态
* - all全部
* - no未归档默认
@@ -96,6 +100,7 @@ class ProjectController extends AbstractController
$user = User::auth();
//
$all = Request::input('all');
$type = Request::input('type', 'all');
$archived = Request::input('archived', 'no');
$getcolumn = Request::input('getcolumn', 'no');
//
@@ -110,6 +115,12 @@ class ProjectController extends AbstractController
$builder->with(['projectColumn']);
}
//
if ($type === 'team') {
$builder->where('projects.personal', 0);
} elseif ($type === 'personal') {
$builder->where('projects.personal', 1);
}
//
if ($archived == 'yes') {
$builder->whereNotNull('projects.archived_at');
} elseif ($archived == 'no') {