Files
sam-api/app/Http/Requests/Quote/QuoteCalculateRequest.php
hskwon 40ca8b8697 feat: [quote] 견적 API Phase 2-3 완료 (Service + Controller Layer)
Phase 2 - Service Layer:
- QuoteService: 견적 CRUD + 상태관리 (확정/전환)
- QuoteNumberService: 견적번호 채번 (KD-{PREFIX}-YYMMDD-SEQ)
- FormulaEvaluatorService: 수식 평가 엔진 (SUM, IF, ROUND 등)
- QuoteCalculationService: 자동산출 (스크린/철재 제품)
- QuoteDocumentService: PDF 생성 및 이메일/카카오 발송

Phase 3 - Controller Layer:
- QuoteController: 16개 엔드포인트
- FormRequest 7개: Index, Store, Update, BulkDelete, Calculate, SendEmail, SendKakao
- QuoteApi.php: Swagger 문서 (12개 스키마, 16개 엔드포인트)
- routes/api.php: 16개 라우트 등록

i18n 키 추가:
- error.php: quote_not_found, formula_* 등
- message.php: quote.* 성공 메시지
2025-12-04 22:03:40 +09:00

53 lines
1.9 KiB
PHP

<?php
namespace App\Http\Requests\Quote;
use App\Models\Quote\Quote;
use Illuminate\Foundation\Http\FormRequest;
class QuoteCalculateRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'product_category' => 'nullable|in:'.Quote::CATEGORY_SCREEN.','.Quote::CATEGORY_STEEL,
// 입력값 (직접 또는 inputs 객체로)
'inputs' => 'nullable|array',
// 공통 입력
'W0' => 'nullable|numeric|min:0',
'H0' => 'nullable|numeric|min:0',
'QTY' => 'nullable|integer|min:1',
'inputs.W0' => 'nullable|numeric|min:0',
'inputs.H0' => 'nullable|numeric|min:0',
'inputs.QTY' => 'nullable|integer|min:1',
// 스크린 제품 입력
'INSTALL_TYPE' => 'nullable|in:wall,ceiling,floor',
'MOTOR_TYPE' => 'nullable|in:standard,heavy',
'CONTROL_TYPE' => 'nullable|in:switch,remote,smart',
'CHAIN_SIDE' => 'nullable|in:left,right',
'inputs.INSTALL_TYPE' => 'nullable|in:wall,ceiling,floor',
'inputs.MOTOR_TYPE' => 'nullable|in:standard,heavy',
'inputs.CONTROL_TYPE' => 'nullable|in:switch,remote,smart',
'inputs.CHAIN_SIDE' => 'nullable|in:left,right',
// 철재 제품 입력
'MATERIAL' => 'nullable|in:ss304,ss316,galvanized',
'THICKNESS' => 'nullable|numeric|min:0.1|max:50',
'FINISH' => 'nullable|in:hairline,mirror,matte',
'WELDING' => 'nullable|in:tig,mig,spot',
'inputs.MATERIAL' => 'nullable|in:ss304,ss316,galvanized',
'inputs.THICKNESS' => 'nullable|numeric|min:0.1|max:50',
'inputs.FINISH' => 'nullable|in:hairline,mirror,matte',
'inputs.WELDING' => 'nullable|in:tig,mig,spot',
];
}
}