1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Sorting: Renamed sort set to sort rule

Renamed based on feedback from Tim and Script on Discord.
Also fixed flaky test
This commit is contained in:
Dan Brown
2025-02-11 14:36:25 +00:00
parent a208c46b62
commit b9306a9029
30 changed files with 232 additions and 224 deletions

View File

@@ -27,7 +27,7 @@ class BookFactory extends Factory
'slug' => Str::random(10),
'description' => $description,
'description_html' => '<p>' . e($description) . '</p>',
'sort_set_id' => null,
'sort_rule_id' => null,
'default_template_id' => null,
];
}

View File

@@ -2,25 +2,25 @@
namespace Database\Factories\Sorting;
use BookStack\Sorting\SortSet;
use BookStack\Sorting\SortSetOperation;
use BookStack\Sorting\SortRule;
use BookStack\Sorting\SortRuleOperation;
use Illuminate\Database\Eloquent\Factories\Factory;
class SortSetFactory extends Factory
class SortRuleFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = SortSet::class;
protected $model = SortRule::class;
/**
* Define the model's default state.
*/
public function definition(): array
{
$cases = SortSetOperation::cases();
$cases = SortRuleOperation::cases();
$op = $cases[array_rand($cases)];
return [
'name' => $op->name . ' Sort',

View File

@@ -11,7 +11,7 @@ return new class extends Migration
*/
public function up(): void
{
Schema::create('sort_sets', function (Blueprint $table) {
Schema::create('sort_rules', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->text('sequence');
@@ -24,6 +24,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfExists('sort_sets');
Schema::dropIfExists('sort_rules');
}
};

View File

@@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('books', function (Blueprint $table) {
$table->unsignedInteger('sort_set_id')->nullable()->default(null);
$table->unsignedInteger('sort_rule_id')->nullable()->default(null);
});
}
@@ -22,7 +22,7 @@ return new class extends Migration
public function down(): void
{
Schema::table('books', function (Blueprint $table) {
$table->dropColumn('sort_set_id');
$table->dropColumn('sort_rule_id');
});
}
};