feat: [equipment] 설비관리 API 백엔드 구현 (Phase 1)
- 모델 6개: Equipment, EquipmentInspection, EquipmentInspectionDetail, EquipmentInspectionTemplate, EquipmentRepair, EquipmentProcess
- InspectionCycle Enum: 6주기(일/주/월/격월/분기/반기) 날짜 해석
- 서비스 4개: EquipmentService, EquipmentInspectionService, EquipmentRepairService, EquipmentPhotoService
- 컨트롤러 4개: CRUD + 점검 토글/결과 설정/메모/초기화 + 템플릿 관리 + 수리이력 + 사진
- FormRequest 6개: 설비등록/수정, 수리이력, 점검템플릿, 토글, 메모
- 라우트 26개: equipment prefix 하위 RESTful 엔드포인트
- i18n 메시지: message.equipment.*, error.equipment.*
- 마이그레이션: equipments/equipment_repairs options JSON 컬럼 추가
2026-03-12 10:52:30 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\V1\Equipment;
|
|
|
|
|
|
|
|
|
|
use App\Helpers\ApiResponse;
|
|
|
|
|
use App\Http\Controllers\Controller;
|
2026-03-12 13:45:15 +09:00
|
|
|
use App\Http\Requests\Equipment\StoreEquipmentPhotoRequest;
|
feat: [equipment] 설비관리 API 백엔드 구현 (Phase 1)
- 모델 6개: Equipment, EquipmentInspection, EquipmentInspectionDetail, EquipmentInspectionTemplate, EquipmentRepair, EquipmentProcess
- InspectionCycle Enum: 6주기(일/주/월/격월/분기/반기) 날짜 해석
- 서비스 4개: EquipmentService, EquipmentInspectionService, EquipmentRepairService, EquipmentPhotoService
- 컨트롤러 4개: CRUD + 점검 토글/결과 설정/메모/초기화 + 템플릿 관리 + 수리이력 + 사진
- FormRequest 6개: 설비등록/수정, 수리이력, 점검템플릿, 토글, 메모
- 라우트 26개: equipment prefix 하위 RESTful 엔드포인트
- i18n 메시지: message.equipment.*, error.equipment.*
- 마이그레이션: equipments/equipment_repairs options JSON 컬럼 추가
2026-03-12 10:52:30 +09:00
|
|
|
use App\Services\Equipment\EquipmentPhotoService;
|
|
|
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
|
|
|
|
|
|
class EquipmentPhotoController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function __construct(private readonly EquipmentPhotoService $service) {}
|
|
|
|
|
|
|
|
|
|
public function index(int $id): JsonResponse
|
|
|
|
|
{
|
|
|
|
|
return ApiResponse::handle(
|
|
|
|
|
fn () => $this->service->index($id),
|
|
|
|
|
__('message.fetched')
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-12 13:45:15 +09:00
|
|
|
public function store(StoreEquipmentPhotoRequest $request, int $id): JsonResponse
|
feat: [equipment] 설비관리 API 백엔드 구현 (Phase 1)
- 모델 6개: Equipment, EquipmentInspection, EquipmentInspectionDetail, EquipmentInspectionTemplate, EquipmentRepair, EquipmentProcess
- InspectionCycle Enum: 6주기(일/주/월/격월/분기/반기) 날짜 해석
- 서비스 4개: EquipmentService, EquipmentInspectionService, EquipmentRepairService, EquipmentPhotoService
- 컨트롤러 4개: CRUD + 점검 토글/결과 설정/메모/초기화 + 템플릿 관리 + 수리이력 + 사진
- FormRequest 6개: 설비등록/수정, 수리이력, 점검템플릿, 토글, 메모
- 라우트 26개: equipment prefix 하위 RESTful 엔드포인트
- i18n 메시지: message.equipment.*, error.equipment.*
- 마이그레이션: equipments/equipment_repairs options JSON 컬럼 추가
2026-03-12 10:52:30 +09:00
|
|
|
{
|
|
|
|
|
return ApiResponse::handle(
|
2026-03-12 13:45:15 +09:00
|
|
|
fn () => $this->service->store($id, $request->file('files')),
|
feat: [equipment] 설비관리 API 백엔드 구현 (Phase 1)
- 모델 6개: Equipment, EquipmentInspection, EquipmentInspectionDetail, EquipmentInspectionTemplate, EquipmentRepair, EquipmentProcess
- InspectionCycle Enum: 6주기(일/주/월/격월/분기/반기) 날짜 해석
- 서비스 4개: EquipmentService, EquipmentInspectionService, EquipmentRepairService, EquipmentPhotoService
- 컨트롤러 4개: CRUD + 점검 토글/결과 설정/메모/초기화 + 템플릿 관리 + 수리이력 + 사진
- FormRequest 6개: 설비등록/수정, 수리이력, 점검템플릿, 토글, 메모
- 라우트 26개: equipment prefix 하위 RESTful 엔드포인트
- i18n 메시지: message.equipment.*, error.equipment.*
- 마이그레이션: equipments/equipment_repairs options JSON 컬럼 추가
2026-03-12 10:52:30 +09:00
|
|
|
__('message.equipment.photo_uploaded')
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function destroy(int $id, int $fileId): JsonResponse
|
|
|
|
|
{
|
|
|
|
|
return ApiResponse::handle(
|
|
|
|
|
fn () => $this->service->destroy($id, $fileId),
|
|
|
|
|
__('message.deleted')
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|