Skip to content

Commit 1967dc7

Browse files
committed
code maintenance
Signed-off-by: dartcafe <github@dartcafe.de>
1 parent 01901b1 commit 1967dc7

File tree

127 files changed

+2586
-2222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+2586
-2222
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = {
1515
},
1616
},
1717
],
18+
'jsdoc/require-param-description': 'off',
1819
'no-array-constructor': 'error',
1920
'no-continue': 'error',
2021
'no-else-return': ['error', { allowElseIf: false }],

external.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare module 'vue-material-design-icons/*'
2+
declare module 'v-click-outside'

lib/Controller/AdminController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ public function list(): JSONResponse {
6767
*/
6868
#[FrontpageRoute(verb: 'PUT', url: '/administration/poll/{pollId}/takeover')]
6969
public function takeover(int $pollId): JSONResponse {
70-
return $this->response(fn () => $this->pollService->takeover($pollId));
70+
return $this->response(fn () => [
71+
'poll' => $this->pollService->takeover($pollId)
72+
]);
7173
}
7274

7375
/**

lib/Controller/OptionController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function list(int $pollId): JSONResponse {
4848
* @param int $duration duration of option
4949
*/
5050
#[NoAdminRequired]
51-
#[FrontpageRoute(verb: 'POST', url: '/option')]
51+
#[FrontpageRoute(verb: 'POST', url: '/poll/{pollId}/option')]
5252
public function add(int $pollId, int $timestamp = 0, string $text = '', int $duration = 0): JSONResponse {
5353
return $this->responseCreate(fn () => ['option' => $this->optionService->add($pollId, $timestamp, $text, $duration)]);
5454
}

lib/Controller/PollController.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace OCA\Polls\Controller;
1010

11+
use OCA\Polls\Db\Poll;
1112
use OCA\Polls\Helper\Container;
1213
use OCA\Polls\Model\Settings\AppSettings;
1314
use OCA\Polls\Service\CommentService;
@@ -152,7 +153,7 @@ public function toggleArchive(int $pollId): JSONResponse {
152153
#[NoAdminRequired]
153154
#[FrontpageRoute(verb: 'DELETE', url: '/poll/{pollId}')]
154155
public function delete(int $pollId): JSONResponse {
155-
return $this->responseDeleteTolerant(fn () => $this->pollService->delete($pollId));
156+
return $this->responseDeleteTolerant(fn () => ['poll' => $this->pollService->delete($pollId)]);
156157
}
157158

158159
/**
@@ -186,13 +187,13 @@ public function reopen(int $pollId): JSONResponse {
186187
#[NoAdminRequired]
187188
#[FrontpageRoute(verb: 'POST', url: '/poll/{pollId}/clone')]
188189
public function clone(int $pollId): JSONResponse {
189-
return $this->response(fn () => $this->clonePoll($pollId));
190+
return $this->response(fn () => ['poll' => $this->clonePoll($pollId)]);
190191
}
191192

192-
private function clonePoll(int $pollId): JSONResponse {
193+
private function clonePoll(int $pollId): Poll {
193194
$poll = $this->pollService->clone($pollId);
194195
$this->optionService->clone($pollId, $poll->getId());
195-
return $this->get($pollId);
196+
return $this->pollService->get($pollId);
196197
}
197198

198199
/**

lib/Controller/VoteController.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,16 @@ public function list(int $pollId): JSONResponse {
5454
#[FrontpageRoute(verb: 'PUT', url: '/vote')]
5555
// #[FrontpageRoute(verb: 'PUT', url: '/vote/{optionId}/set/{setTo}')]
5656
public function set(int $optionId, string $setTo): JSONResponse {
57-
$option = $this->optionService->get($optionId);
58-
$vote = $this->voteService->set($optionId, $setTo);
59-
return $this->response(fn () => [
60-
'vote' => $vote,
61-
'poll' => $this->pollService->get($option->getPollId()),
62-
'options' => $this->optionService->list($option->getPollId()),
63-
'votes' => $this->voteService->list($option->getPollId())
64-
]);
57+
return $this->response(function () use ($optionId, $setTo) {
58+
$option = $this->optionService->get($optionId);
59+
$vote = $this->voteService->set($optionId, $setTo);
60+
return [
61+
'vote' => $vote,
62+
'poll' => $this->pollService->get($option->getPollId()),
63+
'options' => $this->optionService->list($option->getPollId()),
64+
'votes' => $this->voteService->list($option->getPollId())
65+
];
66+
});
6567
}
6668

6769
/**

package-lock.json

Lines changed: 36 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"dev:win": "set NODE_ENV=development && vite --mode development build",
2121
"format": "prettier --check .",
2222
"format:fix": "prettier --write .",
23-
"lint": "eslint --ext .js,.vue src",
24-
"lint:fix": "eslint --ext .js,.vue src --fix",
23+
"lint": "eslint --ext .js,.ts,.vue src",
24+
"lint:fix": "eslint --ext .js,.ts,.vue src --fix",
2525
"stylelint": "stylelint src/**/*{.scss,.vue,.css}",
2626
"stylelint:fix": "stylelint src --fix",
2727
"version": "node update-app-version.mjs && git add ./appinfo/info.xml",
@@ -65,6 +65,10 @@
6565
"@nextcloud/prettier-config": "^1.1.0",
6666
"@nextcloud/stylelint-config": "^3.0.1",
6767
"@nextcloud/vite-config": "^2.3.2",
68+
"@types/file-saver": "^2.0.7",
69+
"@types/lodash": "^4.17.16",
70+
"@types/luxon": "^3.4.2",
71+
"@types/qrcode": "^1.5.5",
6872
"@vue/tsconfig": "^0.7.0",
6973
"eslint-config-prettier": "^10.0.1",
7074
"eslint-plugin-prettier": "^5.2.5",

src/Api/index.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,23 @@
22
* SPDX-FileCopyrightText: 2023 Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5-
export { default as ActivityAPI } from './modules/activity.js'
6-
export { default as AdminAPI } from './modules/admin.js'
7-
export { default as AppSettingsAPI } from './modules/appSettings.js'
8-
export { default as CalendarAPI } from './modules/calendar.js'
9-
export { default as CommentsAPI } from './modules/comments.js'
10-
export { default as OptionsAPI } from './modules/options.js'
11-
export { default as PollsAPI } from './modules/polls.js'
12-
export { default as PublicAPI } from './modules/public.js'
13-
export { default as SharesAPI } from './modules/shares.js'
14-
export { default as UserSettingsAPI } from './modules/userSettings.js'
15-
export { default as ValidatorAPI } from './modules/validators.js'
16-
export { default as VotesAPI } from './modules/votes.js'
17-
export { default as SessionAPI } from './modules/session.js'
5+
6+
export type ApiEmailAdressList = {
7+
displayName: string
8+
emailAddress: string
9+
combined: string
10+
}
11+
12+
export { default as ActivityAPI } from './modules/activity.ts'
13+
export { default as AdminAPI } from './modules/admin.ts'
14+
export { default as AppSettingsAPI } from './modules/appSettings.ts'
15+
export { default as CalendarAPI } from './modules/calendar.ts'
16+
export { default as CommentsAPI } from './modules/comments.ts'
17+
export { default as OptionsAPI } from './modules/options.ts'
18+
export { default as PollsAPI } from './modules/polls.ts'
19+
export { default as PublicAPI } from './modules/public.ts'
20+
export { default as SharesAPI } from './modules/shares.ts'
21+
export { default as UserSettingsAPI } from './modules/userSettings.ts'
22+
export { default as ValidatorAPI } from './modules/validators.ts'
23+
export { default as VotesAPI } from './modules/votes.ts'
24+
export { default as SessionAPI } from './modules/session.ts'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { ocsInstance, createCancelTokenHandler } from './HttpApi.js'
66

77
const activity = {
8-
getActivities(pollId) {
8+
getActivities(pollId: number) {
99
const response = ocsInstance.request({
1010
method: 'GET',
1111
url: 'activity/api/v2/activity/polls',

0 commit comments

Comments
 (0)