feat: 매출/매입 관리 API 구현
- 매출(Sale) 및 매입(Purchase) CRUD API 구현
- 문서번호 자동 생성 (SL/PU + YYYYMMDD + 시퀀스)
- 상태 관리 (draft → confirmed → invoiced)
- 확정(confirm) 및 요약(summary) 기능 추가
- BelongsToTenant, SoftDeletes 적용
- Swagger API 문서 작성 완료
추가된 파일:
- 마이그레이션: sales, purchases 테이블
- 모델: Sale, Purchase
- 서비스: SaleService, PurchaseService
- 컨트롤러: SaleController, PurchaseController
- FormRequest: Store/Update 4개
- Swagger: SaleApi.php, PurchaseApi.php
API 엔드포인트 (14개):
- GET/POST /v1/sales, /v1/purchases
- GET/PUT/DELETE /v1/{sales,purchases}/{id}
- POST /v1/{sales,purchases}/{id}/confirm
- GET /v1/{sales,purchases}/summary
This commit is contained in:
35
app/Http/Requests/V1/Purchase/UpdatePurchaseRequest.php
Normal file
35
app/Http/Requests/V1/Purchase/UpdatePurchaseRequest.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V1\Purchase;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdatePurchaseRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'purchase_date' => ['sometimes', 'date'],
|
||||
'client_id' => ['sometimes', 'integer', 'exists:clients,id'],
|
||||
'supply_amount' => ['sometimes', 'numeric', 'min:0'],
|
||||
'tax_amount' => ['sometimes', 'numeric', 'min:0'],
|
||||
'total_amount' => ['sometimes', 'numeric', 'min:0'],
|
||||
'description' => ['nullable', 'string', 'max:1000'],
|
||||
'withdrawal_id' => ['nullable', 'integer', 'exists:withdrawals,id'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'client_id.exists' => __('validation.exists', ['attribute' => '거래처']),
|
||||
'supply_amount.numeric' => __('validation.numeric', ['attribute' => '공급가액']),
|
||||
'withdrawal_id.exists' => __('validation.exists', ['attribute' => '출금']),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user