submissionRepo = $submissionRepo; $this->assignmentRepo = $assignmentRepo; $this->completionService = $completionService; } public function approveSubmission(int $submissionId, int $adminContactId, string $note): void { $submission = $this->submissionRepo->findById($submissionId); if ($submission === null) { throw new RuntimeException('Submission nicht gefunden'); } if ((string) $submission['status'] !== 'awaiting_approval') { throw new RuntimeException('Submission ist nicht im Status awaiting_approval'); } TaskCertDb::beginTransaction(); try { $this->submissionRepo->review($submissionId, 'approved', $adminContactId, $note); TaskCertDb::commit(); } catch (Throwable $throwable) { TaskCertDb::rollback(); throw $throwable; } $this->completionService->refreshAssignmentAfterReview((int) $submission['assignment_id'], $submissionId); } public function rejectSubmission(int $submissionId, int $adminContactId, string $note): void { $submission = $this->submissionRepo->findById($submissionId); if ($submission === null) { throw new RuntimeException('Submission nicht gefunden'); } if ((string) $submission['status'] !== 'awaiting_approval') { throw new RuntimeException('Submission ist nicht im Status awaiting_approval'); } TaskCertDb::beginTransaction(); try { $this->submissionRepo->review($submissionId, 'rejected', $adminContactId, $note); $this->assignmentRepo->updateStatus((int) $submission['assignment_id'], 'rejected', null); TaskCertDb::commit(); } catch (Throwable $throwable) { TaskCertDb::rollback(); throw $throwable; } } }