Skip to content
This repository was archived by the owner on Jan 28, 2024. It is now read-only.

Commit 0b018a1

Browse files
committed
added recently accessed project links action
1 parent 632c2b2 commit 0b018a1

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

config/api.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@
110110
'class' => 'yii\rest\UrlRule',
111111
'controller' => 'project-links',
112112
'extraPatterns' => [
113-
'POST {id}/share' => 'share',
114-
'{id}/share' => 'options',
113+
'GET,HEAD accessed' => 'accessed',
114+
'POST {id}/share' => 'share',
115+
'accessed' => 'options',
116+
'{id}/share' => 'options',
115117
],
116118
],
117119
// Guideline sections

controllers/ProjectLinksController.php

+17-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class ProjectLinksController extends ApiController
1616
{
1717
/**
18-
* Returns paginated list with project links.
18+
* Returns paginated list with owned project links.
1919
*
2020
* @return mixed
2121
*/
@@ -148,4 +148,20 @@ public function actionShare($id)
148148

149149
return $this->sendErrorResponse($model->getFirstErrors());
150150
}
151+
152+
/**
153+
* Returns paginated list with recently accessed project links.
154+
* Note: The user is not required to be owner of the related project.
155+
*
156+
* @return mixed
157+
*/
158+
public function actionAccessed()
159+
{
160+
$user = Yii::$app->user->identity;
161+
162+
$searchModel = new ProjectLinkSearch($user->findAccessedProjectLinksQuery());
163+
$dataProvider = $searchModel->search(Yii::$app->request->get(), true);
164+
165+
return $dataProvider;
166+
}
151167
}

0 commit comments

Comments
 (0)