Skip to content

Commit 4491a69

Browse files
committed
Fixing annotations for UUID values in endpoints.
1 parent de61d31 commit 4491a69

18 files changed

+74
-70
lines changed

app/V1Module/presenters/AssignmentSolutionReviewsPresenter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public function checkEditComment(string $id, string $commentId)
347347
required: false,
348348
)]
349349
#[Path("id", new VUuid(), "identifier of the solution", required: true)]
350-
#[Path("commentId", new VString(), "identifier of the review comment", required: true)]
350+
#[Path("commentId", new VUuid(), "identifier of the review comment", required: true)]
351351
public function actionEditComment(string $id, string $commentId)
352352
{
353353
$solution = $this->assignmentSolutions->findOrThrow($id);
@@ -407,7 +407,7 @@ public function checkDeleteComment(string $id, string $commentId)
407407
* @DELETE
408408
*/
409409
#[Path("id", new VUuid(), "identifier of the solution", required: true)]
410-
#[Path("commentId", new VString(), "identifier of the review comment", required: true)]
410+
#[Path("commentId", new VUuid(), "identifier of the review comment", required: true)]
411411
public function actionDeleteComment(string $id, string $commentId)
412412
{
413413
$comment = $this->reviewComments->findOrThrow($commentId);

app/V1Module/presenters/AssignmentsPresenter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ public function actionValidate($id)
543543
* @throws InvalidStateException
544544
* @throws NotFoundException
545545
*/
546-
#[Post("exerciseId", new VMixed(), "Identifier of the exercise", nullable: true)]
547-
#[Post("groupId", new VMixed(), "Identifier of the group", nullable: true)]
546+
#[Post("exerciseId", new VUuid(), "Identifier of the exercise", nullable: true)]
547+
#[Post("groupId", new VUuid(), "Identifier of the group", nullable: true)]
548548
public function actionCreate()
549549
{
550550
$req = $this->getRequest();
@@ -713,7 +713,7 @@ public function checkUserSolutions(string $id, string $userId)
713713
* @GET
714714
*/
715715
#[Path("id", new VUuid(), "Identifier of the assignment", required: true)]
716-
#[Path("userId", new VString(), "Identifier of the user", required: true)]
716+
#[Path("userId", new VUuid(), "Identifier of the user", required: true)]
717717
public function actionUserSolutions(string $id, string $userId)
718718
{
719719
$assignment = $this->assignments->findOrThrow($id);
@@ -757,7 +757,7 @@ public function checkBestSolution(string $id, string $userId)
757757
* @throws ForbiddenRequestException
758758
*/
759759
#[Path("id", new VUuid(), "Identifier of the assignment", required: true)]
760-
#[Path("userId", new VString(), "Identifier of the user", required: true)]
760+
#[Path("userId", new VUuid(), "Identifier of the user", required: true)]
761761
public function actionBestSolution(string $id, string $userId)
762762
{
763763
$assignment = $this->assignments->findOrThrow($id);

app/V1Module/presenters/CommentsPresenter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ public function checkTogglePrivate(string $threadId, string $commentId)
184184
* @POST
185185
* @throws NotFoundException
186186
*/
187-
#[Path("threadId", new VString(), "Identifier of the comment thread", required: true)]
188-
#[Path("commentId", new VString(), "Identifier of the comment", required: true)]
187+
#[Path("threadId", new VUuid(), "Identifier of the comment thread", required: true)]
188+
#[Path("commentId", new VUuid(), "Identifier of the comment", required: true)]
189189
public function actionTogglePrivate(string $threadId, string $commentId)
190190
{
191191
/** @var Comment $comment */
@@ -218,8 +218,8 @@ public function checkSetPrivate(string $threadId, string $commentId)
218218
* @throws NotFoundException
219219
*/
220220
#[Post("isPrivate", new VBool(), "True if the comment is private")]
221-
#[Path("threadId", new VString(), "Identifier of the comment thread", required: true)]
222-
#[Path("commentId", new VString(), "Identifier of the comment", required: true)]
221+
#[Path("threadId", new VUuid(), "Identifier of the comment thread", required: true)]
222+
#[Path("commentId", new VUuid(), "Identifier of the comment", required: true)]
223223
public function actionSetPrivate(string $threadId, string $commentId)
224224
{
225225
/** @var Comment $comment */
@@ -255,8 +255,8 @@ public function checkDelete(string $threadId, string $commentId)
255255
* @throws ForbiddenRequestException
256256
* @throws NotFoundException
257257
*/
258-
#[Path("threadId", new VString(), "Identifier of the comment thread", required: true)]
259-
#[Path("commentId", new VString(), "Identifier of the comment", required: true)]
258+
#[Path("threadId", new VUuid(), "Identifier of the comment thread", required: true)]
259+
#[Path("commentId", new VUuid(), "Identifier of the comment", required: true)]
260260
public function actionDelete(string $threadId, string $commentId)
261261
{
262262
/** @var Comment $comment */

app/V1Module/presenters/EmailsPresenter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use App\Exceptions\NotFoundException;
1111
use App\Helpers\EmailHelper;
1212
use App\Helpers\Emails\EmailLocalizationHelper;
13+
use App\Helpers\MetaFormats\Validators\VUuid;
1314
use App\Model\Entity\User;
1415
use App\Model\Repository\Groups;
1516
use App\Security\ACL\IEmailPermissions;
@@ -166,7 +167,7 @@ public function checkSendToGroupMembers(string $groupId)
166167
#[Post("toMe", new VBool(), "User wants to also receive an email")]
167168
#[Post("subject", new VString(1), "Subject for the soon to be sent email")]
168169
#[Post("message", new VString(1), "Message which will be sent, can be html code")]
169-
#[Path("groupId", new VString(), required: true)]
170+
#[Path("groupId", new VUuid(), required: true)]
170171
public function actionSendToGroupMembers(string $groupId)
171172
{
172173
$user = $this->getCurrentUser();

app/V1Module/presenters/ExerciseFilesPresenter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function checkDeleteExerciseFile(string $id, string $fileId)
236236
* @throws ForbiddenRequestException
237237
*/
238238
#[Path("id", new VUuid(), "identification of exercise", required: true)]
239-
#[Path("fileId", new VString(), "identification of file", required: true)]
239+
#[Path("fileId", new VUuid(), "identification of file", required: true)]
240240
public function actionDeleteExerciseFile(string $id, string $fileId)
241241
{
242242
$exercise = $this->exercises->findOrThrow($id);

app/V1Module/presenters/ExercisesConfigPresenter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ public function checkGetHardwareGroupLimits(string $id, string $runtimeEnvironme
416416
* @throws ExerciseConfigException
417417
*/
418418
#[Path("id", new VUuid(), "Identifier of the exercise", required: true)]
419-
#[Path("runtimeEnvironmentId", new VString(), required: true)]
420-
#[Path("hwGroupId", new VString(), required: true)]
419+
#[Path("runtimeEnvironmentId", new VString(1), required: true)]
420+
#[Path("hwGroupId", new VString(1), required: true)]
421421
public function actionGetHardwareGroupLimits(string $id, string $runtimeEnvironmentId, string $hwGroupId)
422422
{
423423
/** @var Exercise $exercise */
@@ -465,8 +465,8 @@ public function checkSetHardwareGroupLimits(string $id, string $runtimeEnvironme
465465
*/
466466
#[Post("limits", new VArray(), "A list of resource limits for the given environment and hardware group")]
467467
#[Path("id", new VUuid(), "Identifier of the exercise", required: true)]
468-
#[Path("runtimeEnvironmentId", new VString(), required: true)]
469-
#[Path("hwGroupId", new VString(), required: true)]
468+
#[Path("runtimeEnvironmentId", new VString(1), required: true)]
469+
#[Path("hwGroupId", new VString(1), required: true)]
470470
public function actionSetHardwareGroupLimits(string $id, string $runtimeEnvironmentId, string $hwGroupId)
471471
{
472472
/** @var Exercise $exercise */
@@ -529,8 +529,8 @@ public function checkRemoveHardwareGroupLimits(string $id, string $runtimeEnviro
529529
* @throws NotFoundException
530530
*/
531531
#[Path("id", new VUuid(), "Identifier of the exercise", required: true)]
532-
#[Path("runtimeEnvironmentId", new VString(), required: true)]
533-
#[Path("hwGroupId", new VString(), required: true)]
532+
#[Path("runtimeEnvironmentId", new VString(1), required: true)]
533+
#[Path("hwGroupId", new VString(1), required: true)]
534534
public function actionRemoveHardwareGroupLimits(string $id, string $runtimeEnvironmentId, string $hwGroupId)
535535
{
536536
/** @var Exercise $exercise */

app/V1Module/presenters/ExercisesPresenter.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ public function checkAuthors()
258258
* List authors of all exercises, possibly filtered by a group in which the exercises appear.
259259
* @GET
260260
*/
261-
#[Query("instanceId", new VString(), "Id of an instance from which the authors are listed.", required: false)]
261+
#[Query("instanceId", new VUuid(), "Id of an instance from which the authors are listed.", required: false)]
262262
#[Query(
263263
"groupId",
264-
new VString(),
264+
new VUuid(),
265265
"A group where the relevant exercises can be seen (assigned).",
266266
required: false,
267267
nullable: true,
@@ -283,7 +283,7 @@ public function checkListByIds()
283283
* Get a list of exercises based on given ids.
284284
* @POST
285285
*/
286-
#[Post("ids", new VArray(), "Identifications of exercises")]
286+
#[Post("ids", new VArray(new VUuid()), "Identifications of exercises")]
287287
public function actionListByIds()
288288
{
289289
$exercises = $this->exercises->findByIds($this->getRequest()->getPost("ids"));
@@ -537,7 +537,7 @@ function (Assignment $assignment) use ($archived) {
537537
* @throws ApiException
538538
* @throws ParseException
539539
*/
540-
#[Post("groupId", new VMixed(), "Identifier of the group to which exercise belongs to", nullable: true)]
540+
#[Post("groupId", new VUuid(), "Identifier of the group to which exercise belongs to", nullable: true)]
541541
public function actionCreate()
542542
{
543543
$user = $this->getCurrentUser();
@@ -652,7 +652,7 @@ public function actionRemove(string $id)
652652
* @throws NotFoundException
653653
* @throws ParseException
654654
*/
655-
#[Post("groupId", new VMixed(), "Identifier of the group to which exercise will be forked", nullable: true)]
655+
#[Post("groupId", new VUuid(), "Identifier of the group to which exercise will be forked", nullable: true)]
656656
#[Path("id", new VUuid(), "Identifier of the exercise", required: true)]
657657
public function actionForkFrom(string $id)
658658
{
@@ -695,7 +695,7 @@ public function checkAttachGroup(string $id, string $groupId)
695695
* @throws InvalidApiArgumentException
696696
*/
697697
#[Path("id", new VUuid(), "Identifier of the exercise", required: true)]
698-
#[Path("groupId", new VString(), "Identifier of the group to which exercise should be attached", required: true)]
698+
#[Path("groupId", new VUuid(), "Identifier of the group to which exercise should be attached", required: true)]
699699
public function actionAttachGroup(string $id, string $groupId)
700700
{
701701
$exercise = $this->exercises->findOrThrow($id);
@@ -729,7 +729,7 @@ public function checkDetachGroup(string $id, string $groupId)
729729
* @throws InvalidApiArgumentException
730730
*/
731731
#[Path("id", new VUuid(), "Identifier of the exercise", required: true)]
732-
#[Path("groupId", new VString(), "Identifier of the group which should be detached from exercise", required: true)]
732+
#[Path("groupId", new VUuid(), "Identifier of the group which should be detached from exercise", required: true)]
733733
public function actionDetachGroup(string $id, string $groupId)
734734
{
735735
$exercise = $this->exercises->findOrThrow($id);
@@ -999,7 +999,7 @@ public function checkSetAdmins(string $id)
999999
* @POST
10001000
* @throws NotFoundException
10011001
*/
1002-
#[Post("admins", new VArray(), "List of user IDs.", required: true)]
1002+
#[Post("admins", new VArray(new VUuid()), "List of user IDs.", required: true)]
10031003
#[Path("id", new VUuid(), "identifier of the exercise", required: true)]
10041004
public function actionSetAdmins(string $id)
10051005
{

app/V1Module/presenters/ExtensionsPresenter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use App\Model\Repository\Users;
1313
use App\Model\View\UserViewFactory;
1414
use App\Helpers\Extensions;
15+
use App\Helpers\MetaFormats\Validators\VUuid;
1516
use App\Security\AccessManager;
1617
use App\Security\TokenScope;
1718

@@ -67,7 +68,7 @@ public function checkUrl(string $extId, string $instanceId)
6768
#[Query("locale", new VString(2, 2), required: false)]
6869
#[Query("return", new VString(), required: false)]
6970
#[Path("extId", new VString(), required: true)]
70-
#[Path("instanceId", new VString(), required: true)]
71+
#[Path("instanceId", new VUuid(), required: true)]
7172
public function actionUrl(string $extId, string $instanceId, ?string $locale, ?string $return)
7273
{
7374
$user = $this->getCurrentUser();

app/V1Module/presenters/GroupInvitationsPresenter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function checkList($groupId)
155155
* List all invitations of a group.
156156
* @GET
157157
*/
158-
#[Path("groupId", new VString(), required: true)]
158+
#[Path("groupId", new VUuid(), required: true)]
159159
public function actionList($groupId)
160160
{
161161
$group = $this->groups->findOrThrow($groupId);
@@ -176,7 +176,7 @@ public function checkCreate($groupId)
176176
*/
177177
#[Post("expireAt", new VTimestamp(), "When the invitation expires.", nullable: true)]
178178
#[Post("note", new VMixed(), "Note for the students who wish to use the invitation link.", nullable: true)]
179-
#[Path("groupId", new VString(), required: true)]
179+
#[Path("groupId", new VUuid(), required: true)]
180180
public function actionCreate($groupId)
181181
{
182182
$req = $this->getRequest();

app/V1Module/presenters/GroupsPresenter.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ public function actionGetExamLocks(string $id, string $examId)
790790
* @throws BadRequestException
791791
*/
792792
#[Path("id", new VUuid(), "An identifier of the relocated group", required: true)]
793-
#[Path("newParentId", new VString(), "An identifier of the new parent group", required: true)]
793+
#[Path("newParentId", new VUuid(), "An identifier of the new parent group", required: true)]
794794
public function actionRelocate(string $id, string $newParentId)
795795
{
796796
$group = $this->groups->findOrThrow($id);
@@ -959,7 +959,7 @@ public function checkAddMember(string $id, string $userId)
959959
*/
960960
#[Post("type", new VString(1), "Identifier of membership type (admin, supervisor, ...)", required: true)]
961961
#[Path("id", new VUuid(), "Identifier of the group", required: true)]
962-
#[Path("userId", new VString(), "Identifier of the supervisor", required: true)]
962+
#[Path("userId", new VUuid(), "Identifier of the supervisor", required: true)]
963963
#[ResponseFormat(GroupFormat::class)]
964964
public function actionAddMember(string $id, string $userId)
965965
{
@@ -1006,7 +1006,7 @@ public function checkRemoveMember(string $id, string $userId)
10061006
* @DELETE
10071007
*/
10081008
#[Path("id", new VUuid(), "Identifier of the group", required: true)]
1009-
#[Path("userId", new VString(), "Identifier of the supervisor", required: true)]
1009+
#[Path("userId", new VUuid(), "Identifier of the supervisor", required: true)]
10101010
#[ResponseFormat(GroupFormat::class)]
10111011
public function actionRemoveMember(string $id, string $userId)
10121012
{
@@ -1148,7 +1148,7 @@ public function checkStudentsStats(string $id, string $userId)
11481148
* @throws BadRequestException
11491149
*/
11501150
#[Path("id", new VUuid(), "Identifier of the group", required: true)]
1151-
#[Path("userId", new VString(), "Identifier of the student", required: true)]
1151+
#[Path("userId", new VUuid(), "Identifier of the student", required: true)]
11521152
public function actionStudentsStats(string $id, string $userId)
11531153
{
11541154
$user = $this->users->findOrThrow($userId);
@@ -1178,7 +1178,7 @@ public function checkStudentsSolutions(string $id, string $userId)
11781178
* @throws BadRequestException
11791179
*/
11801180
#[Path("id", new VUuid(), "Identifier of the group", required: true)]
1181-
#[Path("userId", new VString(), "Identifier of the student", required: true)]
1181+
#[Path("userId", new VUuid(), "Identifier of the student", required: true)]
11821182
public function actionStudentsSolutions(string $id, string $userId)
11831183
{
11841184
$user = $this->users->findOrThrow($userId);
@@ -1225,7 +1225,7 @@ public function checkAddStudent(string $id, string $userId)
12251225
* @POST
12261226
*/
12271227
#[Path("id", new VUuid(), "Identifier of the group", required: true)]
1228-
#[Path("userId", new VString(), "Identifier of the student", required: true)]
1228+
#[Path("userId", new VUuid(), "Identifier of the student", required: true)]
12291229
#[ResponseFormat(GroupFormat::class)]
12301230
public function actionAddStudent(string $id, string $userId)
12311231
{
@@ -1257,7 +1257,7 @@ public function checkRemoveStudent(string $id, string $userId)
12571257
* @DELETE
12581258
*/
12591259
#[Path("id", new VUuid(), "Identifier of the group", required: true)]
1260-
#[Path("userId", new VString(), "Identifier of the student", required: true)]
1260+
#[Path("userId", new VUuid(), "Identifier of the student", required: true)]
12611261
#[ResponseFormat(GroupFormat::class)]
12621262
public function actionRemoveStudent(string $id, string $userId)
12631263
{
@@ -1290,7 +1290,7 @@ public function checkLockStudent(string $id, string $userId)
12901290
* @POST
12911291
*/
12921292
#[Path("id", new VUuid(), "Identifier of the group", required: true)]
1293-
#[Path("userId", new VString(), "Identifier of the student", required: true)]
1293+
#[Path("userId", new VUuid(), "Identifier of the student", required: true)]
12941294
public function actionLockStudent(string $id, string $userId)
12951295
{
12961296
$user = $this->users->findOrThrow($userId);
@@ -1330,7 +1330,7 @@ public function checkUnlockStudent(string $id, string $userId)
13301330
* @DELETE
13311331
*/
13321332
#[Path("id", new VUuid(), "Identifier of the group", required: true)]
1333-
#[Path("userId", new VString(), "Identifier of the student", required: true)]
1333+
#[Path("userId", new VUuid(), "Identifier of the student", required: true)]
13341334
public function actionUnlockStudent(string $id, string $userId)
13351335
{
13361336
$user = $this->users->findOrThrow($userId);

0 commit comments

Comments
 (0)