fix test issues
API CI/CD / Validate (composer + pint) (push) Successful in 3m5s
API CI/CD / Test (PHPUnit) (push) Failing after 7m12s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 3m5s
API CI/CD / Test (PHPUnit) (push) Failing after 7m12s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Route;
|
||||
/**
|
||||
* Laravel named routes (`route()`), cookie-session URLs, SPA paths, and absolute URLs for `public/` paths.
|
||||
*/
|
||||
final class ApplicationUrlService
|
||||
class ApplicationUrlService
|
||||
{
|
||||
/** Absolute URL for a path under `public/` (e.g. `/docs/openapi_*.yaml`). */
|
||||
public function absolutePublicPathUrl(string $path): string
|
||||
|
||||
@@ -1168,6 +1168,34 @@ class SchoolYearClosureService
|
||||
return $email !== '' ? $email : $userId;
|
||||
}
|
||||
|
||||
public function archive(int $id, ?int $actorId): array
|
||||
{
|
||||
$year = $this->findOrFail($id);
|
||||
|
||||
if ($year->status === SchoolYear::STATUS_ARCHIVED) {
|
||||
throw ValidationException::withMessages([
|
||||
'school_year' => ['This school year is already archived.'],
|
||||
]);
|
||||
}
|
||||
|
||||
$oldState = $year->toArray();
|
||||
$year->status = SchoolYear::STATUS_ARCHIVED;
|
||||
$year->is_current = false;
|
||||
$year->save();
|
||||
|
||||
$this->logAudit(
|
||||
$actorId,
|
||||
'school_year_archived',
|
||||
'school_years',
|
||||
(int) $year->id,
|
||||
$oldState,
|
||||
$year->fresh()?->toArray(),
|
||||
null
|
||||
);
|
||||
|
||||
return $this->presentSchoolYear($year->fresh());
|
||||
}
|
||||
|
||||
private function presentSchoolYear(?SchoolYear $year): ?array
|
||||
{
|
||||
if (! $year) {
|
||||
|
||||
Reference in New Issue
Block a user