security: A01-13 — nest all event routes under organisation prefix

Move all authenticated organiser-facing event sub-resource routes from
/events/{event}/... to /organisations/{organisation}/events/{event}/...
to enforce multi-tenancy at the routing layer.

Changes:
- Routes: restructured api.php to nest all event sub-resources under
  the existing organisation prefix group
- Controllers: added Organisation parameter and VerifiesOrganisationEvent
  trait to all 12 affected controllers (sections, time-slots, shifts,
  persons, crowd-lists, locations, shift-assignments, registration-fields,
  availabilities, field-values, section-preferences, stats)
- Tests: updated all 20 feature test files with new route paths
- Frontend: updated 8 API composables and 20 Vue components/pages
- API.md: updated documentation to reflect new route structure

Portal routes, public routes (volunteer-register), and invitation routes
remain unchanged as they operate without organisation context.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 08:16:36 +02:00
parent 51e5dd6fcb
commit 7932e53daf
64 changed files with 726 additions and 568 deletions

View File

@@ -90,7 +90,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -118,7 +118,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift2->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift2->id}/assignable-persons",
);
$response->assertOk()
@@ -143,7 +143,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -163,7 +163,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -175,7 +175,7 @@ class AssignablePersonsTest extends TestCase
$shift = $this->createOpenShift();
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertUnauthorized();
@@ -188,7 +188,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->outsider);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertForbidden();
@@ -212,7 +212,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift2->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift2->id}/assignable-persons",
);
$response->assertOk()
@@ -231,7 +231,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -259,7 +259,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/assign",
['person_id' => $person->id],
);
@@ -288,7 +288,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/claim",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/claim",
['person_id' => $person->id],
);
@@ -316,7 +316,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
);
$response->assertOk()
@@ -348,7 +348,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
['person_id' => $person->id],
);
@@ -379,7 +379,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
['person_id' => $person->id],
);
@@ -408,7 +408,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->otherSection->id}/shifts/{$shift2->id}/assign",
['person_id' => $person->id],
);
@@ -436,7 +436,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -463,7 +463,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -486,7 +486,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -523,7 +523,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -542,7 +542,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -568,7 +568,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -590,7 +590,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -607,7 +607,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -627,7 +627,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -642,7 +642,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -666,7 +666,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()
@@ -692,7 +692,7 @@ class AssignablePersonsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shifts/{$shift->id}/assignable-persons",
);
$response->assertOk()

View File

@@ -57,7 +57,7 @@ class PersonApprovalEmailTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson("/api/v1/events/{$this->event->id}/persons/{$person->id}/approve");
$response = $this->postJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/persons/{$person->id}/approve");
$response->assertOk();
@@ -79,7 +79,7 @@ class PersonApprovalEmailTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson("/api/v1/events/{$this->event->id}/persons/{$person->id}/reject", [
$response = $this->postJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/persons/{$person->id}/reject", [
'reason' => 'Geen beschikbaarheid op de juiste momenten.',
]);
@@ -109,7 +109,7 @@ class PersonApprovalEmailTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson("/api/v1/events/{$this->event->id}/persons/{$person->id}/reject");
$response = $this->postJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/persons/{$person->id}/reject");
$response->assertOk();
@@ -127,7 +127,7 @@ class PersonApprovalEmailTest extends TestCase
'status' => 'pending',
]);
$response = $this->postJson("/api/v1/events/{$this->event->id}/persons/{$person->id}/approve");
$response = $this->postJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/persons/{$person->id}/approve");
$response->assertStatus(401);
}
@@ -146,7 +146,7 @@ class PersonApprovalEmailTest extends TestCase
Sanctum::actingAs($outsider);
$response = $this->postJson("/api/v1/events/{$this->event->id}/persons/{$person->id}/approve");
$response = $this->postJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/persons/{$person->id}/approve");
$response->assertStatus(403);
}

View File

@@ -62,7 +62,7 @@ class RegistrationSettingsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson("/api/v1/events/{$this->festival->id}/sections/registration-settings");
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings");
$response->assertOk()
->assertJsonCount(2, 'data');
@@ -92,7 +92,7 @@ class RegistrationSettingsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->putJson("/api/v1/events/{$this->festival->id}/sections/registration-settings", [
$response = $this->putJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings", [
'name' => 'Theatertent Bar',
'show_in_registration' => true,
'registration_description' => 'Bediening in de overdekte theatertent',
@@ -121,7 +121,7 @@ class RegistrationSettingsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$this->putJson("/api/v1/events/{$this->festival->id}/sections/registration-settings", [
$this->putJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings", [
'name' => 'EHBO',
'show_in_registration' => true,
'registration_description' => null,
@@ -143,7 +143,7 @@ class RegistrationSettingsTest extends TestCase
]);
// Unauthenticated
$response = $this->putJson("/api/v1/events/{$this->festival->id}/sections/registration-settings", [
$response = $this->putJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings", [
'name' => 'Bar',
'show_in_registration' => true,
'registration_description' => null,
@@ -156,7 +156,7 @@ class RegistrationSettingsTest extends TestCase
{
Sanctum::actingAs($this->orgAdmin);
$response = $this->putJson("/api/v1/events/{$this->festival->id}/sections/registration-settings", [
$response = $this->putJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings", [
'name' => 'Nonexistent Section',
'show_in_registration' => true,
'registration_description' => null,
@@ -167,7 +167,7 @@ class RegistrationSettingsTest extends TestCase
public function test_get_requires_authentication(): void
{
$response = $this->getJson("/api/v1/events/{$this->festival->id}/sections/registration-settings");
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->festival->id}/sections/registration-settings");
$response->assertUnauthorized();
}
@@ -187,7 +187,7 @@ class RegistrationSettingsTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson("/api/v1/events/{$flatEvent->id}/sections/registration-settings");
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$flatEvent->id}/sections/registration-settings");
$response->assertOk()
->assertJsonCount(1, 'data')

View File

@@ -89,7 +89,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->volunteer);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
['person_id' => $this->person->id],
);
@@ -115,7 +115,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->volunteer);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$autoSection->id}/shifts/{$shift->id}/claim",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$autoSection->id}/shifts/{$shift->id}/claim",
['person_id' => $this->person->id],
);
@@ -142,7 +142,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->volunteer);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
['person_id' => $this->person->id],
);
@@ -162,7 +162,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->volunteer);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
['person_id' => $this->person->id],
);
@@ -185,7 +185,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->volunteer);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift2->id}/claim",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift2->id}/claim",
['person_id' => $this->person->id],
);
@@ -208,7 +208,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->volunteer);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift2->id}/claim",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift2->id}/claim",
['person_id' => $this->person->id],
);
@@ -227,7 +227,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->volunteer);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
['person_id' => $pendingPerson->id],
);
@@ -239,7 +239,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
$shift = $this->createOpenShift();
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
['person_id' => $this->person->id],
);
@@ -257,7 +257,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
['person_id' => $this->person->id],
);
@@ -282,7 +282,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
['person_id' => $this->person->id],
);
@@ -306,7 +306,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
['person_id' => $this->person->id],
);
@@ -333,7 +333,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift2->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift2->id}/assign",
['person_id' => $this->person->id],
);
@@ -347,7 +347,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->volunteer);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/assign",
['person_id' => $this->person->id],
);
@@ -371,7 +371,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/{$assignment->id}/approve",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/{$assignment->id}/approve",
);
$response->assertOk()
@@ -397,7 +397,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/{$assignment->id}/reject",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/{$assignment->id}/reject",
['reason' => 'Onvoldoende ervaring voor deze rol.'],
);
@@ -418,7 +418,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/{$assignment->id}/approve",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/{$assignment->id}/approve",
);
$response->assertUnprocessable();
@@ -437,7 +437,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->volunteer);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
);
$response->assertOk()
@@ -456,7 +456,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->volunteer);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
);
$response->assertOk()
@@ -480,7 +480,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->volunteer);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
);
$response->assertForbidden();
@@ -502,7 +502,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/{$assignment->id}/cancel",
);
$response->assertOk()
@@ -530,7 +530,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/bulk-approve",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/bulk-approve",
['assignment_ids' => $assignments->pluck('id')->toArray()],
);
@@ -570,7 +570,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/bulk-approve",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/bulk-approve",
['assignment_ids' => [$pending->id, $approved->id]],
);
@@ -605,7 +605,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson("/api/v1/events/{$this->event->id}/shift-assignments");
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments");
$response->assertOk();
$this->assertCount(3, $response->json('data'));
@@ -633,7 +633,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson("/api/v1/events/{$this->event->id}/shift-assignments?status=pending_approval");
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments?status=pending_approval");
$response->assertOk();
$this->assertCount(1, $response->json('data'));
@@ -651,7 +651,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->outsider);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts/{$shift->id}/claim",
['person_id' => $this->person->id],
);
@@ -671,7 +671,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->outsider);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/shift-assignments/{$assignment->id}/approve",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/shift-assignments/{$assignment->id}/approve",
);
$response->assertForbidden();
@@ -688,7 +688,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/persons/{$this->person->id}/availabilities/sync",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/persons/{$this->person->id}/availabilities/sync",
[
'availabilities' => [
['time_slot_id' => $this->timeSlot->id, 'preference_level' => 5],
@@ -721,7 +721,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/persons/{$this->person->id}/availabilities/sync",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/persons/{$this->person->id}/availabilities/sync",
[
'availabilities' => [
['time_slot_id' => $slot2->id, 'preference_level' => 4],
@@ -752,7 +752,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/persons/{$this->person->id}/availabilities/sync",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/persons/{$this->person->id}/availabilities/sync",
[
'availabilities' => [
['time_slot_id' => $otherSlot->id, 'preference_level' => 3],
@@ -766,7 +766,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
public function test_unauthenticated_sync_returns_401(): void
{
$response = $this->postJson(
"/api/v1/events/{$this->event->id}/persons/{$this->person->id}/availabilities/sync",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/persons/{$this->person->id}/availabilities/sync",
['availabilities' => []],
);
@@ -784,7 +784,7 @@ class ShiftAssignmentWorkflowTest extends TestCase
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson(
"/api/v1/events/{$this->event->id}/persons/{$this->person->id}/availabilities",
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/persons/{$this->person->id}/availabilities",
);
$response->assertOk();