added roles and organizations
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-15 20:59:32 -07:00
parent 2ca3860557
commit 177f122c10
57 changed files with 6378 additions and 247 deletions
+8 -2
View File
@@ -21,9 +21,15 @@ class BaseDatabaseSeeder extends Seeder
],
);
// The organization is created by the model's created hook, which is
// silenced while run under a parent seeder using WithoutModelEvents,
// so create one here when needed.
if ($admin->currentOrganization()->first() === null) {
$admin->createPersonalOrganization();
}
// Grandfather the admin so a fresh install is usable before any Stripe
// price is configured. The organization itself is created by the
// model's created hook.
// price is configured.
$admin->currentOrganization()->first()?->forceFill([
'lifetime_access' => true,
])->save();
+18 -3
View File
@@ -29,6 +29,12 @@ class DatabaseSeeder extends Seeder
],
);
// Model events are disabled while seeding, so the created hook that
// normally hands every account its personal workspace does not run.
if ($user->current_organization_id === null) {
$user->createPersonalOrganization();
}
$work = $this->createTopLevelFolder($user, 'Work');
$business = $this->createTopLevelFolder($user, 'Business');
$personal = $this->createTopLevelFolder($user, 'Personal');
@@ -69,7 +75,10 @@ class DatabaseSeeder extends Seeder
foreach ($samples as [$description, $folderName, $daysFromToday, $status]) {
$todo = Todo::firstOrCreate(
['user_id' => $user->id, 'folder_id' => $foldersByName[$folderName]->id, 'description' => $description],
['status' => TodoStatus::Open],
[
'status' => TodoStatus::Open,
'organization_id' => $foldersByName[$folderName]->organization_id,
],
);
if ($daysFromToday === null) {
@@ -97,7 +106,10 @@ class DatabaseSeeder extends Seeder
{
return Folder::firstOrCreate(
['user_id' => $user->id, 'name' => $name, 'parent_id' => null],
['color' => fake()->optional()->randomElement(Folder::COLORS)],
[
'organization_id' => $user->current_organization_id,
'color' => fake()->optional()->randomElement(Folder::COLORS),
],
);
}
@@ -105,7 +117,10 @@ class DatabaseSeeder extends Seeder
{
return Folder::firstOrCreate(
['user_id' => $parent->user_id, 'name' => $name, 'parent_id' => $parent->id],
['color' => fake()->optional()->randomElement(Folder::COLORS)],
[
'organization_id' => $parent->organization_id,
'color' => fake()->optional()->randomElement(Folder::COLORS),
],
);
}
}