Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c5ade61
Refactor OrcaSlicer logic: replace `ImportService` with `MapService`,…
andrey-helldar Jan 3, 2026
51c00ac
Extend OrcaSlicer `MapService`: integrate `WithVendor`, add support f…
andrey-helldar Jan 3, 2026
b0457cb
Remove `FilamentTypeTitleCast`: refactor filament type handling, clea…
andrey-helldar Jan 3, 2026
24b7c26
Add `FilamentTypeServiceTest` with comprehensive test cases; enhance …
andrey-helldar Jan 3, 2026
b83fbae
Rename `test_detect` to `testDetect` in `FilamentTypeServiceTest` for…
andrey-helldar Jan 3, 2026
2046bd1
Extend `FilamentTypeServiceTest` with additional PLA test cases for i…
andrey-helldar Jan 3, 2026
36ca066
Refactor and extend filament type normalization: update detection log…
andrey-helldar Jan 3, 2026
2ede6c9
Add `MachineService` for machine imports, update `MapService` with `p…
andrey-helldar Jan 3, 2026
007b3c9
Remove deprecated `ImportService` from OrcaSlicer implementation.
andrey-helldar Jan 3, 2026
4e37f36
Refactor OrcaSlicer import commands: update filament and nozzle impor…
andrey-helldar Jan 3, 2026
273a9bf
Remove `2026_01_02_142124_create_colors` operation: clean up unused m…
andrey-helldar Jan 3, 2026
aeccef9
Add `WithColor` trait for color handling and lazy initialization
andrey-helldar Jan 3, 2026
376ac52
Add lazy initialization for filaments in `WithFilaments` trait, integ…
andrey-helldar Jan 3, 2026
f4f6c9a
Add `external_id` to `Filament` model's fillable attributes for impro…
andrey-helldar Jan 3, 2026
f473d52
Refactor `store_user_settings` operation: integrate `WithVendor`, `Wi…
andrey-helldar Jan 3, 2026
55272eb
Extend `WithColor` trait: add `colorMap` support with default hex val…
andrey-helldar Jan 3, 2026
a1a329b
Add `HomeService` for homepage data handling and refactor `HomeContro…
andrey-helldar Jan 3, 2026
e3bfec1
Update `HomeService` to improve user filament statistics handling; ad…
andrey-helldar Jan 3, 2026
59cebd0
Update `welcome` page: rename dropdown filters to `filamentTypes` and…
andrey-helldar Jan 3, 2026
b5ec55e
Remove redundant `id` attributes from dropdown filters in `welcome` p…
andrey-helldar Jan 3, 2026
d32e64c
Add filtering support for user filaments on the homepage through new …
andrey-helldar Jan 3, 2026
e516192
Update `HomeService` to include `cover` in query; enhance `welcome` p…
andrey-helldar Jan 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ yarn-error.log
/.zed
/.junie
/.ai
/.output.txt
50 changes: 0 additions & 50 deletions app/Casts/FilamentTypeTitleCast.php

This file was deleted.

29 changes: 29 additions & 0 deletions app/Concerns/WithColor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace App\Concerns;

use App\Models\Color;

trait WithColor
{
protected array $colors = [];

protected array $colorMap = [
'Yellow' => '#FFFF00',
'Green' => '#00FF00',
'Blue' => '#0000FF',
'Grey' => '#808080',
'White' => '#FFFFFF',
'Gold' => '#FFCF40',
];

protected function color(string $name): Color
{
return $this->colors[$name] ??= Color::firstOrCreate([
'title' => $name,
'hex' => $this->colorMap[$name] ?? '#000000',
]);
}
}
30 changes: 30 additions & 0 deletions app/Concerns/WithFilaments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace App\Concerns;

use App\Models\Filament;
use App\Models\FilamentType;
use App\Models\Vendor;

trait WithFilaments
{
protected array $filamentTypes = [];

protected array $filaments = [];

protected function filamentType(string $value): FilamentType
{
return $this->filamentTypes[$value] ??= FilamentType::firstOrCreate(['title' => $value]);
}

protected function filament(Vendor $vendor, FilamentType $filamentType): Filament
{
$key = $vendor->id . '-' . $filamentType->id;

return $this->filaments[$key] ??= $vendor->filaments()->updateOrCreate([
'filament_type_id' => $filamentType->id,
]);
}
}
17 changes: 17 additions & 0 deletions app/Concerns/WithNozzles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace App\Concerns;

use App\Models\Nozzle;

trait WithNozzles
{
protected array $nozzles = [];

protected function nozzle(string|float $value): Nozzle
{
return $this->nozzles[(string) $value] ??= Nozzle::firstOrCreate(['title' => $value]);
}
}
17 changes: 17 additions & 0 deletions app/Concerns/WithVendor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace App\Concerns;

use App\Models\Vendor;

trait WithVendor
{
protected array $vendors = [];

protected function vendor(string $name): Vendor
{
return $this->vendors[$name] ??= Vendor::firstOrCreate(['title' => $name]);
}
}
36 changes: 36 additions & 0 deletions app/Console/Commands/OrcaSlicer/ImportCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace App\Console\Commands\OrcaSlicer;

use App\Services\OrcaSlicer\DownloadService;
use App\Services\OrcaSlicer\FilamentTypeService;
use App\Services\OrcaSlicer\MachineService;
use App\Services\OrcaSlicer\MapService;
use App\Services\OrcaSlicer\NozzleService;
use Illuminate\Console\Command;

class ImportCommand extends Command
{
protected $signature = 'orca-slicer:import';

protected $description = 'Update resources from OrcaSlicer';

public function handle(
DownloadService $download,
MapService $map,
MachineService $machine,
NozzleService $nozzle,
FilamentTypeService $filament,
): void {
//$this->components->task('Clean up', fn () => $download->cleanup());
//$this->components->task('Download', fn () => $download->download());
//$this->components->task('Extract', fn () => $download->extract());
//$this->components->task('Release', fn () => $download->release());
$this->components->task('Import map', fn () => $map->import());
$this->components->task('Import machines', fn () => $machine->import());
$this->components->task('Import nozzles', fn () => $nozzle->import());
$this->components->task('Import filaments', fn () => $filament->import());
}
}
25 changes: 0 additions & 25 deletions app/Console/Commands/OrcaSlicerCommand.php

This file was deleted.

12 changes: 12 additions & 0 deletions app/Enums/SourceType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace App\Enums;

enum SourceType: string
{
case Machine = 'machine';
case Filament = 'filament';
case Process = 'process';
}
27 changes: 12 additions & 15 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,24 @@

namespace App\Http\Controllers;

use App\Models\UserFilament;
use App\Http\Requests\HomeFilterRequest;
use App\Services\Pages\HomeService;
use Inertia\Inertia;

class HomeController
{
public function __invoke()
public function __invoke(HomeFilterRequest $request, HomeService $home)
{
$settings = UserFilament::query()
->with([
'machine.vendor',
'filament' => ['vendor', 'type'],
'color',
])
->orderBy('machine_id')
->orderBy('filament_id')
->orderBy('color_id')
->orderBy('id')
->get();

return Inertia::render('welcome', [
'settings' => $settings,
'userFilaments' => $home->userFilaments(
$request->integer('machine_id'),
$request->integer('filament_type_id'),
$request->integer('color_id'),
),
'machines' => $home->machines(),
'filamentTypes' => $home->filamentTypes(),
'colors' => $home->colors(),
'filters' => $request->validated(),
]);
}
}
19 changes: 19 additions & 0 deletions app/Http/Requests/HomeFilterRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class HomeFilterRequest extends FormRequest
{
public function rules(): array
{
return [
'machine_id' => ['nullable', 'integer', 'min:0'],
'filament_type_id' => ['nullable', 'integer', 'min:0'],
'color_id' => ['nullable', 'integer', 'min:0'],
];
}
}
6 changes: 6 additions & 0 deletions app/Models/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Casts\HexCast;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class Color extends Model
Expand All @@ -24,4 +25,9 @@ protected function casts(): array
'hex' => HexCast::class,
];
}

public function userFilament(): HasMany
{
return $this->hasMany(UserFilament::class);
}
}
7 changes: 7 additions & 0 deletions app/Models/Filament.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\SoftDeletes;

Expand All @@ -16,6 +17,7 @@ class Filament extends Model
protected $fillable = [
'vendor_id',
'filament_type_id',
'external_id',
];

public function vendor(): Relation
Expand All @@ -27,4 +29,9 @@ public function type(): Relation
{
return $this->belongsTo(FilamentType::class, 'filament_type_id', 'id');
}

public function userFilament(): HasMany
{
return $this->hasMany(UserFilament::class);
}
}
15 changes: 10 additions & 5 deletions app/Models/FilamentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace App\Models;

use App\Casts\FilamentTypeTitleCast;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use Illuminate\Database\Eloquent\SoftDeletes;

class FilamentType extends Model
Expand All @@ -17,10 +17,15 @@ class FilamentType extends Model
'title',
];

protected function casts(): array
public function userFilaments(): HasManyThrough
{
return [
'title' => FilamentTypeTitleCast::class,
];
return $this->hasManyThrough(
UserFilament::class,
Filament::class,
'filament_type_id',
'filament_id',
'id',
'id'
);
}
}
8 changes: 7 additions & 1 deletion app/Models/Machine.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Events\SluggableEvent;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\SoftDeletes;

Expand All @@ -34,6 +35,11 @@ protected function casts(): array

public function vendor(): Relation
{
return $this->belongsTo(Vendor::class);
return $this->belongsTo(Vendor::class, 'vendor_id', 'id');
}

public function userFilament(): HasMany
{
return $this->hasMany(UserFilament::class);
}
}
Loading
Loading