@@ -94,6 +94,9 @@ |
||
94 | 94 | $this->cardMapper->markNotified($card); |
95 | 95 | } |
96 | 96 | |
97 | + /** |
|
98 | + * @param \OCA\Deck\Db\Card $card |
|
99 | + */ |
|
97 | 100 | public function sendCardAssigned($card, $userId) { |
98 | 101 | $boardId = $this->cardMapper->findBoardId($card->getId()); |
99 | 102 | $board = $this->getBoard($boardId); |
@@ -31,76 +31,76 @@ |
||
31 | 31 | |
32 | 32 | class AttachmentApiController extends ApiController { |
33 | 33 | |
34 | - private $attachmentService; |
|
34 | + private $attachmentService; |
|
35 | 35 | |
36 | - public function __construct($appName, IRequest $request, AttachmentService $attachmentService) { |
|
37 | - parent::__construct($appName, $request); |
|
38 | - $this->attachmentService = $attachmentService; |
|
39 | - } |
|
36 | + public function __construct($appName, IRequest $request, AttachmentService $attachmentService) { |
|
37 | + parent::__construct($appName, $request); |
|
38 | + $this->attachmentService = $attachmentService; |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
41 | + /** |
|
42 | 42 | * @NoAdminRequired |
43 | 43 | * @CORS |
44 | 44 | * @NoCSRFRequired |
45 | 45 | * |
46 | 46 | */ |
47 | - public function getAll() { |
|
48 | - $attachment = $this->attachmentService->findAll($this->request->getParam('cardId')); |
|
49 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
50 | - } |
|
47 | + public function getAll() { |
|
48 | + $attachment = $this->attachmentService->findAll($this->request->getParam('cardId')); |
|
49 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
52 | + /** |
|
53 | 53 | * @NoAdminRequired |
54 | 54 | * @CORS |
55 | 55 | * @NoCSRFRequired |
56 | 56 | * |
57 | 57 | */ |
58 | - public function display() { |
|
59 | - $attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
60 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
61 | - } |
|
58 | + public function display() { |
|
59 | + $attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
60 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
63 | + /** |
|
64 | 64 | * @NoAdminRequired |
65 | 65 | * @CORS |
66 | 66 | * @NoCSRFRequired |
67 | 67 | * |
68 | 68 | */ |
69 | - public function create($type, $data) { |
|
70 | - $attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data); |
|
71 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
72 | - } |
|
69 | + public function create($type, $data) { |
|
70 | + $attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data); |
|
71 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
74 | + /** |
|
75 | 75 | * @NoAdminRequired |
76 | 76 | * @CORS |
77 | 77 | * @NoCSRFRequired |
78 | 78 | * |
79 | 79 | */ |
80 | - public function update($data) { |
|
81 | - $attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data); |
|
82 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
83 | - } |
|
80 | + public function update($data) { |
|
81 | + $attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data); |
|
82 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
85 | + /** |
|
86 | 86 | * @NoAdminRequired |
87 | 87 | * @CORS |
88 | 88 | * @NoCSRFRequired |
89 | 89 | * |
90 | 90 | */ |
91 | - public function delete() { |
|
92 | - $attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
93 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
94 | - } |
|
91 | + public function delete() { |
|
92 | + $attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
93 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
96 | + /** |
|
97 | 97 | * @NoAdminRequired |
98 | 98 | * @CORS |
99 | 99 | * @NoCSRFRequired |
100 | 100 | * |
101 | 101 | */ |
102 | - public function restore() { |
|
103 | - $attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
104 | - return new DataResponse($attachment, HTTP::STATUS_OK); |
|
105 | - } |
|
102 | + public function restore() { |
|
103 | + $attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId')); |
|
104 | + return new DataResponse($attachment, HTTP::STATUS_OK); |
|
105 | + } |
|
106 | 106 | } |
107 | 107 | \ No newline at end of file |
@@ -112,6 +112,6 @@ |
||
112 | 112 | ['name' => 'attachment_api#delete', 'url' => '/api/v1.0/boards/{boardId}/stacks/{stackId}/cards/{cardId}/attachments/{attachmentId}', 'verb' => 'DELETE'], |
113 | 113 | ['name' => 'attachment_api#restore', 'url' => '/api/v1.0/boards/{boardId}/stacks/{stackId}/cards/{cardId}/attachments/{attachmentId}/restore', 'verb' => 'PUT'], |
114 | 114 | |
115 | - ['name' => 'board_api#preflighted_cors', 'url' => '/api/v1.0/{path}','verb' => 'OPTIONS', 'requirements' => ['path' => '.+']], |
|
115 | + ['name' => 'board_api#preflighted_cors', 'url' => '/api/v1.0/{path}', 'verb' => 'OPTIONS', 'requirements' => ['path' => '.+']], |
|
116 | 116 | ] |
117 | 117 | ]; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | private $config; |
41 | 41 | private $l10n; |
42 | 42 | |
43 | - public function __construct( |
|
43 | + public function __construct( |
|
44 | 44 | IL10N $l10n, |
45 | 45 | BoardMapper $boardMapper, |
46 | 46 | BoardService $boardService, |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $this->config = $config; |
56 | 56 | $this->boardMapper = $boardMapper; |
57 | 57 | $this->l10n = $l10n; |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * @param $userId |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | return false; |
76 | - } |
|
76 | + } |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * @param $title |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | throw new BadRequestException('color must be provided'); |
101 | 101 | } |
102 | 102 | |
103 | - $defaultBoard = $this->boardService->create($title, $userId, $color); |
|
104 | - $defaultStacks = []; |
|
105 | - $defaultCards = []; |
|
103 | + $defaultBoard = $this->boardService->create($title, $userId, $color); |
|
104 | + $defaultStacks = []; |
|
105 | + $defaultCards = []; |
|
106 | 106 | |
107 | 107 | $boardId = $defaultBoard->getId(); |
108 | 108 | |
@@ -115,5 +115,5 @@ discard block |
||
115 | 115 | $defaultCards[] = $this->cardService->create($this->l10n->t('Example Task 1'), $defaultStacks[2]->getId(), 'text', 0, $userId); |
116 | 116 | |
117 | 117 | return $defaultBoard; |
118 | - } |
|
118 | + } |
|
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -25,10 +25,8 @@ |
||
25 | 25 | namespace OCA\Deck\Controller; |
26 | 26 | |
27 | 27 | use OCP\AppFramework\ApiController; |
28 | -use OCP\AppFramework\Http; |
|
29 | 28 | use OCP\AppFramework\Http\DataResponse; |
30 | 29 | use OCP\IRequest; |
31 | - |
|
32 | 30 | use OCA\Deck\Service\BoardService; |
33 | 31 | |
34 | 32 | /** |
@@ -173,6 +173,9 @@ |
||
173 | 173 | return ($board->getOwner() === $userId); |
174 | 174 | } |
175 | 175 | |
176 | + /** |
|
177 | + * @param string $id |
|
178 | + */ |
|
176 | 179 | public function findBoardId($id) { |
177 | 180 | return $id; |
178 | 181 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function find($boardId) { |
123 | 123 | |
124 | - if ( is_numeric($boardId) === false ) { |
|
124 | + if (is_numeric($boardId) === false) { |
|
125 | 125 | throw new BadRequestException('board id must be a number'); |
126 | 126 | } |
127 | 127 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function isArchived($mapper, $id) { |
172 | 172 | |
173 | - if (is_numeric($id) === false) { |
|
173 | + if (is_numeric($id) === false) { |
|
174 | 174 | throw new BadRequestException('id must be a number'); |
175 | 175 | } |
176 | 176 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | throw new BadRequestException('mapper must be provided'); |
205 | 205 | } |
206 | 206 | |
207 | - if (is_numeric($id) === false) { |
|
207 | + if (is_numeric($id) === false) { |
|
208 | 208 | throw new BadRequestException('id must be a number'); |
209 | 209 | } |
210 | 210 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * @throws BadRequestException |
336 | 336 | */ |
337 | 337 | public function deleteForce($id) { |
338 | - if (is_numeric($id) === false) { |
|
338 | + if (is_numeric($id) === false) { |
|
339 | 339 | throw new BadRequestException('id must be a number'); |
340 | 340 | } |
341 | 341 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | throw new BadRequestException('color must be provided'); |
370 | 370 | } |
371 | 371 | |
372 | - if ( is_bool($archived) === false ) { |
|
372 | + if (is_bool($archived) === false) { |
|
373 | 373 | throw new BadRequestException('archived must be a boolean'); |
374 | 374 | } |
375 | 375 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * |
22 | 22 | */ |
23 | 23 | |
24 | -if ((@include_once __DIR__ . '/../vendor/autoload.php')===false) { |
|
24 | +if ((@include_once __DIR__ . '/../vendor/autoload.php') === false) { |
|
25 | 25 | throw new Exception('Cannot include autoload. Did you run install dependencies using composer?'); |
26 | 26 | } |
27 | 27 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | private function enrichStackWithCards($stack) { |
77 | 77 | $cards = $this->cardMapper->findAll($stack->getId()); |
78 | 78 | |
79 | - if(is_null($cards)) { |
|
79 | + if (is_null($cards)) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function delete($id) { |
217 | 217 | |
218 | - if ( is_numeric($id) === false ) { |
|
218 | + if (is_numeric($id) === false) { |
|
219 | 219 | throw new BadRequestException('stack id must be a number'); |
220 | 220 | } |
221 | 221 |
@@ -34,7 +34,6 @@ |
||
34 | 34 | use OCA\Deck\Db\StackMapper; |
35 | 35 | use OCA\Deck\StatusException; |
36 | 36 | use OCA\Deck\BadRequestException; |
37 | -use OCP\Comments\ICommentsManager; |
|
38 | 37 | |
39 | 38 | |
40 | 39 | class StackService { |