feat: [pm] 프로젝트 진행 관리 시스템 구현
- Models: AdminPmProject, AdminPmTask, AdminPmIssue - Services: ProjectService, TaskService, IssueService, ImportService - API Controllers: ProjectController, TaskController, IssueController, ImportController - FormRequests: Store/Update/BulkAction 요청 검증 - Views: 대시보드, 프로젝트 CRUD, JSON Import 화면 - Routes: API 42개 + Web 6개 엔드포인트 주요 기능: - 프로젝트/작업/이슈 계층 구조 관리 - 상태 변경, 우선순위, 마감일 추적 - 작업 순서 드래그앤드롭 (reorder API) - JSON Import로 일괄 등록 - Soft Delete 및 복원
This commit is contained in:
180
app/Models/Admin/AdminPmIssue.php
Normal file
180
app/Models/Admin/AdminPmIssue.php
Normal file
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* 프로젝트 관리 - 이슈 모델
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $project_id
|
||||
* @property int|null $task_id
|
||||
* @property string $title
|
||||
* @property string|null $description
|
||||
* @property string $type
|
||||
* @property string $status
|
||||
* @property int|null $created_by
|
||||
* @property int|null $updated_by
|
||||
* @property int|null $deleted_by
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property \Carbon\Carbon|null $deleted_at
|
||||
*/
|
||||
class AdminPmIssue extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'admin_pm_issues';
|
||||
|
||||
protected $fillable = [
|
||||
'project_id',
|
||||
'task_id',
|
||||
'title',
|
||||
'description',
|
||||
'type',
|
||||
'status',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'deleted_by',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'project_id' => 'integer',
|
||||
'task_id' => 'integer',
|
||||
'created_by' => 'integer',
|
||||
'updated_by' => 'integer',
|
||||
'deleted_by' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* 타입 상수
|
||||
*/
|
||||
public const TYPE_BUG = 'bug';
|
||||
|
||||
public const TYPE_FEATURE = 'feature';
|
||||
|
||||
public const TYPE_IMPROVEMENT = 'improvement';
|
||||
|
||||
/**
|
||||
* 상태 상수
|
||||
*/
|
||||
public const STATUS_OPEN = 'open';
|
||||
|
||||
public const STATUS_IN_PROGRESS = 'in_progress';
|
||||
|
||||
public const STATUS_RESOLVED = 'resolved';
|
||||
|
||||
public const STATUS_CLOSED = 'closed';
|
||||
|
||||
/**
|
||||
* 타입 목록
|
||||
*/
|
||||
public static function getTypes(): array
|
||||
{
|
||||
return [
|
||||
self::TYPE_BUG => '버그',
|
||||
self::TYPE_FEATURE => '기능',
|
||||
self::TYPE_IMPROVEMENT => '개선',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 상태 목록
|
||||
*/
|
||||
public static function getStatuses(): array
|
||||
{
|
||||
return [
|
||||
self::STATUS_OPEN => '대기중',
|
||||
self::STATUS_IN_PROGRESS => '처리중',
|
||||
self::STATUS_RESOLVED => '해결됨',
|
||||
self::STATUS_CLOSED => '종료',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 타입별 필터
|
||||
*/
|
||||
public function scopeType($query, string $type)
|
||||
{
|
||||
return $query->where('type', $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 상태별 필터
|
||||
*/
|
||||
public function scopeStatus($query, string $status)
|
||||
{
|
||||
return $query->where('status', $status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 열린 이슈 (open, in_progress)
|
||||
*/
|
||||
public function scopeOpen($query)
|
||||
{
|
||||
return $query->whereIn('status', [self::STATUS_OPEN, self::STATUS_IN_PROGRESS]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 관계: 프로젝트
|
||||
*/
|
||||
public function project(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(AdminPmProject::class, 'project_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 관계: 연결된 작업
|
||||
*/
|
||||
public function task(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(AdminPmTask::class, 'task_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 관계: 생성자
|
||||
*/
|
||||
public function creator(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
/**
|
||||
* 관계: 수정자
|
||||
*/
|
||||
public function updater(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'updated_by');
|
||||
}
|
||||
|
||||
/**
|
||||
* 타입 아이콘
|
||||
*/
|
||||
public function getTypeIconAttribute(): string
|
||||
{
|
||||
return match ($this->type) {
|
||||
self::TYPE_BUG => 'bug',
|
||||
self::TYPE_FEATURE => 'sparkles',
|
||||
self::TYPE_IMPROVEMENT => 'arrow-trending-up',
|
||||
default => 'question-mark-circle',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 상태 색상
|
||||
*/
|
||||
public function getStatusColorAttribute(): string
|
||||
{
|
||||
return match ($this->status) {
|
||||
self::STATUS_OPEN => 'red',
|
||||
self::STATUS_IN_PROGRESS => 'yellow',
|
||||
self::STATUS_RESOLVED => 'green',
|
||||
self::STATUS_CLOSED => 'gray',
|
||||
default => 'gray',
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user