feat(API): Position API 추가 (직급/직책 통합)

- Position 모델 생성 (type: rank | title)
- PositionService: CRUD + reorder 구현
- PositionController: REST API 엔드포인트
- Swagger 문서 작성 (PositionApi.php)
- 마이그레이션: positions 테이블 + common_codes 등록
- routes/api.php에 라우트 등록

Phase L-3 (직급관리), L-4 (직책관리) 백엔드 완료

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-30 11:18:17 +09:00
parent bdb7460bfa
commit 75576323fe
9 changed files with 665 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?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('positions', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->comment('테넌트 ID');
$table->string('type', 20)->comment('유형: rank(직급), title(직책)');
$table->string('name', 50)->comment('명칭');
$table->integer('sort_order')->default(0)->comment('정렬 순서');
$table->boolean('is_active')->default(true)->comment('활성화 여부');
$table->timestamps();
$table->softDeletes();
$table->index(['tenant_id', 'type', 'sort_order']);
$table->unique(['tenant_id', 'type', 'name', 'deleted_at'], 'positions_tenant_type_name_unique');
});
}
public function down(): void
{
Schema::dropIfExists('positions');
}
};

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
$now = now();
// position_type 코드 그룹 (직급/직책 구분)
$positionTypes = [
['code' => 'rank', 'name' => '직급', 'sort_order' => 1],
['code' => 'title', 'name' => '직책', 'sort_order' => 2],
];
foreach ($positionTypes as $item) {
DB::table('common_codes')->updateOrInsert(
['code_group' => 'position_type', 'code' => $item['code']],
[
'code_group' => 'position_type',
'code' => $item['code'],
'name' => $item['name'],
'sort_order' => $item['sort_order'],
'is_active' => true,
'created_at' => $now,
'updated_at' => $now,
]
);
}
}
public function down(): void
{
DB::table('common_codes')->where('code_group', 'position_type')->delete();
}
};