1 | <?php |
||
26 | class NotesController extends Controller { |
||
27 | |||
28 | use Errors; |
||
29 | |||
30 | /** @var NotesService */ |
||
31 | private $notesService; |
||
32 | /** @var IConfig */ |
||
33 | private $settings; |
||
34 | /** @var string */ |
||
35 | private $userId; |
||
36 | |||
37 | /** |
||
38 | * @param string $AppName |
||
39 | * @param IRequest $request |
||
40 | * @param NotesService $service |
||
41 | * @param IConfig $settings |
||
42 | * @param string $UserId |
||
43 | */ |
||
44 | 8 | public function __construct($AppName, IRequest $request, |
|
45 | NotesService $service, IConfig $settings, |
||
46 | $UserId){ |
||
47 | 8 | parent::__construct($AppName, $request); |
|
48 | 8 | $this->notesService = $service; |
|
49 | 8 | $this->settings = $settings; |
|
50 | 8 | $this->userId = $UserId; |
|
51 | 8 | } |
|
52 | |||
53 | |||
54 | /** |
||
55 | * @NoAdminRequired |
||
56 | */ |
||
57 | 1 | public function index() { |
|
60 | |||
61 | |||
62 | /** |
||
63 | * @NoAdminRequired |
||
64 | * |
||
65 | * @param int $id |
||
66 | * @return DataResponse |
||
67 | */ |
||
68 | 2 | public function get($id) { |
|
78 | |||
79 | |||
80 | /** |
||
81 | * @NoAdminRequired |
||
82 | * |
||
83 | * @param string $content |
||
84 | */ |
||
85 | 1 | public function create($content) { |
|
86 | 1 | $note = $this->notesService->create($this->userId); |
|
87 | 1 | $note = $this->notesService->update( |
|
88 | 1 | $note->getId(), $content, $this->userId |
|
89 | 1 | ); |
|
90 | 1 | return new DataResponse($note); |
|
91 | } |
||
92 | |||
93 | |||
94 | /** |
||
95 | * @NoAdminRequired |
||
96 | * |
||
97 | * @param int $id |
||
98 | * @param string $content |
||
99 | * @return DataResponse |
||
100 | */ |
||
101 | 2 | public function update($id, $content) { |
|
106 | |||
107 | |||
108 | /** |
||
109 | * @NoAdminRequired |
||
110 | * |
||
111 | * @param int $id |
||
112 | * @param boolean $favorite |
||
113 | * @return DataResponse |
||
114 | */ |
||
115 | 2 | public function favorite($id, $favorite) { |
|
120 | |||
121 | |||
122 | /** |
||
123 | * @NoAdminRequired |
||
124 | * |
||
125 | * @param int $id |
||
126 | * @return DataResponse |
||
127 | */ |
||
128 | public function destroy($id) { |
||
134 | |||
135 | } |
||
136 |