fix(capacity): stabilize PTO flows and calendar consistency
Make PTO creation immediately approved, add PTO deletion, and ensure cache invalidation updates individual/team/revenue capacity consistently. Harden holiday duplicate handling (422), support PTO-day availability overrides without disabling edits, and align tests plus OpenSpec artifacts with the new behavior.
This commit is contained in:
@@ -241,4 +241,35 @@ class TeamMemberTest extends TestCase
|
||||
'id' => $teamMember->id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_team_member_cache_is_invalidated_after_updates(): void
|
||||
{
|
||||
$token = $this->loginAsManager();
|
||||
$role = Role::factory()->create();
|
||||
$teamMember = TeamMember::factory()->create([
|
||||
'role_id' => $role->id,
|
||||
'active' => true,
|
||||
]);
|
||||
|
||||
$this->withHeader('Authorization', "Bearer {$token}")
|
||||
->getJson('/api/team-members?active=true')
|
||||
->assertStatus(200)
|
||||
->assertJsonCount(1, 'data');
|
||||
|
||||
$this->withHeader('Authorization', "Bearer {$token}")
|
||||
->putJson("/api/team-members/{$teamMember->id}", [
|
||||
'active' => false,
|
||||
])
|
||||
->assertStatus(200);
|
||||
|
||||
$this->withHeader('Authorization', "Bearer {$token}")
|
||||
->getJson('/api/team-members?active=true')
|
||||
->assertStatus(200)
|
||||
->assertJsonCount(0, 'data');
|
||||
|
||||
$this->withHeader('Authorization', "Bearer {$token}")
|
||||
->getJson('/api/team-members?active=false')
|
||||
->assertStatus(200)
|
||||
->assertJsonCount(1, 'data');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user