feat: 근태관리/직원관리 API 구현
- AttendanceController, AttendanceService 추가 - EmployeeController, EmployeeService 추가 - Attendance 모델 및 마이그레이션 추가 - TenantUserProfile에 employee_status 컬럼 추가 - DepartmentService 트리 조회 기능 개선 - Swagger 문서 추가 (AttendanceApi, EmployeeApi) - API 라우트 등록
This commit is contained in:
422
app/Swagger/v1/AttendanceApi.php
Normal file
422
app/Swagger/v1/AttendanceApi.php
Normal file
@@ -0,0 +1,422 @@
|
||||
<?php
|
||||
|
||||
namespace App\Swagger\v1;
|
||||
|
||||
/**
|
||||
* @OA\Tag(name="Attendances", description="근태 관리 (HR)")
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="Attendance",
|
||||
* type="object",
|
||||
* description="근태 정보",
|
||||
*
|
||||
* @OA\Property(property="id", type="integer", example=1, description="근태 ID"),
|
||||
* @OA\Property(property="tenant_id", type="integer", example=1, description="테넌트 ID"),
|
||||
* @OA\Property(property="user_id", type="integer", example=10, description="사용자 ID"),
|
||||
* @OA\Property(property="base_date", type="string", format="date", example="2024-01-15", description="기준일"),
|
||||
* @OA\Property(property="status", type="string", enum={"onTime","late","absent","vacation","businessTrip","fieldWork","overtime","remote"}, example="onTime", description="근태 상태"),
|
||||
* @OA\Property(property="remarks", type="string", example="외근으로 인한 지각", nullable=true, description="비고"),
|
||||
* @OA\Property(property="check_in", type="string", example="09:00:00", nullable=true, description="출근 시간"),
|
||||
* @OA\Property(property="check_out", type="string", example="18:00:00", nullable=true, description="퇴근 시간"),
|
||||
* @OA\Property(property="work_minutes", type="integer", example=540, nullable=true, description="근무 시간(분)"),
|
||||
* @OA\Property(property="overtime_minutes", type="integer", example=60, nullable=true, description="초과 근무 시간(분)"),
|
||||
* @OA\Property(property="late_minutes", type="integer", example=15, nullable=true, description="지각 시간(분)"),
|
||||
* @OA\Property(property="user", type="object", nullable=true, description="사용자 정보",
|
||||
* @OA\Property(property="id", type="integer", example=10),
|
||||
* @OA\Property(property="name", type="string", example="홍길동"),
|
||||
* @OA\Property(property="email", type="string", example="hong@company.com")
|
||||
* ),
|
||||
* @OA\Property(property="created_at", type="string", format="date-time", example="2024-01-15T09:00:00Z"),
|
||||
* @OA\Property(property="updated_at", type="string", format="date-time", example="2024-01-15T18:00:00Z")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="AttendanceCreateRequest",
|
||||
* type="object",
|
||||
* required={"user_id", "base_date"},
|
||||
* description="근태 등록 요청",
|
||||
*
|
||||
* @OA\Property(property="user_id", type="integer", example=10, description="사용자 ID"),
|
||||
* @OA\Property(property="base_date", type="string", format="date", example="2024-01-15", description="기준일"),
|
||||
* @OA\Property(property="status", type="string", enum={"onTime","late","absent","vacation","businessTrip","fieldWork","overtime","remote"}, example="onTime", description="근태 상태"),
|
||||
* @OA\Property(property="remarks", type="string", example="외근으로 인한 지각", description="비고"),
|
||||
* @OA\Property(property="check_in", type="string", example="09:00:00", description="출근 시간"),
|
||||
* @OA\Property(property="check_out", type="string", example="18:00:00", description="퇴근 시간"),
|
||||
* @OA\Property(property="work_minutes", type="integer", example=540, description="근무 시간(분)"),
|
||||
* @OA\Property(property="overtime_minutes", type="integer", example=60, description="초과 근무 시간(분)"),
|
||||
* @OA\Property(property="vacation_type", type="string", example="annual", description="휴가 유형")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="AttendanceUpdateRequest",
|
||||
* type="object",
|
||||
* description="근태 수정 요청",
|
||||
*
|
||||
* @OA\Property(property="status", type="string", enum={"onTime","late","absent","vacation","businessTrip","fieldWork","overtime","remote"}, example="onTime", description="근태 상태"),
|
||||
* @OA\Property(property="remarks", type="string", example="수정된 비고", description="비고"),
|
||||
* @OA\Property(property="check_in", type="string", example="09:00:00", description="출근 시간"),
|
||||
* @OA\Property(property="check_out", type="string", example="18:00:00", description="퇴근 시간"),
|
||||
* @OA\Property(property="work_minutes", type="integer", example=540, description="근무 시간(분)")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="AttendanceMonthlyStats",
|
||||
* type="object",
|
||||
* description="월간 근태 통계",
|
||||
*
|
||||
* @OA\Property(property="year", type="integer", example=2024),
|
||||
* @OA\Property(property="month", type="integer", example=1),
|
||||
* @OA\Property(property="total_days", type="integer", example=22, description="총 기록 일수"),
|
||||
* @OA\Property(property="by_status", type="object", description="상태별 일수",
|
||||
* @OA\Property(property="onTime", type="integer", example=18),
|
||||
* @OA\Property(property="late", type="integer", example=2),
|
||||
* @OA\Property(property="absent", type="integer", example=0),
|
||||
* @OA\Property(property="vacation", type="integer", example=2),
|
||||
* @OA\Property(property="businessTrip", type="integer", example=0),
|
||||
* @OA\Property(property="fieldWork", type="integer", example=0),
|
||||
* @OA\Property(property="overtime", type="integer", example=0),
|
||||
* @OA\Property(property="remote", type="integer", example=0)
|
||||
* ),
|
||||
* @OA\Property(property="total_work_minutes", type="integer", example=11880, description="총 근무 시간(분)"),
|
||||
* @OA\Property(property="total_overtime_minutes", type="integer", example=300, description="총 초과 근무 시간(분)")
|
||||
* )
|
||||
*/
|
||||
class AttendanceApi
|
||||
{
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/v1/attendances",
|
||||
* tags={"Attendances"},
|
||||
* summary="근태 목록 조회",
|
||||
* description="필터/검색/페이지네이션으로 근태 목록을 조회합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\Parameter(name="user_id", in="query", description="사용자 ID 필터", @OA\Schema(type="integer")),
|
||||
* @OA\Parameter(name="date", in="query", description="특정 날짜 (YYYY-MM-DD)", @OA\Schema(type="string", format="date")),
|
||||
* @OA\Parameter(name="date_from", in="query", description="시작 날짜", @OA\Schema(type="string", format="date")),
|
||||
* @OA\Parameter(name="date_to", in="query", description="종료 날짜", @OA\Schema(type="string", format="date")),
|
||||
* @OA\Parameter(name="status", in="query", description="근태 상태", @OA\Schema(type="string", enum={"onTime","late","absent","vacation","businessTrip","fieldWork","overtime","remote"})),
|
||||
* @OA\Parameter(name="department_id", in="query", description="부서 ID 필터", @OA\Schema(type="integer")),
|
||||
* @OA\Parameter(name="sort_by", in="query", description="정렬 기준", @OA\Schema(type="string", enum={"base_date","status","created_at"}, default="base_date")),
|
||||
* @OA\Parameter(name="sort_dir", in="query", description="정렬 방향", @OA\Schema(type="string", enum={"asc","desc"}, default="desc")),
|
||||
* @OA\Parameter(ref="#/components/parameters/Page"),
|
||||
* @OA\Parameter(ref="#/components/parameters/Size"),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(
|
||||
*
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="object",
|
||||
* @OA\Property(property="current_page", type="integer", example=1),
|
||||
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/Attendance")),
|
||||
* @OA\Property(property="per_page", type="integer", example=20),
|
||||
* @OA\Property(property="total", type="integer", example=100)
|
||||
* )
|
||||
* )
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function index() {}
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/v1/attendances/monthly-stats",
|
||||
* tags={"Attendances"},
|
||||
* summary="월간 통계 조회",
|
||||
* description="월간 근태 통계를 조회합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\Parameter(name="year", in="query", description="연도", @OA\Schema(type="integer", example=2024)),
|
||||
* @OA\Parameter(name="month", in="query", description="월", @OA\Schema(type="integer", example=1, minimum=1, maximum=12)),
|
||||
* @OA\Parameter(name="user_id", in="query", description="특정 사용자 ID (미지정시 전체)", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/AttendanceMonthlyStats"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function monthlyStats() {}
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/api/v1/attendances/check-in",
|
||||
* tags={"Attendances"},
|
||||
* summary="출근 기록 (체크인)",
|
||||
* description="출근 시간을 기록합니다. 당일 기록이 없으면 새로 생성, 있으면 업데이트합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=false,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="user_id", type="integer", example=10, description="사용자 ID (미지정시 본인)"),
|
||||
* @OA\Property(property="check_in", type="string", example="09:00:00", description="출근 시간 (미지정시 현재 시간)"),
|
||||
* @OA\Property(property="gps_data", type="object", description="GPS 데이터",
|
||||
* @OA\Property(property="latitude", type="number", format="float", example=37.5665),
|
||||
* @OA\Property(property="longitude", type="number", format="float", example=126.9780)
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="출근 기록 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Attendance"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function checkIn() {}
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/api/v1/attendances/check-out",
|
||||
* tags={"Attendances"},
|
||||
* summary="퇴근 기록 (체크아웃)",
|
||||
* description="퇴근 시간을 기록합니다. 출근 기록이 없으면 에러가 발생합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=false,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
*
|
||||
* @OA\Property(property="user_id", type="integer", example=10, description="사용자 ID (미지정시 본인)"),
|
||||
* @OA\Property(property="check_out", type="string", example="18:00:00", description="퇴근 시간 (미지정시 현재 시간)"),
|
||||
* @OA\Property(property="gps_data", type="object", description="GPS 데이터",
|
||||
* @OA\Property(property="latitude", type="number", format="float", example=37.5665),
|
||||
* @OA\Property(property="longitude", type="number", format="float", example=126.9780)
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="퇴근 기록 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Attendance"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=400, description="출근 기록 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function checkOut() {}
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/v1/attendances/{id}",
|
||||
* tags={"Attendances"},
|
||||
* summary="근태 상세 조회",
|
||||
* description="ID 기준 근태 상세 정보를 조회합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="근태 ID", @OA\Schema(type="integer", example=1)),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Attendance"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=404, description="근태 기록을 찾을 수 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function show() {}
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/api/v1/attendances",
|
||||
* tags={"Attendances"},
|
||||
* summary="근태 등록",
|
||||
* description="새 근태 기록을 등록합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(ref="#/components/schemas/AttendanceCreateRequest")
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=201,
|
||||
* description="등록 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Attendance"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=409, description="같은 날 기록이 이미 존재함", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function store() {}
|
||||
|
||||
/**
|
||||
* @OA\Patch(
|
||||
* path="/api/v1/attendances/{id}",
|
||||
* tags={"Attendances"},
|
||||
* summary="근태 수정",
|
||||
* description="근태 기록을 수정합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="근태 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(ref="#/components/schemas/AttendanceUpdateRequest")
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="수정 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Attendance"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=404, description="근태 기록을 찾을 수 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function update() {}
|
||||
|
||||
/**
|
||||
* @OA\Delete(
|
||||
* path="/api/v1/attendances/{id}",
|
||||
* tags={"Attendances"},
|
||||
* summary="근태 삭제",
|
||||
* description="근태 기록을 삭제합니다 (소프트 삭제).",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="근태 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="삭제 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="삭제 완료"),
|
||||
* @OA\Property(property="data", type="boolean", example=true)
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=404, description="근태 기록을 찾을 수 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function destroy() {}
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/api/v1/attendances/bulk-delete",
|
||||
* tags={"Attendances"},
|
||||
* summary="근태 일괄 삭제",
|
||||
* description="여러 근태 기록을 일괄 삭제합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* required={"ids"},
|
||||
*
|
||||
* @OA\Property(property="ids", type="array", @OA\Items(type="integer"), example={1, 2, 3}, description="삭제할 근태 ID 목록")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="일괄 삭제 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="일괄 삭제 완료"),
|
||||
* @OA\Property(property="data", type="object",
|
||||
* @OA\Property(property="deleted_count", type="integer", example=3)
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function bulkDelete() {}
|
||||
}
|
||||
433
app/Swagger/v1/EmployeeApi.php
Normal file
433
app/Swagger/v1/EmployeeApi.php
Normal file
@@ -0,0 +1,433 @@
|
||||
<?php
|
||||
|
||||
namespace App\Swagger\v1;
|
||||
|
||||
/**
|
||||
* @OA\Tag(name="Employees", description="사원 관리 (HR)")
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="Employee",
|
||||
* type="object",
|
||||
* description="사원 정보",
|
||||
*
|
||||
* @OA\Property(property="id", type="integer", example=1, description="사원 프로필 ID"),
|
||||
* @OA\Property(property="tenant_id", type="integer", example=1, description="테넌트 ID"),
|
||||
* @OA\Property(property="user_id", type="integer", example=10, description="사용자 ID"),
|
||||
* @OA\Property(property="name", type="string", example="홍길동", description="이름"),
|
||||
* @OA\Property(property="email", type="string", example="hong@company.com", description="이메일"),
|
||||
* @OA\Property(property="phone", type="string", example="010-1234-5678", description="연락처"),
|
||||
* @OA\Property(property="department_id", type="integer", example=5, nullable=true, description="부서 ID"),
|
||||
* @OA\Property(property="department_name", type="string", example="개발팀", nullable=true, description="부서명"),
|
||||
* @OA\Property(property="position_key", type="string", example="manager", nullable=true, description="직급 키"),
|
||||
* @OA\Property(property="job_title_key", type="string", example="developer", nullable=true, description="직책 키"),
|
||||
* @OA\Property(property="work_location_key", type="string", example="seoul_hq", nullable=true, description="근무지 키"),
|
||||
* @OA\Property(property="employment_type_key", type="string", example="fulltime", nullable=true, description="고용형태 키"),
|
||||
* @OA\Property(property="employee_status", type="string", enum={"active", "leave", "resigned"}, example="active", description="고용상태"),
|
||||
* @OA\Property(property="manager_user_id", type="integer", example=5, nullable=true, description="상급자 ID"),
|
||||
* @OA\Property(property="display_name", type="string", example="홍길동 매니저", nullable=true, description="표시명"),
|
||||
* @OA\Property(property="profile_photo_path", type="string", example="/photos/hong.jpg", nullable=true, description="프로필 사진 경로"),
|
||||
* @OA\Property(property="employee_code", type="string", example="EMP-001", nullable=true, description="사원번호"),
|
||||
* @OA\Property(property="hire_date", type="string", format="date", example="2020-03-15", nullable=true, description="입사일"),
|
||||
* @OA\Property(property="rank", type="string", example="G3", nullable=true, description="호봉"),
|
||||
* @OA\Property(property="work_type", type="string", enum={"regular", "daily", "temporary", "external"}, example="regular", nullable=true, description="근무형태"),
|
||||
* @OA\Property(property="has_account", type="boolean", example=true, description="시스템 계정 보유 여부"),
|
||||
* @OA\Property(property="is_active", type="boolean", example=true, description="활성 상태"),
|
||||
* @OA\Property(property="created_at", type="string", format="date-time", example="2020-03-15T09:00:00Z"),
|
||||
* @OA\Property(property="updated_at", type="string", format="date-time", example="2024-01-10T14:30:00Z")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="EmployeeCreateRequest",
|
||||
* type="object",
|
||||
* required={"name", "email"},
|
||||
* description="사원 등록 요청",
|
||||
*
|
||||
* @OA\Property(property="user_id", type="string", example="hong001", description="사용자 ID (로그인 ID)"),
|
||||
* @OA\Property(property="name", type="string", example="홍길동", description="이름"),
|
||||
* @OA\Property(property="email", type="string", format="email", example="hong@company.com", description="이메일"),
|
||||
* @OA\Property(property="phone", type="string", example="010-1234-5678", description="연락처"),
|
||||
* @OA\Property(property="password", type="string", example="Password123!", description="초기 비밀번호 (미입력시 계정 미생성)"),
|
||||
* @OA\Property(property="is_active", type="boolean", example=true, description="활성 상태"),
|
||||
* @OA\Property(property="department_id", type="integer", example=5, description="부서 ID"),
|
||||
* @OA\Property(property="position_key", type="string", example="manager", description="직급 키"),
|
||||
* @OA\Property(property="job_title_key", type="string", example="developer", description="직책 키"),
|
||||
* @OA\Property(property="work_location_key", type="string", example="seoul_hq", description="근무지 키"),
|
||||
* @OA\Property(property="employment_type_key", type="string", example="fulltime", description="고용형태 키"),
|
||||
* @OA\Property(property="employee_status", type="string", enum={"active", "leave", "resigned"}, example="active", description="고용상태"),
|
||||
* @OA\Property(property="manager_user_id", type="integer", example=5, description="상급자 ID"),
|
||||
* @OA\Property(property="display_name", type="string", example="홍길동 매니저", description="표시명"),
|
||||
* @OA\Property(property="employee_code", type="string", example="EMP-001", description="사원번호"),
|
||||
* @OA\Property(property="resident_number", type="string", example="encrypted_value", description="주민번호 (암호화)"),
|
||||
* @OA\Property(property="gender", type="string", enum={"male", "female"}, example="male", description="성별"),
|
||||
* @OA\Property(
|
||||
* property="address",
|
||||
* type="object",
|
||||
* @OA\Property(property="zipCode", type="string", example="06234"),
|
||||
* @OA\Property(property="address1", type="string", example="서울시 강남구 테헤란로 123"),
|
||||
* @OA\Property(property="address2", type="string", example="10층 1001호")
|
||||
* ),
|
||||
* @OA\Property(property="salary", type="number", format="float", example=50000000, description="연봉"),
|
||||
* @OA\Property(property="hire_date", type="string", format="date", example="2020-03-15", description="입사일"),
|
||||
* @OA\Property(property="rank", type="string", example="G3", description="호봉"),
|
||||
* @OA\Property(
|
||||
* property="bank_account",
|
||||
* type="object",
|
||||
* @OA\Property(property="bankName", type="string", example="국민은행"),
|
||||
* @OA\Property(property="accountNumber", type="string", example="123-456-789012"),
|
||||
* @OA\Property(property="accountHolder", type="string", example="홍길동")
|
||||
* ),
|
||||
* @OA\Property(property="work_type", type="string", enum={"regular", "daily", "temporary", "external"}, example="regular", description="근무형태"),
|
||||
* @OA\Property(
|
||||
* property="contract_info",
|
||||
* type="object",
|
||||
* @OA\Property(property="start_date", type="string", format="date", example="2024-01-01"),
|
||||
* @OA\Property(property="end_date", type="string", format="date", example="2024-12-31"),
|
||||
* @OA\Property(property="external_company", type="string", example="파트너사")
|
||||
* )
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="EmployeeUpdateRequest",
|
||||
* type="object",
|
||||
* description="사원 수정 요청",
|
||||
*
|
||||
* @OA\Property(property="name", type="string", example="홍길동"),
|
||||
* @OA\Property(property="email", type="string", format="email", example="hong@company.com"),
|
||||
* @OA\Property(property="phone", type="string", example="010-1234-5678"),
|
||||
* @OA\Property(property="is_active", type="boolean", example=true),
|
||||
* @OA\Property(property="department_id", type="integer", example=5),
|
||||
* @OA\Property(property="position_key", type="string", example="manager"),
|
||||
* @OA\Property(property="job_title_key", type="string", example="developer"),
|
||||
* @OA\Property(property="work_location_key", type="string", example="seoul_hq"),
|
||||
* @OA\Property(property="employment_type_key", type="string", example="fulltime"),
|
||||
* @OA\Property(property="employee_status", type="string", enum={"active", "leave", "resigned"}, example="active"),
|
||||
* @OA\Property(property="manager_user_id", type="integer", example=5),
|
||||
* @OA\Property(property="display_name", type="string", example="홍길동 매니저"),
|
||||
* @OA\Property(property="employee_code", type="string", example="EMP-001"),
|
||||
* @OA\Property(property="hire_date", type="string", format="date", example="2020-03-15"),
|
||||
* @OA\Property(property="rank", type="string", example="G3"),
|
||||
* @OA\Property(property="work_type", type="string", enum={"regular", "daily", "temporary", "external"}, example="regular")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="EmployeeStats",
|
||||
* type="object",
|
||||
* description="사원 통계",
|
||||
*
|
||||
* @OA\Property(property="total", type="integer", example=150, description="전체 사원 수"),
|
||||
* @OA\Property(property="active", type="integer", example=140, description="재직 중"),
|
||||
* @OA\Property(property="leave", type="integer", example=5, description="휴직 중"),
|
||||
* @OA\Property(property="resigned", type="integer", example=5, description="퇴직"),
|
||||
* @OA\Property(property="has_account", type="integer", example=130, description="시스템 계정 보유"),
|
||||
* @OA\Property(property="no_account", type="integer", example=20, description="시스템 계정 미보유")
|
||||
* )
|
||||
*/
|
||||
class EmployeeApi
|
||||
{
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/v1/employees",
|
||||
* tags={"Employees"},
|
||||
* summary="사원 목록 조회",
|
||||
* description="필터/검색/페이지네이션으로 사원 목록을 조회합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\Parameter(name="q", in="query", description="이름/이메일/사원번호 검색어", @OA\Schema(type="string")),
|
||||
* @OA\Parameter(name="status", in="query", description="고용상태 필터", @OA\Schema(type="string", enum={"active", "leave", "resigned"})),
|
||||
* @OA\Parameter(name="department_id", in="query", description="부서 ID 필터", @OA\Schema(type="integer", example=5)),
|
||||
* @OA\Parameter(name="has_account", in="query", description="시스템 계정 보유 여부", @OA\Schema(type="string", enum={"0", "1", "true", "false"})),
|
||||
* @OA\Parameter(name="sort_by", in="query", description="정렬 기준", @OA\Schema(type="string", enum={"created_at", "name", "employee_status", "department_id"}, default="created_at")),
|
||||
* @OA\Parameter(name="sort_dir", in="query", description="정렬 방향", @OA\Schema(type="string", enum={"asc", "desc"}, default="desc")),
|
||||
* @OA\Parameter(ref="#/components/parameters/Page"),
|
||||
* @OA\Parameter(ref="#/components/parameters/Size"),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(
|
||||
*
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="object",
|
||||
* @OA\Property(property="current_page", type="integer", example=1),
|
||||
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/Employee")),
|
||||
* @OA\Property(property="first_page_url", type="string", example="/api/v1/employees?page=1"),
|
||||
* @OA\Property(property="from", type="integer", example=1),
|
||||
* @OA\Property(property="last_page", type="integer", example=8),
|
||||
* @OA\Property(property="last_page_url", type="string", example="/api/v1/employees?page=8"),
|
||||
* @OA\Property(property="next_page_url", type="string", nullable=true, example="/api/v1/employees?page=2"),
|
||||
* @OA\Property(property="path", type="string", example="/api/v1/employees"),
|
||||
* @OA\Property(property="per_page", type="integer", example=20),
|
||||
* @OA\Property(property="prev_page_url", type="string", nullable=true, example=null),
|
||||
* @OA\Property(property="to", type="integer", example=20),
|
||||
* @OA\Property(property="total", type="integer", example=150)
|
||||
* )
|
||||
* )
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function index() {}
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/v1/employees/stats",
|
||||
* tags={"Employees"},
|
||||
* summary="사원 통계 조회",
|
||||
* description="사원 현황 통계를 조회합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/EmployeeStats"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function stats() {}
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/v1/employees/{id}",
|
||||
* tags={"Employees"},
|
||||
* summary="사원 상세 조회",
|
||||
* description="ID 기준 사원 상세 정보를 조회합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="사원 프로필 ID", @OA\Schema(type="integer", example=1)),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="조회 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Employee"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=404, description="사원을 찾을 수 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function show() {}
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/api/v1/employees",
|
||||
* tags={"Employees"},
|
||||
* summary="사원 등록",
|
||||
* description="새 사원을 등록합니다. password를 입력하면 시스템 계정도 함께 생성됩니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(ref="#/components/schemas/EmployeeCreateRequest")
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=201,
|
||||
* description="등록 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Employee"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=409, description="이메일 중복", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function store() {}
|
||||
|
||||
/**
|
||||
* @OA\Patch(
|
||||
* path="/api/v1/employees/{id}",
|
||||
* tags={"Employees"},
|
||||
* summary="사원 수정",
|
||||
* description="사원 정보를 수정합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="사원 프로필 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(ref="#/components/schemas/EmployeeUpdateRequest")
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="수정 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Employee"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=404, description="사원을 찾을 수 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=409, description="이메일 중복", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function update() {}
|
||||
|
||||
/**
|
||||
* @OA\Delete(
|
||||
* path="/api/v1/employees/{id}",
|
||||
* tags={"Employees"},
|
||||
* summary="사원 삭제 (퇴직 처리)",
|
||||
* description="사원을 퇴직 처리합니다. employee_status가 'resigned'로 변경되고 소프트 삭제됩니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="사원 프로필 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="삭제 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="삭제 완료"),
|
||||
* @OA\Property(property="data", type="boolean", example=true)
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=404, description="사원을 찾을 수 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function destroy() {}
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/api/v1/employees/bulk-delete",
|
||||
* tags={"Employees"},
|
||||
* summary="사원 일괄 삭제",
|
||||
* description="여러 사원을 일괄 퇴직 처리합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* required={"ids"},
|
||||
*
|
||||
* @OA\Property(property="ids", type="array", @OA\Items(type="integer"), example={1, 2, 3}, description="삭제할 사원 ID 목록")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="일괄 삭제 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
*
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="일괄 삭제 완료"),
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="object",
|
||||
* @OA\Property(property="deleted_count", type="integer", example=3)
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function bulkDelete() {}
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/api/v1/employees/{id}/create-account",
|
||||
* tags={"Employees"},
|
||||
* summary="시스템 계정 생성",
|
||||
* description="기존 사원에게 시스템 로그인 계정을 생성합니다.",
|
||||
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||||
*
|
||||
* @OA\Parameter(name="id", in="path", required=true, description="사원 프로필 ID", @OA\Schema(type="integer")),
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* required={"password"},
|
||||
*
|
||||
* @OA\Property(property="password", type="string", minLength=8, example="Password123!", description="계정 비밀번호")
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="계정 생성 성공",
|
||||
*
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
*
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Employee"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=404, description="사원을 찾을 수 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=409, description="이미 계정이 존재함", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function createAccount() {}
|
||||
}
|
||||
Reference in New Issue
Block a user