feat: Implement Ledger alignment and correct corrective mutation authors in seeders

This commit is contained in:
Daan Meijer
2026-06-15 23:22:08 +02:00
parent bf7da48a58
commit 3dd7c48b08
9 changed files with 177 additions and 8 deletions
+1
View File
@@ -30,6 +30,7 @@ class LedgerFactory extends Factory
]),
'rules' => 'Scores are added by Doms and subtracted for protocol breaches.',
'score' => 0,
'alignment' => 'neutral',
];
}
}
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('ledgers', function (Blueprint $table) {
$table->string('alignment')->default('neutral')->after('rules');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ledgers', function (Blueprint $table) {
$table->dropColumn('alignment');
});
}
};
+9 -4
View File
@@ -94,6 +94,7 @@ class DatabaseSeeder extends Seeder
'name' => 'Curfew Compliance',
'rules' => 'Must be in bed and checked in by 11:00 PM.',
'score' => 35,
'alignment' => 'positive',
]);
$cleaningLedger = Ledger::create([
@@ -101,6 +102,7 @@ class DatabaseSeeder extends Seeder
'name' => 'Dungeon Cleaning',
'rules' => 'Earn +10 to +20 points for cleaning/setup. Penalty -10 for disorganization.',
'score' => 45,
'alignment' => 'neutral',
]);
$etiquetteLedger = Ledger::create([
@@ -108,6 +110,7 @@ class DatabaseSeeder extends Seeder
'name' => 'Protocol & Etiquette',
'rules' => 'Address others by correct titles. -5 per infraction.',
'score' => -15,
'alignment' => 'negative',
]);
// Seed Curfew Mutations
@@ -168,7 +171,7 @@ class DatabaseSeeder extends Seeder
Mutation::create([
'ledger_id' => $cleaningLedger->id,
'user_id' => $bob->id,
'user_id' => $alice->id,
'type' => 'penalty',
'amount' => -10,
'description' => 'Left keys in the locks unmonitored',
@@ -209,7 +212,7 @@ class DatabaseSeeder extends Seeder
// Seed Etiquette Mutations
Mutation::create([
'ledger_id' => $etiquetteLedger->id,
'user_id' => $bob->id,
'user_id' => $alice->id,
'type' => 'penalty',
'amount' => -5,
'description' => 'Interrupted Domina Alice during daily instructions',
@@ -218,7 +221,7 @@ class DatabaseSeeder extends Seeder
Mutation::create([
'ledger_id' => $etiquetteLedger->id,
'user_id' => $bob->id,
'user_id' => $alice->id,
'type' => 'penalty',
'amount' => -10,
'description' => 'Forgot correct posture during morning roll call',
@@ -227,7 +230,7 @@ class DatabaseSeeder extends Seeder
Mutation::create([
'ledger_id' => $etiquetteLedger->id,
'user_id' => $bob->id,
'user_id' => $alice->id,
'type' => 'penalty',
'amount' => -5,
'description' => 'Spoke out of turn in general chat',
@@ -288,6 +291,7 @@ class DatabaseSeeder extends Seeder
'name' => 'Kitchen Chores',
'rules' => 'Scores for dishwashing, trash duty, and deep oven cleaning.',
'score' => 40,
'alignment' => 'positive',
]);
$coffeeLedger = Ledger::create([
@@ -295,6 +299,7 @@ class DatabaseSeeder extends Seeder
'name' => 'Coffee Machine Maintenance',
'rules' => ' refill beans and descale monthly.',
'score' => 10,
'alignment' => 'neutral',
]);
// Seed Chores Mutations