feat(labor): 노임관리 API 구현

- Labor 모델 (BelongsToTenant, SoftDeletes)
- LaborController 7개 엔드포인트
- LaborService 비즈니스 로직
- FormRequest 4개 (Index/Store/Update/BulkDelete)
- 마이그레이션 및 라우트 등록

API: GET/POST /labor, GET/PUT/DELETE /labor/{id}, DELETE /labor/bulk, GET /labor/stats

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-01-11 23:29:32 +09:00
parent ceb7798c28
commit f59dd1b9fb
11 changed files with 703 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?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::create('labors', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->string('labor_number', 50)->comment('노임번호');
$table->enum('category', ['가로', '세로할증'])->comment('구분');
$table->decimal('min_m', 10, 2)->default(0)->comment('최소 m');
$table->decimal('max_m', 10, 2)->default(0)->comment('최대 m');
$table->unsignedInteger('labor_price')->nullable()->comment('노임단가');
$table->enum('status', ['사용', '중지'])->default('사용')->comment('상태');
$table->boolean('is_active')->default(true)->comment('활성화 여부 (ModelTrait::scopeActive() 사용)');
$table->unsignedBigInteger('created_by')->nullable()->comment('생성자 ID');
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자 ID');
$table->unsignedBigInteger('deleted_by')->nullable()->comment('삭제자 ID');
$table->timestamps();
$table->softDeletes();
// 인덱스
$table->index(['tenant_id', 'category'], 'idx_tenant_category');
$table->index(['tenant_id', 'status'], 'idx_tenant_status');
$table->index(['tenant_id', 'labor_number'], 'idx_tenant_labor_number');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('labors');
}
};