feat: 휴가 부여현황 API 추가

- leave_grants 테이블 마이그레이션 추가
- LeaveGrant 모델 생성 (annual/monthly/reward/condolence/other 유형)
- LeaveService에 getGrants, storeGrant, destroyGrant 메서드 추가
- LeaveController에 grants, storeGrant, destroyGrant 엔드포인트 추가
- GET/POST/DELETE /api/v1/leaves/grants 라우트 추가
- 연차/월차 부여 시 LeaveBalance total_days 자동 갱신
This commit is contained in:
2025-12-24 19:39:33 +09:00
parent 3988372ca4
commit 01d9ccaf57
6 changed files with 363 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('leave_grants', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->unsignedBigInteger('user_id')->comment('부여 대상자 ID');
$table->string('grant_type', 20)->comment('부여유형: annual/monthly/reward/condolence/other');
$table->date('grant_date')->comment('부여일');
$table->decimal('grant_days', 4, 1)->comment('부여일수');
$table->text('reason')->nullable()->comment('부여 사유');
$table->unsignedBigInteger('created_by')->nullable()->comment('부여자 ID');
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자');
$table->unsignedBigInteger('deleted_by')->nullable()->comment('삭제자');
$table->softDeletes();
$table->timestamps();
$table->index(['tenant_id', 'user_id'], 'idx_tenant_user');
$table->index('grant_date', 'idx_grant_date');
$table->index('grant_type', 'idx_grant_type');
});
}
public function down(): void
{
Schema::dropIfExists('leave_grants');
}
};