22
33namespace App \V1Module \Presenters ;
44
5+ use App \Helpers \MetaFormats \Attributes \Post ;
6+ use App \Helpers \MetaFormats \Attributes \Query ;
7+ use App \Helpers \MetaFormats \Attributes \Path ;
8+ use App \Helpers \MetaFormats \Type ;
9+ use App \Helpers \MetaFormats \Validators \VArray ;
10+ use App \Helpers \MetaFormats \Validators \VBool ;
11+ use App \Helpers \MetaFormats \Validators \VDouble ;
12+ use App \Helpers \MetaFormats \Validators \VEmail ;
13+ use App \Helpers \MetaFormats \Validators \VInt ;
14+ use App \Helpers \MetaFormats \Validators \VMixed ;
15+ use App \Helpers \MetaFormats \Validators \VString ;
16+ use App \Helpers \MetaFormats \Validators \VTimestamp ;
17+ use App \Helpers \MetaFormats \Validators \VUuid ;
518use App \Exceptions \BadRequestException ;
619use App \Exceptions \InternalServerException ;
720use App \Exceptions \InvalidArgumentException ;
@@ -142,9 +155,9 @@ public function checkSolution(string $id)
142155 /**
143156 * Get information about solutions.
144157 * @GET
145- * @param string $id Identifier of the solution
146158 * @throws InternalServerException
147159 */
160+ #[Path("id " , new VString (), "Identifier of the solution " , required: true )]
148161 public function actionSolution (string $ id )
149162 {
150163 $ solution = $ this ->assignmentSolutions ->findOrThrow ($ id );
@@ -172,11 +185,11 @@ public function checkUpdateSolution(string $id)
172185 /**
173186 * Update details about the solution (note, etc...)
174187 * @POST
175- * @Param(type="post", name="note", validation="string:0..1024", description="A note by the author of the solution")
176- * @param string $id Identifier of the solution
177188 * @throws NotFoundException
178189 * @throws InternalServerException
179190 */
191+ #[Post("note " , new VString (0 , 1024 ), "A note by the author of the solution " )]
192+ #[Path("id " , new VString (), "Identifier of the solution " , required: true )]
180193 public function actionUpdateSolution (string $ id )
181194 {
182195 $ req = $ this ->getRequest ();
@@ -198,9 +211,9 @@ public function checkDeleteSolution(string $id)
198211 /**
199212 * Delete assignment solution with given identification.
200213 * @DELETE
201- * @param string $id identifier of assignment solution
202214 * @throws ForbiddenRequestException
203215 */
216+ #[Path("id " , new VString (), "identifier of assignment solution " , required: true )]
204217 public function actionDeleteSolution (string $ id )
205218 {
206219 $ solution = $ this ->assignmentSolutions ->findOrThrow ($ id );
@@ -236,8 +249,8 @@ public function checkSubmissions(string $id)
236249 /**
237250 * Get list of all submissions of a solution
238251 * @GET
239- * @param string $id Identifier of the solution
240252 */
253+ #[Path("id " , new VString (), "Identifier of the solution " , required: true )]
241254 public function actionSubmissions (string $ id )
242255 {
243256 $ solution = $ this ->assignmentSolutions ->findOrThrow ($ id );
@@ -271,10 +284,10 @@ public function checkSubmission(string $submissionId)
271284 /**
272285 * Get information about the evaluation of a submission
273286 * @GET
274- * @param string $submissionId Identifier of the submission
275287 * @throws NotFoundException
276288 * @throws InternalServerException
277289 */
290+ #[Path("submissionId " , new VString (), "Identifier of the submission " , required: true )]
278291 public function actionSubmission (string $ submissionId )
279292 {
280293 $ submission = $ this ->assignmentSolutionSubmissions ->findOrThrow ($ submissionId );
@@ -301,8 +314,8 @@ public function checkDeleteSubmission(string $submissionId)
301314 /**
302315 * Remove the submission permanently
303316 * @DELETE
304- * @param string $submissionId Identifier of the submission
305317 */
318+ #[Path("submissionId " , new VString (), "Identifier of the submission " , required: true )]
306319 public function actionDeleteSubmission (string $ submissionId )
307320 {
308321 $ submission = $ this ->assignmentSolutionSubmissions ->findOrThrow ($ submissionId );
@@ -327,15 +340,19 @@ public function checkSetBonusPoints(string $id)
327340 * Set new amount of bonus points for a solution (and optionally points override)
328341 * Returns array of solution entities that has been changed by this.
329342 * @POST
330- * @Param(type="post", name="bonusPoints", validation="numericint",
331- * description="New amount of bonus points, can be negative number")
332- * @Param(type="post", name="overriddenPoints", required=false,
333- * description="Overrides points assigned to solution by the system")
334- * @param string $id Identifier of the solution
335343 * @throws NotFoundException
336344 * @throws InvalidArgumentException
337345 * @throws InvalidStateException
338346 */
347+ #[Post("bonusPoints " , new VInt (), "New amount of bonus points, can be negative number " )]
348+ #[Post(
349+ "overriddenPoints " ,
350+ new VMixed (),
351+ "Overrides points assigned to solution by the system " ,
352+ required: false ,
353+ nullable: true ,
354+ )]
355+ #[Path("id " , new VString (), "Identifier of the solution " , required: true )]
339356 public function actionSetBonusPoints (string $ id )
340357 {
341358 $ solution = $ this ->assignmentSolutions ->findOrThrow ($ id );
@@ -423,14 +440,13 @@ public function checkSetFlag(string $id, string $flag)
423440 /**
424441 * Set flag of the assignment solution.
425442 * @POST
426- * @param string $id identifier of the solution
427- * @param string $flag name of the flag which should to be changed
428- * @Param(type="post", name="value", required=true, validation=boolean,
429- * description="True or false which should be set to given flag name")
430443 * @throws NotFoundException
431444 * @throws \Nette\Application\AbortException
432445 * @throws \Exception
433446 */
447+ #[Post("value " , new VBool (), "True or false which should be set to given flag name " , required: true )]
448+ #[Path("id " , new VString (), "identifier of the solution " , required: true )]
449+ #[Path("flag " , new VString (), "name of the flag which should to be changed " , required: true )]
434450 public function actionSetFlag (string $ id , string $ flag )
435451 {
436452 $ req = $ this ->getRequest ();
@@ -546,12 +562,12 @@ public function checkDownloadSolutionArchive(string $id)
546562 /**
547563 * Download archive containing all solution files for particular solution.
548564 * @GET
549- * @param string $id of assignment solution
550565 * @throws ForbiddenRequestException
551566 * @throws NotFoundException
552567 * @throws \Nette\Application\BadRequestException
553568 * @throws \Nette\Application\AbortException
554569 */
570+ #[Path("id " , new VString (), "of assignment solution " , required: true )]
555571 public function actionDownloadSolutionArchive (string $ id )
556572 {
557573 $ solution = $ this ->assignmentSolutions ->findOrThrow ($ id );
@@ -573,10 +589,10 @@ public function checkFiles(string $id)
573589 /**
574590 * Get the list of submitted files of the solution.
575591 * @GET
576- * @param string $id of assignment solution
577592 * @throws ForbiddenRequestException
578593 * @throws NotFoundException
579594 */
595+ #[Path("id " , new VString (), "of assignment solution " , required: true )]
580596 public function actionFiles (string $ id )
581597 {
582598 $ solution = $ this ->assignmentSolutions ->findOrThrow ($ id )->getSolution ();
@@ -594,11 +610,11 @@ public function checkDownloadResultArchive(string $submissionId)
594610 /**
595611 * Download result archive from backend for particular submission.
596612 * @GET
597- * @param string $submissionId
598613 * @throws NotFoundException
599614 * @throws InternalServerException
600615 * @throws \Nette\Application\AbortException
601616 */
617+ #[Path("submissionId " , new VString (), required: true )]
602618 public function actionDownloadResultArchive (string $ submissionId )
603619 {
604620 $ submission = $ this ->assignmentSolutionSubmissions ->findOrThrow ($ submissionId );
@@ -628,10 +644,10 @@ public function checkEvaluationScoreConfig(string $submissionId)
628644 /**
629645 * Get score configuration associated with given submission evaluation
630646 * @GET
631- * @param string $submissionId Identifier of the submission
632647 * @throws NotFoundException
633648 * @throws InternalServerException
634649 */
650+ #[Path("submissionId " , new VString (), "Identifier of the submission " , required: true )]
635651 public function actionEvaluationScoreConfig (string $ submissionId )
636652 {
637653 $ submission = $ this ->assignmentSolutionSubmissions ->findOrThrow ($ submissionId );
@@ -655,8 +671,8 @@ public function checkReviewRequests(string $id)
655671 * (is admin/supervisor in corresponding groups).
656672 * Along with that it returns all assignment entities of the corresponding solutions.
657673 * @GET
658- * @param string $id of the user whose solutions with requested reviews are listed
659674 */
675+ #[Path("id " , new VString (), "of the user whose solutions with requested reviews are listed " , required: true )]
660676 public function actionReviewRequests (string $ id )
661677 {
662678 $ user = $ this ->users ->findOrThrow ($ id );
0 commit comments