StackController::delete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * @copyright Copyright (c) 2016 Julius Härtl <[email protected]>
4
 *
5
 * @author Julius Härtl <[email protected]>
6
 *
7
 * @license GNU AGPL version 3 or any later version
8
 *  
9
 *  This program is free software: you can redistribute it and/or modify
10
 *  it under the terms of the GNU Affero General Public License as
11
 *  published by the Free Software Foundation, either version 3 of the
12
 *  License, or (at your option) any later version.
13
 *  
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU Affero General Public License for more details.
18
 *  
19
 *  You should have received a copy of the GNU Affero General Public License
20
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 *  
22
 */
23
24
namespace OCA\Deck\Controller;
25
26
use OCA\Deck\Service\StackService;
27
28
use OCP\IRequest;
29
30
use OCP\AppFramework\Controller;
31
32
33
class StackController extends Controller {
34
	private $userId;
35
	private $stackService;
36
	public function __construct($appName, IRequest $request, StackService $stackService, $userId) {
37
		parent::__construct($appName, $request);
38
		$this->userId = $userId;
39
		$this->stackService = $stackService;
40
	}
41
42
	/**
43
	 * @NoAdminRequired
44
	 * @param $boardId
45
	 * @return array
46
	 */
47
	public function index($boardId) {
48
			return $this->stackService->findAll($boardId);
49
	}
50
51
	/**
52
	 * @NoAdminRequired
53
	 * @param $boardId
54
	 * @return array
55
	 */
56
	public function archived($boardId) {
57
			return $this->stackService->findAllArchived($boardId);
58
	}
59
60
	/**
61
	 * @NoAdminRequired
62
	 * @param $title
63
	 * @param $boardId
64
	 * @param int $order
65
	 * @return \OCP\AppFramework\Db\Entity
66
	 */
67
	public function create($title, $boardId, $order = 999) {
68
		return $this->stackService->create($title, $boardId, $order);
69
	}
70
71
	/**
72
	 * @NoAdminRequired
73
	 * @param $id
74
	 * @param $title
75
	 * @param $boardId
76
	 * @param $order
77
	 * @param $deletedAt
78
	 * @return \OCP\AppFramework\Db\Entity
79
	 */
80
	public function update($id, $title, $boardId, $order, $deletedAt) {
81
		return $this->stackService->update($id, $title, $boardId, $order, $deletedAt);
82
	}
83
84
	/**
85
	 * @NoAdminRequired
86
	 * @param $stackId
87
	 * @param $order
88
	 * @return array
89
	 */
90
	public function reorder($stackId, $order) {
91
		return $this->stackService->reorder((int)$stackId, (int)$order);
92
	}
93
94
	/**
95
	 * @NoAdminRequired
96
	 * @param $stackId
97
	 * @return \OCP\AppFramework\Db\Entity
98
	 */
99
	public function delete($stackId) {
100
		return $this->stackService->delete($stackId);
101
	}
102
103
	/**
104
	 * @NoAdminRequired
105
	 * @param $boardId
106
	 * @return \OCP\AppFramework\Db\Entity
107
	 */
108
	public function deleted($boardId) {
109
		return $this->stackService->fetchDeleted($boardId);
110
	}
111
112
}
113