feat: 휴가 사용현황 전체 직원 목록 API 추가
- GET /api/v1/leaves/balances 엔드포인트 추가 - LeaveService.getAllBalances() 메서드 구현 - TenantUserProfile 기준 전체 활성 직원 조회 - LeaveBalance 서브쿼리로 연차 정보 LEFT JOIN - 부서/검색/정렬 필터링 및 페이지네이션 지원 - User 모델에 tenantProfiles/tenantProfile 관계 추가
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Models\Commons\File;
|
||||
use App\Models\Tenants\Tenant;
|
||||
use App\Models\Tenants\TenantUserProfile;
|
||||
use App\Traits\ModelTrait;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
@@ -77,4 +78,21 @@ public function tenantsMembership(): BelongsToMany
|
||||
->withPivot(['is_active', 'is_default', 'joined_at', 'left_at', 'deleted_at'])
|
||||
->wherePivotNull('deleted_at'); // 소프트삭제 제외
|
||||
}
|
||||
|
||||
/**
|
||||
* 테넌트별 사용자 프로필 (전체)
|
||||
*/
|
||||
public function tenantProfiles()
|
||||
{
|
||||
return $this->hasMany(TenantUserProfile::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 테넌트의 사용자 프로필
|
||||
* 주의: 조회 시 tenant_id 조건 추가 필요
|
||||
*/
|
||||
public function tenantProfile()
|
||||
{
|
||||
return $this->hasOne(TenantUserProfile::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user