Migrated endpoints from user to member; Renamed membership to member

This commit is contained in:
Constantin Graf
2024-05-13 19:50:50 +02:00
parent ba335b4f05
commit b2365e2778
64 changed files with 853 additions and 456 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Database\Factories;
use App\Models\Member;
use App\Models\Organization;
use App\Models\Project;
use App\Models\Tag;
@@ -34,6 +35,7 @@ class TimeEntryFactory extends Factory
'billable' => $this->faker->boolean(),
'tags' => [],
'user_id' => User::factory(),
'member_id' => Member::factory(),
'task_id' => null,
'project_id' => null,
'organization_id' => Organization::factory(),
@@ -86,6 +88,9 @@ class TimeEntryFactory extends Factory
});
}
/**
* @deprecated Use forMember instead
*/
public function forUser(User $user): self
{
return $this->state(function (array $attributes) use ($user) {
@@ -95,6 +100,17 @@ class TimeEntryFactory extends Factory
});
}
public function forMember(Member $member): static
{
return $this->state(function (array $attributes) use ($member): array {
return [
'member_id' => $member->getKey(),
'user_id' => $member->user_id,
'organization_id' => $member->organization_id,
];
});
}
public function forOrganization(Organization $organization): self
{
return $this->state(function (array $attributes) use ($organization) {