Added telescope, basic project endpoint, basic filament resources, GitHub actions

This commit is contained in:
Constantin Graf
2024-01-28 18:57:28 +01:00
parent e4f0eac834
commit e60e502612
80 changed files with 2563 additions and 135 deletions

View File

@@ -26,4 +26,11 @@ class OrganizationFactory extends Factory
'personal_team' => true,
];
}
public function withOwner(): self
{
return $this->state(fn (array $attributes) => [
'user_id' => User::factory(),
]);
}
}

View File

@@ -27,6 +27,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfExists('teams');
Schema::dropIfExists('organizations');
}
};

View File

@@ -29,6 +29,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfExists('team_user');
Schema::dropIfExists('organization_user');
}
};

View File

@@ -31,6 +31,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfExists('team_invitations');
Schema::dropIfExists('organization_invitations');
}
};

View File

@@ -22,23 +22,32 @@ class DatabaseSeeder extends Seeder
public function run(): void
{
$this->deleteAll();
$organization = Organization::factory()->create([
$organization1 = Organization::factory()->create([
'name' => 'ACME Corp',
]);
$user1 = User::factory()->withPersonalOrganization()->create([
'name' => 'Test User',
'email' => 'test@example.com',
]);
$employee1 = User::factory()->withPersonalOrganization()->create([
'name' => 'Test User',
'email' => 'employee@example.com',
]);
$userAcmeAdmin = User::factory()->create([
'name' => 'ACME Admin',
'email' => 'admin@acme.test',
]);
$user1->organizations()->attach($organization, [
'role' => 'editor',
$user1->organizations()->attach($organization1, [
'role' => 'manager',
]);
$userAcmeAdmin->organizations()->attach($organization, [
$userAcmeAdmin->organizations()->attach($organization1, [
'role' => 'admin',
]);
$timeEntriesEmployees = TimeEntry::factory()
->count(10)
->forUser($employee1)
->forOrganization($organization1)
->create();
$client = Client::factory()->create([
'name' => 'Big Company',
]);
@@ -50,6 +59,24 @@ class DatabaseSeeder extends Seeder
$internalProject = Project::factory()->create([
'name' => 'Internal Project',
]);
$organization2 = Organization::factory()->create([
'name' => 'Rival Corp',
]);
$user1 = User::factory()->withPersonalOrganization()->create([
'name' => 'Other User',
'email' => 'test@rival-company.test',
]);
$user1->organizations()->attach($organization2, [
'role' => 'admin',
]);
$otherCompanyProject = Project::factory()->forClient($client)->create([
'name' => 'Scale Company',
]);
User::factory()->withPersonalOrganization()->create([
'email' => 'admin@example.com',
]);
}
private function deleteAll(): void