Files
sam-api/lang/en/error.php
kent 65c5de2db1 feat(api): Items API 멀티 item_type 지원 및 파라미터 일관성 개선
- ItemService: 콤마 구분 멀티 item_type 지원 (예: type=FG,PT)
  - parseItemTypes(): 콤마 구분 문자열을 배열로 파싱
  - validateItemTypesInSameGroup(): 같은 group_id 검증
  - index(), search() 메서드에 멀티 타입 로직 적용

- ItemsController: type/item_type 파라미터 일관성
  - show(), showByCode(), destroy() 메서드에서 type 파라미터 지원
  - 모든 엔드포인트에서 type 또는 item_type 둘 다 허용

- ItemBatchDeleteRequest: prepareForValidation()으로 type→item_type 매핑

- i18n: item_types_must_be_same_group 에러 메시지 추가 (ko/en)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 01:10:38 +09:00

99 lines
4.0 KiB
PHP

<?php
declare(strict_types=1);
/**
* System/Domain error messages (client-facing, fixed strings)
* - Not DB-driven
* - Used in global handler/service exceptions
* - Example: throw new NotFoundHttpException(__('error.not_found'));
*/
return [
// 4xx Common
'not_found' => 'The requested URI or data was not found.', // 404
'tenant_id' => 'No active tenant is set.', // 400 (Service::tenantId() missing)
'unauthenticated' => 'Authentication failed.', // 401
'forbidden' => 'You do not have permission for this request.', // 403
'bad_request' => 'Invalid request.', // 400
// Validation / Parameters
'validation_failed' => 'Request data validation failed.', // 422
'missing_parameter' => 'A required parameter is missing.', // 400
// Resource-specific (optional, with :resource placeholder)
'not_found_resource' => ':resource could not be found.', // 404
// Business rules
'duplicate' => 'Duplicate data exists.',
'conflict' => 'The request conflicts with the current state.', // 409
'state_invalid' => 'The current state does not allow this operation.', // 400/409
// Server errors
'server_error' => 'An internal server error occurred.', // 5xx
// Estimate related errors
'estimate' => [
'cannot_delete_sent_or_approved' => 'Cannot delete estimates that have been sent or approved.',
'invalid_status_transition' => 'Cannot change status from the current state.',
],
// BOM template related
'bom_template' => [
'not_found' => 'No applicable BOM template found.',
],
// Model set related
'modelset' => [
'has_dependencies' => 'Cannot delete due to associated products or subcategories.',
],
// Settings management related
'settings' => [
'field_not_found' => 'Field setting not found.',
'option_group_not_found' => 'Option group not found.',
'common_code_duplicate' => 'Duplicate common code exists.',
'invalid_field_type' => 'Invalid field type.',
],
// Materials management related
'materials' => [
'not_found' => 'Material information not found.',
'duplicate_code' => 'Duplicate material code.',
'in_use_cannot_delete' => 'Cannot delete material that is currently in use.',
],
// File management related
'file' => [
'not_found' => 'File not found.',
'upload_failed' => 'File upload failed.',
'invalid_file_type' => 'Invalid file type.',
'file_too_large' => 'File size is too large.',
],
// Client group related
'duplicate_code' => 'Duplicate group code.',
'has_clients' => 'Cannot delete the client group because it has associated clients.',
'code_exists_in_deleted' => 'The same code exists in deleted data. Please permanently delete that code first or use a different code.',
// Item type validation
'item_type_required' => 'Item type (item_type) is required.',
'item_type_or_group_required' => 'Item type (item_type) or group ID (group_id) is required.',
'invalid_item_type' => 'Invalid item type.',
'invalid_group_id' => 'Invalid group ID or no item types exist in the specified group.',
'item_types_must_be_same_group' => 'When selecting multiple item types, all types must belong to the same group.',
'invalid_source_table' => 'Source table is not configured for this item type.',
// Item management related
'item' => [
'not_found' => 'Item not found.',
'already_deleted' => 'Item has already been deleted.',
'in_use_as_bom_component' => 'Cannot delete item as it is used as a BOM component. (Usage: :count items)',
'in_use' => 'Cannot delete item that is currently in use. (Usage: :usage)',
'batch_in_use' => 'Cannot delete items because some are in use. (Items: :codes, :count items)',
'invalid_item_type' => 'Invalid item type.',
'duplicate_code' => 'Duplicate item code.',
],
];