feat(API): 직책/직원/근태 관리 API 개선
- Position 모델: key 필드 추가 및 마이그레이션 - PositionSeeder: 기본 직책 시더 추가 - TenantUserProfile: 프로필 이미지 관련 필드 추가 - Employee Request: 직원 등록/수정 요청 검증 강화 - EmployeeService: 직원 관리 서비스 로직 개선 - AttendanceService: 근태 관리 서비스 개선 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('positions', function (Blueprint $table) {
|
||||
$table->string('key', 64)->nullable()->after('type')->comment('영문 키 (tenant_user_profiles 연동용)');
|
||||
$table->unique(['tenant_id', 'type', 'key'], 'positions_tenant_type_key_unique');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('positions', function (Blueprint $table) {
|
||||
$table->dropUnique('positions_tenant_type_key_unique');
|
||||
$table->dropColumn('key');
|
||||
});
|
||||
}
|
||||
};
|
||||
76
database/seeders/PositionSeeder.php
Normal file
76
database/seeders/PositionSeeder.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Tenants\Position;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PositionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
* 직급(rank)과 직책(title) 기본 데이터 생성
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$tenantId = 287; // 프론트_테스트회사
|
||||
|
||||
// 직급 (rank) - 기존 tenant_user_profiles.position_key와 매핑
|
||||
$ranks = [
|
||||
['key' => 'STAFF', 'name' => '사원', 'sort_order' => 1],
|
||||
['key' => 'SENIOR', 'name' => '주임', 'sort_order' => 2],
|
||||
['key' => 'ASSISTANT_MANAGER', 'name' => '대리', 'sort_order' => 3],
|
||||
['key' => 'MANAGER', 'name' => '과장', 'sort_order' => 4],
|
||||
['key' => 'DEPUTY_MANAGER', 'name' => '차장', 'sort_order' => 5],
|
||||
['key' => 'DIRECTOR', 'name' => '부장', 'sort_order' => 6],
|
||||
['key' => 'EXECUTIVE', 'name' => '이사', 'sort_order' => 7],
|
||||
['key' => 'SENIOR_EXECUTIVE', 'name' => '상무', 'sort_order' => 8],
|
||||
['key' => 'VICE_PRESIDENT', 'name' => '전무', 'sort_order' => 9],
|
||||
['key' => 'CEO', 'name' => '대표', 'sort_order' => 10],
|
||||
];
|
||||
|
||||
// 직책 (title)
|
||||
$titles = [
|
||||
['key' => 'MEMBER', 'name' => '팀원', 'sort_order' => 1],
|
||||
['key' => 'PART_LEADER', 'name' => '파트장', 'sort_order' => 2],
|
||||
['key' => 'TEAM_LEADER', 'name' => '팀장', 'sort_order' => 3],
|
||||
['key' => 'DEPARTMENT_HEAD', 'name' => '실장', 'sort_order' => 4],
|
||||
['key' => 'DIVISION_HEAD', 'name' => '본부장', 'sort_order' => 5],
|
||||
['key' => 'CEO', 'name' => '대표이사', 'sort_order' => 6],
|
||||
];
|
||||
|
||||
// 직급 생성
|
||||
foreach ($ranks as $rank) {
|
||||
Position::updateOrCreate(
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'type' => 'rank',
|
||||
'key' => $rank['key'],
|
||||
],
|
||||
[
|
||||
'name' => $rank['name'],
|
||||
'sort_order' => $rank['sort_order'],
|
||||
'is_active' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// 직책 생성
|
||||
foreach ($titles as $title) {
|
||||
Position::updateOrCreate(
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'type' => 'title',
|
||||
'key' => $title['key'],
|
||||
],
|
||||
[
|
||||
'name' => $title['name'],
|
||||
'sort_order' => $title['sort_order'],
|
||||
'is_active' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$this->command->info('Positions seeded: ' . count($ranks) . ' ranks, ' . count($titles) . ' titles');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user