feat: 근무/출퇴근 설정 및 현장 관리 API 구현

- 근무 설정 API (GET/PUT /settings/work)
  - 근무유형, 소정근로시간, 연장근로시간, 근무요일, 출퇴근시간, 휴게시간
- 출퇴근 설정 API (GET/PUT /settings/attendance)
  - GPS 출퇴근, 허용 반경, 본사 위치 설정
- 현장 관리 API (CRUD /sites)
  - 현장 등록/수정/삭제, 활성화된 현장 목록(셀렉트박스용)
  - GPS 좌표 기반 위치 관리

마이그레이션: work_settings, attendance_settings, sites 테이블
모델: WorkSetting, AttendanceSetting, Site (BelongsToTenant, SoftDeletes)
서비스: WorkSettingService, SiteService
Swagger 문서 및 i18n 메시지 키 추가
This commit is contained in:
2025-12-17 20:46:37 +09:00
parent e81e5d7084
commit ca5618be98
19 changed files with 1523 additions and 6 deletions

View File

@@ -0,0 +1,40 @@
<?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('work_settings', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->unique()->comment('테넌트 ID');
$table->string('work_type', 20)->default('fixed')->comment('근무유형: fixed/flexible/custom');
$table->integer('standard_hours')->default(40)->comment('주당 소정근로시간');
$table->integer('overtime_hours')->default(12)->comment('주당 연장근로시간');
$table->integer('overtime_limit')->default(52)->comment('연장근로한도');
$table->json('work_days')->nullable()->comment('근무요일 ["mon","tue","wed","thu","fri"]');
$table->time('start_time')->default('09:00:00')->comment('출근시간');
$table->time('end_time')->default('18:00:00')->comment('퇴근시간');
$table->integer('break_minutes')->default(60)->comment('휴게시간(분)');
$table->time('break_start')->nullable()->default('12:00:00')->comment('휴게시작');
$table->time('break_end')->nullable()->default('13:00:00')->comment('휴게종료');
$table->timestamps();
$table->index('tenant_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('work_settings');
}
};

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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('attendance_settings', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->unique()->comment('테넌트 ID');
$table->boolean('use_gps')->default(false)->comment('GPS 출퇴근 사용 여부');
$table->integer('allowed_radius')->default(100)->comment('허용 반경(m)');
$table->string('hq_address', 255)->nullable()->comment('본사 주소');
$table->decimal('hq_latitude', 10, 8)->nullable()->comment('본사 위도');
$table->decimal('hq_longitude', 11, 8)->nullable()->comment('본사 경도');
$table->timestamps();
$table->index('tenant_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('attendance_settings');
}
};

View File

@@ -0,0 +1,40 @@
<?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('sites', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->comment('테넌트 ID');
$table->string('name', 100)->comment('현장명');
$table->string('address', 255)->nullable()->comment('현장 주소');
$table->decimal('latitude', 10, 8)->nullable()->comment('위도');
$table->decimal('longitude', 11, 8)->nullable()->comment('경도');
$table->boolean('is_active')->default(true)->comment('활성화 여부');
$table->foreignId('created_by')->nullable()->comment('생성자');
$table->foreignId('updated_by')->nullable()->comment('수정자');
$table->foreignId('deleted_by')->nullable()->comment('삭제자');
$table->softDeletes();
$table->timestamps();
$table->index('tenant_id');
$table->index('is_active');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sites');
}
};