style: Laravel Pint 코드 포맷팅 적용
- PSR-12 스타일 가이드 준수 - 302개 파일 스타일 이슈 자동 수정 - 코드 로직 변경 없음 (포맷팅만)
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
class GenerateSimpleRelationships extends Command
|
class GenerateSimpleRelationships extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'db:generate-simple-relationships';
|
protected $signature = 'db:generate-simple-relationships';
|
||||||
|
|
||||||
protected $description = '기본 논리적 관계 문서 생성';
|
protected $description = '기본 논리적 관계 문서 생성';
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
@@ -29,7 +30,7 @@ private function getKnownRelationships(): array
|
|||||||
'user_tenants (hasMany)' => 'user_tenants.user_id → users.id',
|
'user_tenants (hasMany)' => 'user_tenants.user_id → users.id',
|
||||||
'user_roles (hasMany)' => 'user_roles.user_id → users.id',
|
'user_roles (hasMany)' => 'user_roles.user_id → users.id',
|
||||||
'audit_logs (hasMany)' => 'audit_logs.actor_id → users.id (생성자)',
|
'audit_logs (hasMany)' => 'audit_logs.actor_id → users.id (생성자)',
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
'tenants' => [
|
'tenants' => [
|
||||||
'description' => '테넌트 (회사/조직)',
|
'description' => '테넌트 (회사/조직)',
|
||||||
@@ -39,7 +40,7 @@ private function getKnownRelationships(): array
|
|||||||
'departments (hasMany)' => 'departments.tenant_id → tenants.id',
|
'departments (hasMany)' => 'departments.tenant_id → tenants.id',
|
||||||
'products (hasMany)' => 'products.tenant_id → tenants.id',
|
'products (hasMany)' => 'products.tenant_id → tenants.id',
|
||||||
'orders (hasMany)' => 'orders.tenant_id → tenants.id',
|
'orders (hasMany)' => 'orders.tenant_id → tenants.id',
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
'categories' => [
|
'categories' => [
|
||||||
'description' => '제품 카테고리 (계층구조)',
|
'description' => '제품 카테고리 (계층구조)',
|
||||||
@@ -48,7 +49,7 @@ private function getKnownRelationships(): array
|
|||||||
'children (hasMany)' => 'categories.parent_id → categories.id',
|
'children (hasMany)' => 'categories.parent_id → categories.id',
|
||||||
'products (hasMany)' => 'products.category_id → categories.id',
|
'products (hasMany)' => 'products.category_id → categories.id',
|
||||||
'estimates (hasMany)' => 'estimates.model_set_id → categories.id (논리적)',
|
'estimates (hasMany)' => 'estimates.model_set_id → categories.id (논리적)',
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
'products' => [
|
'products' => [
|
||||||
'description' => '제품 마스터',
|
'description' => '제품 마스터',
|
||||||
@@ -57,7 +58,7 @@ private function getKnownRelationships(): array
|
|||||||
'tenant (belongsTo)' => 'products.tenant_id → tenants.id',
|
'tenant (belongsTo)' => 'products.tenant_id → tenants.id',
|
||||||
'product_components (hasMany)' => 'product_components.parent_product_id → products.id (논리적)',
|
'product_components (hasMany)' => 'product_components.parent_product_id → products.id (논리적)',
|
||||||
'order_items (hasMany)' => 'order_items.product_id → products.id',
|
'order_items (hasMany)' => 'order_items.product_id → products.id',
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
'departments' => [
|
'departments' => [
|
||||||
'description' => '부서 관리 (계층구조)',
|
'description' => '부서 관리 (계층구조)',
|
||||||
@@ -65,7 +66,7 @@ private function getKnownRelationships(): array
|
|||||||
'parent (belongsTo)' => 'departments.parent_id → departments.id (논리적)',
|
'parent (belongsTo)' => 'departments.parent_id → departments.id (논리적)',
|
||||||
'children (hasMany)' => 'departments.parent_id → departments.id (논리적)',
|
'children (hasMany)' => 'departments.parent_id → departments.id (논리적)',
|
||||||
'tenant (belongsTo)' => 'departments.tenant_id → tenants.id',
|
'tenant (belongsTo)' => 'departments.tenant_id → tenants.id',
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
'estimates' => [
|
'estimates' => [
|
||||||
'description' => '견적서 (스냅샷 데이터)',
|
'description' => '견적서 (스냅샷 데이터)',
|
||||||
@@ -73,14 +74,14 @@ private function getKnownRelationships(): array
|
|||||||
'category (belongsTo)' => 'estimates.model_set_id → categories.id (논리적)',
|
'category (belongsTo)' => 'estimates.model_set_id → categories.id (논리적)',
|
||||||
'tenant (belongsTo)' => 'estimates.tenant_id → tenants.id',
|
'tenant (belongsTo)' => 'estimates.tenant_id → tenants.id',
|
||||||
'estimate_items (hasMany)' => 'estimate_items.estimate_id → estimates.id (논리적)',
|
'estimate_items (hasMany)' => 'estimate_items.estimate_id → estimates.id (논리적)',
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
'estimate_items' => [
|
'estimate_items' => [
|
||||||
'description' => '견적 아이템',
|
'description' => '견적 아이템',
|
||||||
'relationships' => [
|
'relationships' => [
|
||||||
'estimate (belongsTo)' => 'estimate_items.estimate_id → estimates.id (논리적)',
|
'estimate (belongsTo)' => 'estimate_items.estimate_id → estimates.id (논리적)',
|
||||||
'tenant (belongsTo)' => 'estimate_items.tenant_id → tenants.id',
|
'tenant (belongsTo)' => 'estimate_items.tenant_id → tenants.id',
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
'product_components' => [
|
'product_components' => [
|
||||||
'description' => 'BOM 구성요소 (통합 참조구조)',
|
'description' => 'BOM 구성요소 (통합 참조구조)',
|
||||||
@@ -88,13 +89,13 @@ private function getKnownRelationships(): array
|
|||||||
'parent_product (belongsTo)' => 'product_components.parent_product_id → products.id (논리적)',
|
'parent_product (belongsTo)' => 'product_components.parent_product_id → products.id (논리적)',
|
||||||
'material_or_product (polymorphic)' => 'product_components.ref_id → materials.id OR products.id (ref_type 기반)',
|
'material_or_product (polymorphic)' => 'product_components.ref_id → materials.id OR products.id (ref_type 기반)',
|
||||||
'tenant (belongsTo)' => 'product_components.tenant_id → tenants.id',
|
'tenant (belongsTo)' => 'product_components.tenant_id → tenants.id',
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
'classifications' => [
|
'classifications' => [
|
||||||
'description' => '분류 코드',
|
'description' => '분류 코드',
|
||||||
'relationships' => [
|
'relationships' => [
|
||||||
'tenant (belongsTo)' => 'classifications.tenant_id → tenants.id (논리적)',
|
'tenant (belongsTo)' => 'classifications.tenant_id → tenants.id (논리적)',
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -145,4 +146,4 @@ private function generateDocument(array $relationships): void
|
|||||||
File::put(base_path('LOGICAL_RELATIONSHIPS_SIMPLE.md'), $content);
|
File::put(base_path('LOGICAL_RELATIONSHIPS_SIMPLE.md'), $content);
|
||||||
$this->info('📄 문서 생성: LOGICAL_RELATIONSHIPS_SIMPLE.md');
|
$this->info('📄 문서 생성: LOGICAL_RELATIONSHIPS_SIMPLE.md');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
class MakeModelWithRelationships extends Command
|
class MakeModelWithRelationships extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'make:model-with-docs {name} {--migration} {--controller} {--resource}';
|
protected $signature = 'make:model-with-docs {name} {--migration} {--controller} {--resource}';
|
||||||
|
|
||||||
protected $description = '모델 생성 후 자동으로 관계 문서 업데이트';
|
protected $description = '모델 생성 후 자동으로 관계 문서 업데이트';
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
@@ -17,9 +18,15 @@ public function handle()
|
|||||||
|
|
||||||
// 기본 모델 생성
|
// 기본 모델 생성
|
||||||
$options = [];
|
$options = [];
|
||||||
if ($this->option('migration')) $options['--migration'] = true;
|
if ($this->option('migration')) {
|
||||||
if ($this->option('controller')) $options['--controller'] = true;
|
$options['--migration'] = true;
|
||||||
if ($this->option('resource')) $options['--resource'] = true;
|
}
|
||||||
|
if ($this->option('controller')) {
|
||||||
|
$options['--controller'] = true;
|
||||||
|
}
|
||||||
|
if ($this->option('resource')) {
|
||||||
|
$options['--resource'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
Artisan::call('make:model', array_merge(['name' => $modelName], $options));
|
Artisan::call('make:model', array_merge(['name' => $modelName], $options));
|
||||||
$this->info("✅ 모델 생성 완료: {$modelName}");
|
$this->info("✅ 모델 생성 완료: {$modelName}");
|
||||||
@@ -36,8 +43,9 @@ private function addRelationshipTemplate(string $modelName): void
|
|||||||
{
|
{
|
||||||
$modelPath = app_path("Models/{$modelName}.php");
|
$modelPath = app_path("Models/{$modelName}.php");
|
||||||
|
|
||||||
if (!File::exists($modelPath)) {
|
if (! File::exists($modelPath)) {
|
||||||
$this->error("모델 파일을 찾을 수 없습니다: {$modelPath}");
|
$this->error("모델 파일을 찾을 수 없습니다: {$modelPath}");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,12 +73,12 @@ private function addRelationshipTemplate(string $modelName): void
|
|||||||
|
|
||||||
// 클래스 끝 부분에 템플릿 삽입
|
// 클래스 끝 부분에 템플릿 삽입
|
||||||
$content = str_replace(
|
$content = str_replace(
|
||||||
'}' . PHP_EOL,
|
'}'.PHP_EOL,
|
||||||
$template . PHP_EOL . '}' . PHP_EOL,
|
$template.PHP_EOL.'}'.PHP_EOL,
|
||||||
$content
|
$content
|
||||||
);
|
);
|
||||||
|
|
||||||
File::put($modelPath, $content);
|
File::put($modelPath, $content);
|
||||||
$this->info("📝 관계 템플릿 추가: {$modelName}");
|
$this->info("📝 관계 템플릿 추가: {$modelName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
class PruneAuditLogs extends Command
|
class PruneAuditLogs extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'audit:prune {--days=}';
|
protected $signature = 'audit:prune {--days=}';
|
||||||
|
|
||||||
protected $description = 'Delete audit logs older than given days (default: config(audit.retention_days)).';
|
protected $description = 'Delete audit logs older than given days (default: config(audit.retention_days)).';
|
||||||
|
|
||||||
public function handle(): int
|
public function handle(): int
|
||||||
|
|||||||
@@ -2,21 +2,22 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use App\Models\Commons\Menu;
|
use App\Models\Commons\Menu;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
use Spatie\Permission\Models\Permission;
|
use Spatie\Permission\Models\Permission;
|
||||||
use Spatie\Permission\PermissionRegistrar;
|
use Spatie\Permission\PermissionRegistrar;
|
||||||
|
|
||||||
class SeedMenuPermissions extends Command
|
class SeedMenuPermissions extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'sam:seed-menu-perms {--tenant=} {--guard=api}';
|
protected $signature = 'sam:seed-menu-perms {--tenant=} {--guard=api}';
|
||||||
|
|
||||||
protected $description = 'Create missing permissions menu:{id}.{action} for all menus';
|
protected $description = 'Create missing permissions menu:{id}.{action} for all menus';
|
||||||
|
|
||||||
public function handle(): int
|
public function handle(): int
|
||||||
{
|
{
|
||||||
$tenant = $this->option('tenant') ? (int)$this->option('tenant') : null;
|
$tenant = $this->option('tenant') ? (int) $this->option('tenant') : null;
|
||||||
$guard = $this->option('guard') ?: 'api';
|
$guard = $this->option('guard') ?: 'api';
|
||||||
$actions = config('authz.menu_actions', ['view','create','update','delete','approve']);
|
$actions = config('authz.menu_actions', ['view', 'create', 'update', 'delete', 'approve']);
|
||||||
|
|
||||||
$menus = Menu::query()
|
$menus = Menu::query()
|
||||||
->when($tenant !== null, fn ($q) => $q->where('tenant_id', $tenant))
|
->when($tenant !== null, fn ($q) => $q->where('tenant_id', $tenant))
|
||||||
@@ -25,13 +26,13 @@ public function handle(): int
|
|||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
foreach ($menus as $m) {
|
foreach ($menus as $m) {
|
||||||
app(PermissionRegistrar::class)->setPermissionsTeamId((int)$m->tenant_id);
|
app(PermissionRegistrar::class)->setPermissionsTeamId((int) $m->tenant_id);
|
||||||
|
|
||||||
foreach ($actions as $act) {
|
foreach ($actions as $act) {
|
||||||
Permission::firstOrCreate([
|
Permission::firstOrCreate([
|
||||||
'tenant_id' => (int)$m->tenant_id,
|
'tenant_id' => (int) $m->tenant_id,
|
||||||
'guard_name' => $guard,
|
'guard_name' => $guard,
|
||||||
'name' => "menu:{$m->id}.{$act}",
|
'name' => "menu:{$m->id}.{$act}",
|
||||||
]);
|
]);
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
@@ -39,6 +40,7 @@ public function handle(): int
|
|||||||
|
|
||||||
app(PermissionRegistrar::class)->forgetCachedPermissions();
|
app(PermissionRegistrar::class)->forgetCachedPermissions();
|
||||||
$this->info("Ensured {$count} permissions.");
|
$this->info("Ensured {$count} permissions.");
|
||||||
|
|
||||||
return self::SUCCESS;
|
return self::SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Services\TenantBootstrapper;
|
use App\Services\TenantBootstrapper;
|
||||||
|
use Illuminate\Console\Attributes\AsCommand;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Console\Attributes\AsCommand;
|
|
||||||
|
|
||||||
#[AsCommand(name: 'tenants:bootstrap', description: 'Bootstrap menus/capability/categories/settings for tenant(s)')]
|
#[AsCommand(name: 'tenants:bootstrap', description: 'Bootstrap menus/capability/categories/settings for tenant(s)')]
|
||||||
class TenantsBootstrap extends Command
|
class TenantsBootstrap extends Command
|
||||||
@@ -18,7 +18,7 @@ class TenantsBootstrap extends Command
|
|||||||
|
|
||||||
public function handle(TenantBootstrapper $svc): int
|
public function handle(TenantBootstrapper $svc): int
|
||||||
{
|
{
|
||||||
$recipe = (string) $this->option('recipe');
|
$recipe = (string) $this->option('recipe');
|
||||||
$tenantId = $this->option('tenant_id');
|
$tenantId = $this->option('tenant_id');
|
||||||
|
|
||||||
if ($this->option('all')) {
|
if ($this->option('all')) {
|
||||||
@@ -27,11 +27,13 @@ public function handle(TenantBootstrapper $svc): int
|
|||||||
$ids = [(int) $tenantId];
|
$ids = [(int) $tenantId];
|
||||||
} else {
|
} else {
|
||||||
$this->error('Provide --tenant_id=ID or --all');
|
$this->error('Provide --tenant_id=ID or --all');
|
||||||
|
|
||||||
return self::FAILURE;
|
return self::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($ids)) {
|
if (empty($ids)) {
|
||||||
$this->warn('No tenant to bootstrap.');
|
$this->warn('No tenant to bootstrap.');
|
||||||
|
|
||||||
return self::SUCCESS;
|
return self::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
class UpdateLogicalRelationships extends Command
|
class UpdateLogicalRelationships extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'db:update-relationships';
|
protected $signature = 'db:update-relationships';
|
||||||
|
|
||||||
protected $description = '모델에서 논리적 관계를 추출하여 문서 업데이트';
|
protected $description = '모델에서 논리적 관계를 추출하여 문서 업데이트';
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
@@ -30,16 +31,20 @@ private function extractModelRelationships(): array
|
|||||||
$modelFiles = File::allFiles($modelPath);
|
$modelFiles = File::allFiles($modelPath);
|
||||||
|
|
||||||
foreach ($modelFiles as $file) {
|
foreach ($modelFiles as $file) {
|
||||||
if ($file->getExtension() !== 'php') continue;
|
if ($file->getExtension() !== 'php') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$className = $this->getClassNameFromFile($file);
|
$className = $this->getClassNameFromFile($file);
|
||||||
if (!$className || !class_exists($className)) continue;
|
if (! $className || ! class_exists($className)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$reflection = new ReflectionClass($className);
|
$reflection = new ReflectionClass($className);
|
||||||
|
|
||||||
// 모델이 Eloquent Model인지 확인
|
// 모델이 Eloquent Model인지 확인
|
||||||
if (!$reflection->isSubclassOf(\Illuminate\Database\Eloquent\Model::class)) {
|
if (! $reflection->isSubclassOf(\Illuminate\Database\Eloquent\Model::class)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,15 +55,18 @@ private function extractModelRelationships(): array
|
|||||||
|
|
||||||
// 테이블 이름 직접 추출
|
// 테이블 이름 직접 추출
|
||||||
$tableName = $this->getTableNameFromModel($className, $reflection);
|
$tableName = $this->getTableNameFromModel($className, $reflection);
|
||||||
if (!$tableName) continue;
|
if (! $tableName) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$relationships[$tableName] = [
|
$relationships[$tableName] = [
|
||||||
'model' => $className,
|
'model' => $className,
|
||||||
'relationships' => $this->getModelRelationshipsFromFile($file, $className)
|
'relationships' => $this->getModelRelationshipsFromFile($file, $className),
|
||||||
];
|
];
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->warn("모델 분석 실패: {$className} - " . $e->getMessage());
|
$this->warn("모델 분석 실패: {$className} - ".$e->getMessage());
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,7 +81,7 @@ private function getTableNameFromModel(string $className, ReflectionClass $refle
|
|||||||
$tableName = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $modelName));
|
$tableName = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $modelName));
|
||||||
|
|
||||||
// 복수형으로 변환 (간단한 규칙)
|
// 복수형으로 변환 (간단한 규칙)
|
||||||
if (!str_ends_with($tableName, 's')) {
|
if (! str_ends_with($tableName, 's')) {
|
||||||
$tableName .= 's';
|
$tableName .= 's';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,8 +120,9 @@ private function getModelRelationshipsFromFile($file, string $className): array
|
|||||||
'type' => $type,
|
'type' => $type,
|
||||||
'related_model' => '(Polymorphic)',
|
'related_model' => '(Polymorphic)',
|
||||||
'foreign_key' => null,
|
'foreign_key' => null,
|
||||||
'local_key' => null
|
'local_key' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +137,7 @@ private function getModelRelationshipsFromFile($file, string $className): array
|
|||||||
'type' => $type,
|
'type' => $type,
|
||||||
'related_model' => $fullyQualifiedClass,
|
'related_model' => $fullyQualifiedClass,
|
||||||
'foreign_key' => null,
|
'foreign_key' => null,
|
||||||
'local_key' => null
|
'local_key' => null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +205,7 @@ private function resolveClassName(string $className, array $useStatements, ?stri
|
|||||||
|
|
||||||
// 같은 namespace에 있다고 가정
|
// 같은 namespace에 있다고 가정
|
||||||
if ($currentNamespace) {
|
if ($currentNamespace) {
|
||||||
return $currentNamespace . '\\' . $className;
|
return $currentNamespace.'\\'.$className;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 그 외의 경우 그대로 반환
|
// 그 외의 경우 그대로 반환
|
||||||
@@ -223,7 +232,7 @@ private function getModelRelationships(ReflectionClass $reflection, $model): arr
|
|||||||
'type' => $this->getRelationshipType($result),
|
'type' => $this->getRelationshipType($result),
|
||||||
'related_model' => get_class($result->getRelated()),
|
'related_model' => get_class($result->getRelated()),
|
||||||
'foreign_key' => $this->getForeignKey($result),
|
'foreign_key' => $this->getForeignKey($result),
|
||||||
'local_key' => $this->getLocalKey($result)
|
'local_key' => $this->getLocalKey($result),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -243,6 +252,7 @@ private function isRelationshipMethod($result): bool
|
|||||||
private function getRelationshipType($relation): string
|
private function getRelationshipType($relation): string
|
||||||
{
|
{
|
||||||
$className = get_class($relation);
|
$className = get_class($relation);
|
||||||
|
|
||||||
return class_basename($className);
|
return class_basename($className);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,15 +274,15 @@ private function getClassNameFromFile($file): ?string
|
|||||||
{
|
{
|
||||||
$content = File::get($file->getRealPath());
|
$content = File::get($file->getRealPath());
|
||||||
|
|
||||||
if (!preg_match('/namespace\s+([^;]+);/', $content, $namespaceMatches)) {
|
if (! preg_match('/namespace\s+([^;]+);/', $content, $namespaceMatches)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/class\s+(\w+)/', $content, $classMatches)) {
|
if (! preg_match('/class\s+(\w+)/', $content, $classMatches)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $namespaceMatches[1] . '\\' . $classMatches[1];
|
return $namespaceMatches[1].'\\'.$classMatches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateLogicalDocument(array $relationships): void
|
private function updateLogicalDocument(array $relationships): void
|
||||||
@@ -287,7 +297,9 @@ private function updateLogicalDocument(array $relationships): void
|
|||||||
$content .= "## 📊 모델별 관계 현황\n\n";
|
$content .= "## 📊 모델별 관계 현황\n\n";
|
||||||
|
|
||||||
foreach ($relationships as $tableName => $info) {
|
foreach ($relationships as $tableName => $info) {
|
||||||
if (empty($info['relationships'])) continue;
|
if (empty($info['relationships'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$content .= "### {$tableName}\n";
|
$content .= "### {$tableName}\n";
|
||||||
$content .= "**모델**: `{$info['model']}`\n\n";
|
$content .= "**모델**: `{$info['model']}`\n\n";
|
||||||
@@ -297,12 +309,14 @@ private function updateLogicalDocument(array $relationships): void
|
|||||||
// Polymorphic 관계는 특별 표시
|
// Polymorphic 관계는 특별 표시
|
||||||
if ($rel['related_model'] === '(Polymorphic)') {
|
if ($rel['related_model'] === '(Polymorphic)') {
|
||||||
$content .= "- **{$rel['method']}()**: {$rel['type']} → `(Polymorphic)`\n";
|
$content .= "- **{$rel['method']}()**: {$rel['type']} → `(Polymorphic)`\n";
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 관련 모델 클래스가 존재하는지 확인
|
// 관련 모델 클래스가 존재하는지 확인
|
||||||
if (!class_exists($rel['related_model'])) {
|
if (! class_exists($rel['related_model'])) {
|
||||||
$this->warn("모델 클래스가 존재하지 않음: {$rel['related_model']}");
|
$this->warn("모델 클래스가 존재하지 않음: {$rel['related_model']}");
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +329,8 @@ private function updateLogicalDocument(array $relationships): void
|
|||||||
|
|
||||||
$content .= "\n";
|
$content .= "\n";
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->warn("관계 처리 실패: {$rel['method']} - " . $e->getMessage());
|
$this->warn("관계 처리 실패: {$rel['method']} - ".$e->getMessage());
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -326,4 +341,4 @@ private function updateLogicalDocument(array $relationships): void
|
|||||||
File::put($documentPath, $content);
|
File::put($documentPath, $content);
|
||||||
$this->info("📄 문서 업데이트: {$documentPath}");
|
$this->info("📄 문서 업데이트: {$documentPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Console;
|
namespace App\Console;
|
||||||
|
|
||||||
|
use App\Console\Commands\GenerateSimpleRelationships;
|
||||||
|
use App\Console\Commands\MakeModelWithRelationships;
|
||||||
use App\Console\Commands\PruneAuditLogs;
|
use App\Console\Commands\PruneAuditLogs;
|
||||||
use App\Console\Commands\UpdateLogicalRelationships;
|
use App\Console\Commands\UpdateLogicalRelationships;
|
||||||
use App\Console\Commands\MakeModelWithRelationships;
|
|
||||||
use App\Console\Commands\GenerateSimpleRelationships;
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Enums;
|
namespace App\Enums;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6,17 +7,17 @@
|
|||||||
*/
|
*/
|
||||||
enum EstimateStatus: string
|
enum EstimateStatus: string
|
||||||
{
|
{
|
||||||
case Draft = 'draft'; // 임시저장
|
case Draft = 'draft'; // 임시저장
|
||||||
case Submitted = 'submitted'; // 제출/확정
|
case Submitted = 'submitted'; // 제출/확정
|
||||||
case Approved = 'approved'; // 승인
|
case Approved = 'approved'; // 승인
|
||||||
case Rejected = 'rejected'; // 반려
|
case Rejected = 'rejected'; // 반려
|
||||||
case Cancelled = 'cancelled'; // 취소
|
case Cancelled = 'cancelled'; // 취소
|
||||||
|
|
||||||
// 한글라벨 등 커스텀 메서드
|
// 한글라벨 등 커스텀 메서드
|
||||||
public function label(): string
|
public function label(): string
|
||||||
{
|
{
|
||||||
return match($this) {
|
return match ($this) {
|
||||||
self::Draft => '임시저장',
|
self::Draft => '임시저장',
|
||||||
self::Submitted => '제출/확정',
|
self::Submitted => '제출/확정',
|
||||||
self::Approved => '승인',
|
self::Approved => '승인',
|
||||||
self::Rejected => '반려',
|
self::Rejected => '반려',
|
||||||
@@ -30,17 +31,17 @@ public function label(): string
|
|||||||
*/
|
*/
|
||||||
enum OrderStatus: string
|
enum OrderStatus: string
|
||||||
{
|
{
|
||||||
case Created = 'created';
|
case Created = 'created';
|
||||||
case Confirmed = 'confirmed';
|
case Confirmed = 'confirmed';
|
||||||
case InProgress = 'in_progress';
|
case InProgress = 'in_progress';
|
||||||
case Completed = 'completed';
|
case Completed = 'completed';
|
||||||
case Cancelled = 'cancelled';
|
case Cancelled = 'cancelled';
|
||||||
|
|
||||||
// 한글라벨 등 커스텀 메서드
|
// 한글라벨 등 커스텀 메서드
|
||||||
public function label(): string
|
public function label(): string
|
||||||
{
|
{
|
||||||
return match($this) {
|
return match ($this) {
|
||||||
self::Created => '등록',
|
self::Created => '등록',
|
||||||
self::Confirmed => '승인',
|
self::Confirmed => '승인',
|
||||||
self::InProgress => '진행중',
|
self::InProgress => '진행중',
|
||||||
self::Completed => '완료',
|
self::Completed => '완료',
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Enums;
|
namespace App\Enums;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6,17 +7,17 @@
|
|||||||
*/
|
*/
|
||||||
enum EstimateStatus: string
|
enum EstimateStatus: string
|
||||||
{
|
{
|
||||||
case Draft = 'draft'; // 임시저장
|
case Draft = 'draft'; // 임시저장
|
||||||
case Submitted = 'submitted'; // 제출/확정
|
case Submitted = 'submitted'; // 제출/확정
|
||||||
case Approved = 'approved'; // 승인
|
case Approved = 'approved'; // 승인
|
||||||
case Rejected = 'rejected'; // 반려
|
case Rejected = 'rejected'; // 반려
|
||||||
case Cancelled = 'cancelled'; // 취소
|
case Cancelled = 'cancelled'; // 취소
|
||||||
|
|
||||||
// 한글라벨 등 커스텀 메서드
|
// 한글라벨 등 커스텀 메서드
|
||||||
public function label(): string
|
public function label(): string
|
||||||
{
|
{
|
||||||
return match($this) {
|
return match ($this) {
|
||||||
self::Draft => '임시저장',
|
self::Draft => '임시저장',
|
||||||
self::Submitted => '제출/확정',
|
self::Submitted => '제출/확정',
|
||||||
self::Approved => '승인',
|
self::Approved => '승인',
|
||||||
self::Rejected => '반려',
|
self::Rejected => '반려',
|
||||||
@@ -30,17 +31,17 @@ public function label(): string
|
|||||||
*/
|
*/
|
||||||
enum OrderStatus: string
|
enum OrderStatus: string
|
||||||
{
|
{
|
||||||
case Created = 'created';
|
case Created = 'created';
|
||||||
case Confirmed = 'confirmed';
|
case Confirmed = 'confirmed';
|
||||||
case InProgress = 'in_progress';
|
case InProgress = 'in_progress';
|
||||||
case Completed = 'completed';
|
case Completed = 'completed';
|
||||||
case Cancelled = 'cancelled';
|
case Cancelled = 'cancelled';
|
||||||
|
|
||||||
// 한글라벨 등 커스텀 메서드
|
// 한글라벨 등 커스텀 메서드
|
||||||
public function label(): string
|
public function label(): string
|
||||||
{
|
{
|
||||||
return match($this) {
|
return match ($this) {
|
||||||
self::Created => '등록',
|
self::Created => '등록',
|
||||||
self::Confirmed => '승인',
|
self::Confirmed => '승인',
|
||||||
self::InProgress => '진행중',
|
self::InProgress => '진행중',
|
||||||
self::Completed => '완료',
|
self::Completed => '완료',
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use Illuminate\Auth\AuthenticationException;
|
use Illuminate\Auth\AuthenticationException;
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||||
@@ -11,7 +12,6 @@
|
|||||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
use Illuminate\Support\Facades\Http;
|
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
@@ -36,16 +36,18 @@ protected function sendSlackException(Throwable $e): void
|
|||||||
try {
|
try {
|
||||||
$url = env('LOG_SLACK_WEBHOOK_URL');
|
$url = env('LOG_SLACK_WEBHOOK_URL');
|
||||||
|
|
||||||
if (!$url) return;
|
if (! $url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$ip = request()?->ip() ?? 'N/A'; // 요청이 없는 경우 대비
|
$ip = request()?->ip() ?? 'N/A'; // 요청이 없는 경우 대비
|
||||||
|
|
||||||
Http::post($url, [
|
Http::post($url, [
|
||||||
'text' => "*[Laravel] 예외 발생!*\n" .
|
'text' => "*[Laravel] 예외 발생!*\n".
|
||||||
"• 메시지: `{$e->getMessage()}`\n" .
|
"• 메시지: `{$e->getMessage()}`\n".
|
||||||
"• 위치: `{$e->getFile()}:{$e->getLine()}`\n" .
|
"• 위치: `{$e->getFile()}:{$e->getLine()}`\n".
|
||||||
"• 시간: " . now()->toDateTimeString() . "\n" .
|
'• 시간: '.now()->toDateTimeString()."\n".
|
||||||
"• IP: `{$ip}`"
|
"• IP: `{$ip}`",
|
||||||
]);
|
]);
|
||||||
} catch (Throwable $ex) {
|
} catch (Throwable $ex) {
|
||||||
logger()->error('슬랙 전송 실패', ['message' => $ex->getMessage()]);
|
logger()->error('슬랙 전송 실패', ['message' => $ex->getMessage()]);
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Helpers;
|
namespace App\Helpers;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
|
|
||||||
class ApiResponse
|
class ApiResponse
|
||||||
{
|
{
|
||||||
|
public function normalizeFiles(array $laravelFiles): array
|
||||||
function normalizeFiles(array $laravelFiles): array {
|
{
|
||||||
$files = ['name' => [], 'type' => [], 'tmp_name' => [], 'size' => [], 'fileType' => []];
|
$files = ['name' => [], 'type' => [], 'tmp_name' => [], 'size' => [], 'fileType' => []];
|
||||||
foreach ($laravelFiles as $file) {
|
foreach ($laravelFiles as $file) {
|
||||||
$files['name'][] = $file->getClientOriginalName();
|
$files['name'][] = $file->getClientOriginalName();
|
||||||
@@ -18,10 +18,11 @@ function normalizeFiles(array $laravelFiles): array {
|
|||||||
$files['size'][] = $file->getSize();
|
$files['size'][] = $file->getSize();
|
||||||
$files['fileType'][] = '';
|
$files['fileType'][] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $files;
|
return $files;
|
||||||
}
|
}
|
||||||
|
|
||||||
# DebugQuery Helper
|
// DebugQuery Helper
|
||||||
public static function debugQueryLog(): array
|
public static function debugQueryLog(): array
|
||||||
{
|
{
|
||||||
$logs = DB::getQueryLog();
|
$logs = DB::getQueryLog();
|
||||||
@@ -31,17 +32,18 @@ public static function debugQueryLog(): array
|
|||||||
->map(function ($log) {
|
->map(function ($log) {
|
||||||
$query = $log['query'];
|
$query = $log['query'];
|
||||||
foreach ($log['bindings'] as $binding) {
|
foreach ($log['bindings'] as $binding) {
|
||||||
$binding = is_numeric($binding) ? $binding : "'" . addslashes($binding) . "'";
|
$binding = is_numeric($binding) ? $binding : "'".addslashes($binding)."'";
|
||||||
$query = preg_replace('/\\?/', $binding, $query, 1);
|
$query = preg_replace('/\\?/', $binding, $query, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// \n 제거
|
// \n 제거
|
||||||
$query = str_replace(["\n", "\r"], ' ', $query)." (time: {$log['time']})";
|
$query = str_replace(["\n", "\r"], ' ', $query)." (time: {$log['time']})";
|
||||||
|
|
||||||
return trim($query);
|
return trim($query);
|
||||||
})->toArray();
|
})->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
# ApiResponse Helper
|
// ApiResponse Helper
|
||||||
public static function success(
|
public static function success(
|
||||||
$data = null,
|
$data = null,
|
||||||
string $message = '요청 성공',
|
string $message = '요청 성공',
|
||||||
@@ -52,7 +54,10 @@ public static function success(
|
|||||||
'message' => $message,
|
'message' => $message,
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
];
|
];
|
||||||
if(!empty($debug)) $response['query'] = $debug;
|
if (! empty($debug)) {
|
||||||
|
$response['query'] = $debug;
|
||||||
|
}
|
||||||
|
|
||||||
return response()->json($response);
|
return response()->json($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +90,7 @@ public static function response($type = '', $query = '', $key = ''): array
|
|||||||
$debug = app()->environment('local') && request()->is('api/*');
|
$debug = app()->environment('local') && request()->is('api/*');
|
||||||
|
|
||||||
$result = match ($type) {
|
$result = match ($type) {
|
||||||
'get' => $key ? $query->get()->keyBy($key) : $query->get(),
|
'get' => $key ? $query->get()->keyBy($key) : $query->get(),
|
||||||
'getSub' => $query->get(),
|
'getSub' => $query->get(),
|
||||||
'count' => $query->count(),
|
'count' => $query->count(),
|
||||||
'first' => $query->first(),
|
'first' => $query->first(),
|
||||||
@@ -94,7 +99,7 @@ public static function response($type = '', $query = '', $key = ''): array
|
|||||||
default => null,
|
default => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
if($type=='getSub'){
|
if ($type == 'getSub') {
|
||||||
$array = $result->map(function ($item) {
|
$array = $result->map(function ($item) {
|
||||||
return (array) $item;
|
return (array) $item;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
@@ -118,8 +123,7 @@ public static function response($type = '', $query = '', $key = ''): array
|
|||||||
public static function handle(
|
public static function handle(
|
||||||
callable $callback,
|
callable $callback,
|
||||||
string $responseTitle = '요청'
|
string $responseTitle = '요청'
|
||||||
): JsonResponse
|
): JsonResponse {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
$result = $callback();
|
$result = $callback();
|
||||||
|
|
||||||
@@ -133,12 +137,12 @@ public static function handle(
|
|||||||
// ['error' => 'NO_TENANT', 'code' => 400]
|
// ['error' => 'NO_TENANT', 'code' => 400]
|
||||||
// ['code' => 404, 'message' => '데이터 없음']
|
// ['code' => 404, 'message' => '데이터 없음']
|
||||||
if (is_array($result) && (
|
if (is_array($result) && (
|
||||||
array_key_exists('error', $result) ||
|
array_key_exists('error', $result) ||
|
||||||
(array_key_exists('code', $result) && is_numeric($result['code']) && (int)$result['code'] >= 400)
|
(array_key_exists('code', $result) && is_numeric($result['code']) && (int) $result['code'] >= 400)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$code = (int)($result['code'] ?? 400);
|
$code = (int) ($result['code'] ?? 400);
|
||||||
$message = (string)($result['message'] ?? ($result['error'] ?? ($responseTitle.' 실패')));
|
$message = (string) ($result['message'] ?? ($result['error'] ?? ($responseTitle.' 실패')));
|
||||||
$details = $result['details'] ?? null;
|
$details = $result['details'] ?? null;
|
||||||
|
|
||||||
// 에러에도 쿼리 로그 포함되도록 error()가 처리하게 맡김
|
// 에러에도 쿼리 로그 포함되도록 error()가 처리하게 맡김
|
||||||
@@ -147,11 +151,11 @@ public static function handle(
|
|||||||
|
|
||||||
// 표준 박스( ['data'=>..., 'query'=>...] ) 하위호환
|
// 표준 박스( ['data'=>..., 'query'=>...] ) 하위호환
|
||||||
if (is_array($result) && array_key_exists('data', $result)) {
|
if (is_array($result) && array_key_exists('data', $result)) {
|
||||||
$data = $result['data'];
|
$data = $result['data'];
|
||||||
$debug = $result['query'] ?? [];
|
$debug = $result['query'] ?? [];
|
||||||
} else {
|
} else {
|
||||||
// 그냥 도메인 결과만 반환한 경우
|
// 그냥 도메인 결과만 반환한 경우
|
||||||
$data = $result;
|
$data = $result;
|
||||||
$debug = (app()->environment('local') && request()->is('api/*'))
|
$debug = (app()->environment('local') && request()->is('api/*'))
|
||||||
? self::debugQueryLog()
|
? self::debugQueryLog()
|
||||||
: [];
|
: [];
|
||||||
|
|||||||
@@ -2,14 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\AdminService;
|
use App\Services\AdminService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class AdminController extends Controller
|
class AdminController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request) {
|
return ApiResponse::handle(function () use ($request) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use App\Helpers\ApiResponse;
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Members\User;
|
use App\Models\Members\User;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -11,32 +10,27 @@
|
|||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
|
||||||
class ApiController extends Controller
|
class ApiController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public function debugApikey()
|
public function debugApikey()
|
||||||
{
|
{
|
||||||
$message = 'API Key 인증 성공';
|
$message = 'API Key 인증 성공';
|
||||||
|
|
||||||
return response()->json(['message' => $message]);
|
return response()->json(['message' => $message]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function login(Request $request)
|
public function login(Request $request)
|
||||||
{
|
{
|
||||||
$userId = $request->input('user_id');
|
$userId = $request->input('user_id');
|
||||||
$userPwd = $request->input('user_pwd');
|
$userPwd = $request->input('user_pwd');
|
||||||
|
|
||||||
if (!$userId || !$userPwd) {
|
if (! $userId || ! $userPwd) {
|
||||||
return response()->json(['error' => '아이디 또는 비밀번호 누락'], 400);
|
return response()->json(['error' => '아이디 또는 비밀번호 누락'], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$user = User::where('user_id', $userId)->first();
|
$user = User::where('user_id', $userId)->first();
|
||||||
|
|
||||||
if (!$user) {
|
if (! $user) {
|
||||||
return response()->json(['error' => '사용자를 찾을 수 없습니다.'], 404);
|
return response()->json(['error' => '사용자를 찾을 수 없습니다.'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,11 +44,11 @@ public function login(Request $request)
|
|||||||
$isValid = strtoupper(hash('sha256', $userPwd)) === strtoupper($user->password);
|
$isValid = strtoupper(hash('sha256', $userPwd)) === strtoupper($user->password);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$isValid) {
|
if (! $isValid) {
|
||||||
return response()->json(['error' => '아이디 또는 비밀번호가 올바르지 않습니다.'], 401);
|
return response()->json(['error' => '아이디 또는 비밀번호가 올바르지 않습니다.'], 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
//인증토큰 생성
|
// 인증토큰 생성
|
||||||
$token = $user->createToken('front-app')->plainTextToken;
|
$token = $user->createToken('front-app')->plainTextToken;
|
||||||
|
|
||||||
// 선택: DB에 신규 token 저장
|
// 선택: DB에 신규 token 저장
|
||||||
@@ -70,21 +64,20 @@ public function login(Request $request)
|
|||||||
|
|
||||||
public function logout(Request $request)
|
public function logout(Request $request)
|
||||||
{
|
{
|
||||||
//인증토큰 삭제
|
// 인증토큰 삭제
|
||||||
$request->user()->currentAccessToken()->delete();
|
$request->user()->currentAccessToken()->delete();
|
||||||
|
|
||||||
return response()->json(['message' => '로그아웃 완료']);
|
return response()->json(['message' => '로그아웃 완료']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function signup(Request $request)
|
public function signup(Request $request)
|
||||||
{
|
{
|
||||||
// 신규 회원 생성 + 역할 부여 지원
|
// 신규 회원 생성 + 역할 부여 지원
|
||||||
$v = Validator::make($request->all(), [
|
$v = Validator::make($request->all(), [
|
||||||
'user_id' => 'required|string|max:255|unique:users,user_id',
|
'user_id' => 'required|string|max:255|unique:users,user_id',
|
||||||
'name' => 'required|string|max:255',
|
'name' => 'required|string|max:255',
|
||||||
'email' => 'required|email|max:100|unique:users,email',
|
'email' => 'required|email|max:100|unique:users,email',
|
||||||
'phone' => 'nullable|string|max:30',
|
'phone' => 'nullable|string|max:30',
|
||||||
'password' => 'required|string|min:8|max:64',
|
'password' => 'required|string|min:8|max:64',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -97,15 +90,14 @@ public function signup(Request $request)
|
|||||||
return DB::transaction(function () use ($payload) {
|
return DB::transaction(function () use ($payload) {
|
||||||
// 신규 사용자 생성
|
// 신규 사용자 생성
|
||||||
$user = User::create([
|
$user = User::create([
|
||||||
'user_id' => $payload['user_id'],
|
'user_id' => $payload['user_id'],
|
||||||
'name' => $payload['name'],
|
'name' => $payload['name'],
|
||||||
'email' => $payload['email'],
|
'email' => $payload['email'],
|
||||||
'phone' => $payload['phone'] ?? null,
|
'phone' => $payload['phone'] ?? null,
|
||||||
'password' => $payload['password'], // 캐스트가 알아서 해싱
|
'password' => $payload['password'], // 캐스트가 알아서 해싱
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return ['user' => $user->only(['id','user_id','name','email','phone'])];
|
return ['user' => $user->only(['id', 'user_id', 'name', 'email', 'phone'])];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\CategoryService;
|
use App\Services\CategoryService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class CategoryController extends Controller
|
class CategoryController extends Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Services\CategoryFieldService;
|
|
||||||
use App\Helpers\ApiResponse;
|
use App\Helpers\ApiResponse;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Services\CategoryFieldService;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class CategoryFieldController extends Controller
|
class CategoryFieldController extends Controller
|
||||||
{
|
{
|
||||||
@@ -48,6 +48,7 @@ public function destroy(int $field)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($field) {
|
return ApiResponse::handle(function () use ($field) {
|
||||||
$this->service->destroy($field);
|
$this->service->destroy($field);
|
||||||
|
|
||||||
return 'success';
|
return 'success';
|
||||||
}, '카테고리 필드 삭제');
|
}, '카테고리 필드 삭제');
|
||||||
}
|
}
|
||||||
@@ -57,6 +58,7 @@ public function reorder(int $id, Request $request)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
$this->service->reorder($id, $request->input());
|
$this->service->reorder($id, $request->input());
|
||||||
|
|
||||||
return 'success';
|
return 'success';
|
||||||
}, '카테고리 필드 정렬 저장');
|
}, '카테고리 필드 정렬 저장');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Services\CategoryLogService;
|
|
||||||
use App\Helpers\ApiResponse;
|
use App\Helpers\ApiResponse;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Services\CategoryLogService;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class CategoryLogController extends Controller
|
class CategoryLogController extends Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Services\CategoryTemplateService;
|
|
||||||
use App\Helpers\ApiResponse;
|
use App\Helpers\ApiResponse;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Services\CategoryTemplateService;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class CategoryTemplateController extends Controller
|
class CategoryTemplateController extends Controller
|
||||||
{
|
{
|
||||||
@@ -48,6 +48,7 @@ public function destroy(int $tpl)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($tpl) {
|
return ApiResponse::handle(function () use ($tpl) {
|
||||||
$this->service->destroy($tpl);
|
$this->service->destroy($tpl);
|
||||||
|
|
||||||
return 'success';
|
return 'success';
|
||||||
}, '카테고리 템플릿 삭제');
|
}, '카테고리 템플릿 삭제');
|
||||||
}
|
}
|
||||||
@@ -57,6 +58,7 @@ public function apply(int $id, int $tpl)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $tpl) {
|
return ApiResponse::handle(function () use ($id, $tpl) {
|
||||||
$this->service->apply($id, $tpl);
|
$this->service->apply($id, $tpl);
|
||||||
|
|
||||||
return 'success';
|
return 'success';
|
||||||
}, '카테고리 템플릿 적용');
|
}, '카테고리 템플릿 적용');
|
||||||
}
|
}
|
||||||
@@ -73,7 +75,7 @@ public function preview(int $id, int $tpl)
|
|||||||
public function diff(int $id, Request $request)
|
public function diff(int $id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return $this->service->diff($id, (int)$request->query('a'), (int)$request->query('b'));
|
return $this->service->diff($id, (int) $request->query('a'), (int) $request->query('b'));
|
||||||
}, '카테고리 템플릿 비교');
|
}, '카테고리 템플릿 비교');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\ClassificationService;
|
use App\Services\ClassificationService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class ClassificationController extends Controller
|
class ClassificationController extends Controller
|
||||||
{
|
{
|
||||||
@@ -13,27 +13,26 @@ public function __construct(private ClassificationService $service) {}
|
|||||||
|
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(fn() => $this->service->index($request->all()), '분류 목록 조회');
|
return ApiResponse::handle(fn () => $this->service->index($request->all()), '분류 목록 조회');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show(string $id)
|
public function show(string $id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(fn() => $this->service->show((int)$id), '분류 단건 조회');
|
return ApiResponse::handle(fn () => $this->service->show((int) $id), '분류 단건 조회');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(fn() => $this->service->store($request->all()), '분류 생성');
|
return ApiResponse::handle(fn () => $this->service->store($request->all()), '분류 생성');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(string $id, Request $request)
|
public function update(string $id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(fn() => $this->service->update((int)$id, $request->all()), '분류 수정');
|
return ApiResponse::handle(fn () => $this->service->update((int) $id, $request->all()), '분류 수정');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy(string $id)
|
public function destroy(string $id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(fn() => $this->service->destroy((int)$id), '분류 삭제');
|
return ApiResponse::handle(fn () => $this->service->destroy((int) $id), '분류 삭제');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\ClientService;
|
use App\Services\ClientService;
|
||||||
use App\Helpers\ApiResponse;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class ClientController extends Controller
|
class ClientController extends Controller
|
||||||
@@ -20,6 +20,7 @@ public function index(Request $request)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request) {
|
return ApiResponse::handle(function () use ($request) {
|
||||||
$data = $this->service->index($request->all());
|
$data = $this->service->index($request->all());
|
||||||
|
|
||||||
return ['data' => $data, 'message' => __('message.fetched')];
|
return ['data' => $data, 'message' => __('message.fetched')];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -28,6 +29,7 @@ public function show(int $id)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () use ($id) {
|
||||||
$data = $this->service->show($id);
|
$data = $this->service->show($id);
|
||||||
|
|
||||||
return ['data' => $data, 'message' => __('message.fetched')];
|
return ['data' => $data, 'message' => __('message.fetched')];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -36,6 +38,7 @@ public function store(Request $request)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request) {
|
return ApiResponse::handle(function () use ($request) {
|
||||||
$data = $this->service->store($request->all());
|
$data = $this->service->store($request->all());
|
||||||
|
|
||||||
return ['data' => $data, 'message' => __('message.created')];
|
return ['data' => $data, 'message' => __('message.created')];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -44,6 +47,7 @@ public function update(Request $request, int $id)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request, $id) {
|
return ApiResponse::handle(function () use ($request, $id) {
|
||||||
$data = $this->service->update($id, $request->all());
|
$data = $this->service->update($id, $request->all());
|
||||||
|
|
||||||
return ['data' => $data, 'message' => __('message.updated')];
|
return ['data' => $data, 'message' => __('message.updated')];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -52,6 +56,7 @@ public function destroy(int $id)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () use ($id) {
|
||||||
$this->service->destroy($id);
|
$this->service->destroy($id);
|
||||||
|
|
||||||
return ['data' => null, 'message' => __('message.deleted')];
|
return ['data' => null, 'message' => __('message.deleted')];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -60,6 +65,7 @@ public function toggle(int $id)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () use ($id) {
|
||||||
$data = $this->service->toggle($id);
|
$data = $this->service->toggle($id);
|
||||||
|
|
||||||
return ['data' => $data, 'message' => __('message.updated')];
|
return ['data' => $data, 'message' => __('message.updated')];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,4 +69,4 @@ public function toggle(int $id)
|
|||||||
return ['data' => $data, 'message' => __('message.updated')];
|
return ['data' => $data, 'message' => __('message.updated')];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,18 +21,23 @@ class CommonController
|
|||||||
* description="테넌트의 활성화된 공통 코드 목록을 조회합니다.",
|
* description="테넌트의 활성화된 공통 코드 목록을 조회합니다.",
|
||||||
* tags={"Settings - Common Codes"},
|
* tags={"Settings - Common Codes"},
|
||||||
* security={{"ApiKeyAuth": {}}},
|
* security={{"ApiKeyAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="공통 코드 조회 성공",
|
* description="공통 코드 조회 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="공통코드"),
|
* @OA\Property(property="message", type="string", example="공통코드"),
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
* property="data",
|
* property="data",
|
||||||
* type="array",
|
* type="array",
|
||||||
|
*
|
||||||
* @OA\Items(
|
* @OA\Items(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="code_group", type="string", example="product_type"),
|
* @OA\Property(property="code_group", type="string", example="product_type"),
|
||||||
* @OA\Property(property="code", type="string", example="PRODUCT"),
|
* @OA\Property(property="code", type="string", example="PRODUCT"),
|
||||||
* @OA\Property(property="name", type="string", example="제품"),
|
* @OA\Property(property="name", type="string", example="제품"),
|
||||||
@@ -61,6 +66,7 @@ public static function getComeCode()
|
|||||||
* description="전체 공통 코드 목록을 조회합니다.",
|
* description="전체 공통 코드 목록을 조회합니다.",
|
||||||
* tags={"Settings - Common Codes"},
|
* tags={"Settings - Common Codes"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="공통 코드 목록 조회 성공"
|
* description="공통 코드 목록 조회 성공"
|
||||||
@@ -69,7 +75,7 @@ public static function getComeCode()
|
|||||||
*/
|
*/
|
||||||
public function list(Request $request)
|
public function list(Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request) {
|
return ApiResponse::handle(function () {
|
||||||
// Service implementation needed
|
// Service implementation needed
|
||||||
return [];
|
return [];
|
||||||
}, __('message.fetched'));
|
}, __('message.fetched'));
|
||||||
@@ -82,13 +88,16 @@ public function list(Request $request)
|
|||||||
* description="특정 그룹의 공통 코드 목록을 조회합니다.",
|
* description="특정 그룹의 공통 코드 목록을 조회합니다.",
|
||||||
* tags={"Settings - Common Codes"},
|
* tags={"Settings - Common Codes"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="group",
|
* name="group",
|
||||||
* in="path",
|
* in="path",
|
||||||
* required=true,
|
* required=true,
|
||||||
* description="코드 그룹",
|
* description="코드 그룹",
|
||||||
|
*
|
||||||
* @OA\Schema(type="string", example="product_type")
|
* @OA\Schema(type="string", example="product_type")
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="그룹 코드 조회 성공"
|
* description="그룹 코드 조회 성공"
|
||||||
@@ -97,7 +106,7 @@ public function list(Request $request)
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request, string $group)
|
public function index(Request $request, string $group)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($group) {
|
return ApiResponse::handle(function () {
|
||||||
// Service implementation needed
|
// Service implementation needed
|
||||||
return [];
|
return [];
|
||||||
}, __('message.fetched'));
|
}, __('message.fetched'));
|
||||||
@@ -110,16 +119,20 @@ public function index(Request $request, string $group)
|
|||||||
* description="새로운 공통 코드를 생성합니다.",
|
* description="새로운 공통 코드를 생성합니다.",
|
||||||
* tags={"Settings - Common Codes"},
|
* tags={"Settings - Common Codes"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="code_group", type="string", example="product_type"),
|
* @OA\Property(property="code_group", type="string", example="product_type"),
|
||||||
* @OA\Property(property="code", type="string", example="SERVICE"),
|
* @OA\Property(property="code", type="string", example="SERVICE"),
|
||||||
* @OA\Property(property="name", type="string", example="서비스"),
|
* @OA\Property(property="name", type="string", example="서비스"),
|
||||||
* @OA\Property(property="description", type="string", example="서비스 상품")
|
* @OA\Property(property="description", type="string", example="서비스 상품")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=201,
|
* response=201,
|
||||||
* description="공통 코드 생성 성공"
|
* description="공통 코드 생성 성공"
|
||||||
@@ -127,22 +140,26 @@ public function index(Request $request, string $group)
|
|||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=409,
|
* response=409,
|
||||||
* description="중복된 공통 코드",
|
* description="중복된 공통 코드",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="중복된 공통 코드가 존재합니다.")
|
* @OA\Property(property="message", type="string", example="중복된 공통 코드가 존재합니다.")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=422,
|
* response=422,
|
||||||
* description="유효성 검사 실패",
|
* description="유효성 검사 실패",
|
||||||
|
*
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request) {
|
return ApiResponse::handle(function () {
|
||||||
// Service implementation needed
|
// Service implementation needed
|
||||||
return [];
|
return [];
|
||||||
}, __('message.settings.common_code_saved'));
|
}, __('message.settings.common_code_saved'));
|
||||||
@@ -155,21 +172,27 @@ public function store(Request $request)
|
|||||||
* description="기존 공통 코드를 수정합니다.",
|
* description="기존 공통 코드를 수정합니다.",
|
||||||
* tags={"Settings - Common Codes"},
|
* tags={"Settings - Common Codes"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="id",
|
* name="id",
|
||||||
* in="path",
|
* in="path",
|
||||||
* required=true,
|
* required=true,
|
||||||
* description="공통 코드 ID",
|
* description="공통 코드 ID",
|
||||||
|
*
|
||||||
* @OA\Schema(type="integer", example=1)
|
* @OA\Schema(type="integer", example=1)
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="name", type="string", example="수정된 이름"),
|
* @OA\Property(property="name", type="string", example="수정된 이름"),
|
||||||
* @OA\Property(property="description", type="string", example="수정된 설명")
|
* @OA\Property(property="description", type="string", example="수정된 설명")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="공통 코드 수정 성공"
|
* description="공통 코드 수정 성공"
|
||||||
@@ -177,22 +200,26 @@ public function store(Request $request)
|
|||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=404,
|
* response=404,
|
||||||
* description="공통 코드를 찾을 수 없음",
|
* description="공통 코드를 찾을 수 없음",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="해당 공통 코드를 찾을 수 없습니다.")
|
* @OA\Property(property="message", type="string", example="해당 공통 코드를 찾을 수 없습니다.")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=422,
|
* response=422,
|
||||||
* description="유효성 검사 실패",
|
* description="유효성 검사 실패",
|
||||||
|
*
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, int $id)
|
public function update(Request $request, int $id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request, $id) {
|
return ApiResponse::handle(function () {
|
||||||
// Service implementation needed
|
// Service implementation needed
|
||||||
return [];
|
return [];
|
||||||
}, __('message.updated'));
|
}, __('message.updated'));
|
||||||
@@ -205,13 +232,16 @@ public function update(Request $request, int $id)
|
|||||||
* description="공통 코드를 삭제합니다.",
|
* description="공통 코드를 삭제합니다.",
|
||||||
* tags={"Settings - Common Codes"},
|
* tags={"Settings - Common Codes"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="id",
|
* name="id",
|
||||||
* in="path",
|
* in="path",
|
||||||
* required=true,
|
* required=true,
|
||||||
* description="공통 코드 ID",
|
* description="공통 코드 ID",
|
||||||
|
*
|
||||||
* @OA\Schema(type="integer", example=1)
|
* @OA\Schema(type="integer", example=1)
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="공통 코드 삭제 성공"
|
* description="공통 코드 삭제 성공"
|
||||||
@@ -219,8 +249,10 @@ public function update(Request $request, int $id)
|
|||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=404,
|
* response=404,
|
||||||
* description="공통 코드를 찾을 수 없음",
|
* description="공통 코드를 찾을 수 없음",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="해당 공통 코드를 찾을 수 없습니다.")
|
* @OA\Property(property="message", type="string", example="해당 공통 코드를 찾을 수 없습니다.")
|
||||||
* )
|
* )
|
||||||
@@ -229,7 +261,7 @@ public function update(Request $request, int $id)
|
|||||||
*/
|
*/
|
||||||
public function destroy(Request $request, int $id)
|
public function destroy(Request $request, int $id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () {
|
||||||
// Service implementation needed
|
// Service implementation needed
|
||||||
return [];
|
return [];
|
||||||
}, __('message.deleted'));
|
}, __('message.deleted'));
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\DepartmentService;
|
use App\Services\DepartmentService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class DepartmentController extends Controller
|
class DepartmentController extends Controller
|
||||||
{
|
{
|
||||||
@@ -39,7 +39,7 @@ public function show(int $id, Request $request)
|
|||||||
public function update($id, Request $request)
|
public function update($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return $this->service->update((int)$id, $request->all());
|
return $this->service->update((int) $id, $request->all());
|
||||||
}, '부서 수정');
|
}, '부서 수정');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public function update($id, Request $request)
|
|||||||
public function destroy($id, Request $request)
|
public function destroy($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return $this->service->destroy((int)$id, $request->all());
|
return $this->service->destroy((int) $id, $request->all());
|
||||||
}, '부서 삭제');
|
}, '부서 삭제');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ public function destroy($id, Request $request)
|
|||||||
public function listUsers($id, Request $request)
|
public function listUsers($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return $this->service->listUsers((int)$id, $request->all());
|
return $this->service->listUsers((int) $id, $request->all());
|
||||||
}, '부서 사용자 목록');
|
}, '부서 사용자 목록');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ public function listUsers($id, Request $request)
|
|||||||
public function attachUser($id, Request $request)
|
public function attachUser($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return $this->service->attachUser((int)$id, $request->all());
|
return $this->service->attachUser((int) $id, $request->all());
|
||||||
}, '부서 사용자 배정');
|
}, '부서 사용자 배정');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public function attachUser($id, Request $request)
|
|||||||
public function detachUser($id, $user, Request $request)
|
public function detachUser($id, $user, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $user, $request) {
|
return ApiResponse::handle(function () use ($id, $user, $request) {
|
||||||
return $this->service->detachUser((int)$id, (int)$user, $request->all());
|
return $this->service->detachUser((int) $id, (int) $user, $request->all());
|
||||||
}, '부서 사용자 제거');
|
}, '부서 사용자 제거');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ public function detachUser($id, $user, Request $request)
|
|||||||
public function setPrimary($id, $user, Request $request)
|
public function setPrimary($id, $user, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $user, $request) {
|
return ApiResponse::handle(function () use ($id, $user, $request) {
|
||||||
return $this->service->setPrimary((int)$id, (int)$user, $request->all());
|
return $this->service->setPrimary((int) $id, (int) $user, $request->all());
|
||||||
}, '주 부서 설정/해제');
|
}, '주 부서 설정/해제');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ public function setPrimary($id, $user, Request $request)
|
|||||||
public function listPermissions($id, Request $request)
|
public function listPermissions($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return $this->service->listPermissions((int)$id, $request->all());
|
return $this->service->listPermissions((int) $id, $request->all());
|
||||||
}, '부서 권한 목록');
|
}, '부서 권한 목록');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ public function listPermissions($id, Request $request)
|
|||||||
public function upsertPermissions($id, Request $request)
|
public function upsertPermissions($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return $this->service->upsertPermissions((int)$id, $request->all());
|
return $this->service->upsertPermissions((int) $id, $request->all());
|
||||||
}, '부서 권한 부여/차단');
|
}, '부서 권한 부여/차단');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ public function upsertPermissions($id, Request $request)
|
|||||||
public function revokePermissions($id, $permission, Request $request)
|
public function revokePermissions($id, $permission, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $permission, $request) {
|
return ApiResponse::handle(function () use ($id, $permission, $request) {
|
||||||
return $this->service->revokePermissions((int)$id, (int)$permission, $request->all());
|
return $this->service->revokePermissions((int) $id, (int) $permission, $request->all());
|
||||||
}, '부서 권한 제거');
|
}, '부서 권한 제거');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public function index(AuditLogIndexRequest $request)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request) {
|
return ApiResponse::handle(function () use ($request) {
|
||||||
$filters = $request->validated();
|
$filters = $request->validated();
|
||||||
|
|
||||||
return $this->service->paginate($filters);
|
return $this->service->paginate($filters);
|
||||||
}, __('message.fetched'));
|
}, __('message.fetched'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1\Design;
|
namespace App\Http\Controllers\Api\V1\Design;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use App\Services\Design\BomCalculationService;
|
|
||||||
use App\Http\Requests\Design\GetEstimateParametersRequest;
|
|
||||||
use App\Http\Requests\Design\CalculateBomRequest;
|
|
||||||
use App\Http\Requests\Design\SaveCompanyFormulaRequest;
|
|
||||||
use App\Helpers\ApiResponse;
|
use App\Helpers\ApiResponse;
|
||||||
use Illuminate\Http\Request;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Design\CalculateBomRequest;
|
||||||
|
use App\Http\Requests\Design\GetEstimateParametersRequest;
|
||||||
|
use App\Http\Requests\Design\SaveCompanyFormulaRequest;
|
||||||
|
use App\Services\Design\BomCalculationService;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class BomCalculationController extends Controller
|
class BomCalculationController extends Controller
|
||||||
{
|
{
|
||||||
@@ -30,7 +30,7 @@ public function getEstimateParameters(GetEstimateParametersRequest $request, int
|
|||||||
return [
|
return [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'data' => $result,
|
'data' => $result,
|
||||||
'message' => __('message.fetched')
|
'message' => __('message.fetched'),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -46,18 +46,18 @@ public function calculateBom(CalculateBomRequest $request, int $bomTemplateId):
|
|||||||
$data['company_name'] ?? null
|
$data['company_name'] ?? null
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$result['success']) {
|
if (! $result['success']) {
|
||||||
return [
|
return [
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'message' => __('error.calculation_failed'),
|
'message' => __('error.calculation_failed'),
|
||||||
'error' => $result['error']
|
'error' => $result['error'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'data' => $result['data'],
|
'data' => $result['data'],
|
||||||
'message' => __('message.calculation.completed')
|
'message' => __('message.calculation.completed'),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,7 @@ public function getCompanyFormulas(string $companyName): JsonResponse
|
|||||||
return [
|
return [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'data' => $result,
|
'data' => $result,
|
||||||
'message' => __('message.fetched')
|
'message' => __('message.fetched'),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ public function saveCompanyFormula(SaveCompanyFormulaRequest $request, string $c
|
|||||||
return [
|
return [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'data' => $result,
|
'data' => $result,
|
||||||
'message' => __('message.company_formula.created')
|
'message' => __('message.company_formula.created'),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ public function testFormula(Request $request): JsonResponse
|
|||||||
return ApiResponse::handle(function () use ($request) {
|
return ApiResponse::handle(function () use ($request) {
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'formula_expression' => 'required|string',
|
'formula_expression' => 'required|string',
|
||||||
'test_parameters' => 'required|array'
|
'test_parameters' => 'required|array',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$startTime = microtime(true);
|
$startTime = microtime(true);
|
||||||
@@ -115,10 +115,10 @@ public function testFormula(Request $request): JsonResponse
|
|||||||
'formula_expression' => $request->input('formula_expression'),
|
'formula_expression' => $request->input('formula_expression'),
|
||||||
'input_parameters' => $request->input('test_parameters'),
|
'input_parameters' => $request->input('test_parameters'),
|
||||||
'result' => $result,
|
'result' => $result,
|
||||||
'execution_time_ms' => round($executionTime, 2)
|
'execution_time_ms' => round($executionTime, 2),
|
||||||
],
|
],
|
||||||
'message' => __('message.formula.test_completed')
|
'message' => __('message.formula.test_completed'),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,11 @@ public function upsertTemplate(UpsertRequest $request, int $versionId)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request, $versionId) {
|
return ApiResponse::handle(function () use ($request, $versionId) {
|
||||||
$payload = $request->validated();
|
$payload = $request->validated();
|
||||||
|
|
||||||
return $this->service->upsertTemplate(
|
return $this->service->upsertTemplate(
|
||||||
modelVersionId: $versionId,
|
modelVersionId: $versionId,
|
||||||
name: $payload['name'] ?? 'Main',
|
name: $payload['name'] ?? 'Main',
|
||||||
isPrimary: (bool)($payload['is_primary'] ?? true),
|
isPrimary: (bool) ($payload['is_primary'] ?? true),
|
||||||
notes: $payload['notes'] ?? null
|
notes: $payload['notes'] ?? null
|
||||||
);
|
);
|
||||||
}, __('message.created'));
|
}, __('message.created'));
|
||||||
@@ -39,7 +40,7 @@ public function upsertTemplate(UpsertRequest $request, int $versionId)
|
|||||||
|
|
||||||
public function show(int $templateId)
|
public function show(int $templateId)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(fn() => $this->service->show($templateId, true), __('message.fetched'));
|
return ApiResponse::handle(fn () => $this->service->show($templateId, true), __('message.fetched'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function replaceItems(ReplaceItemsRequest $request, int $templateId)
|
public function replaceItems(ReplaceItemsRequest $request, int $templateId)
|
||||||
@@ -47,6 +48,7 @@ public function replaceItems(ReplaceItemsRequest $request, int $templateId)
|
|||||||
return ApiResponse::handle(function () use ($request, $templateId) {
|
return ApiResponse::handle(function () use ($request, $templateId) {
|
||||||
$payload = $request->validated();
|
$payload = $request->validated();
|
||||||
$this->service->replaceItems($templateId, $payload['items']);
|
$this->service->replaceItems($templateId, $payload['items']);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}, __('message.bom.bulk_upsert'));
|
}, __('message.bom.bulk_upsert'));
|
||||||
}
|
}
|
||||||
@@ -55,6 +57,7 @@ public function diff(int $templateId, DiffRequest $request)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($templateId, $request) {
|
return ApiResponse::handle(function () use ($templateId, $request) {
|
||||||
$otherId = $request->validated()['other_template_id'];
|
$otherId = $request->validated()['other_template_id'];
|
||||||
|
|
||||||
return $this->service->diffTemplates($templateId, $otherId);
|
return $this->service->diffTemplates($templateId, $otherId);
|
||||||
}, __('message.design.template_diff'));
|
}, __('message.design.template_diff'));
|
||||||
}
|
}
|
||||||
@@ -67,9 +70,10 @@ public function cloneTemplate(int $templateId, CloneRequest $request)
|
|||||||
templateId: $templateId,
|
templateId: $templateId,
|
||||||
targetVersionId: $payload['target_version_id'] ?? null,
|
targetVersionId: $payload['target_version_id'] ?? null,
|
||||||
name: $payload['name'] ?? null,
|
name: $payload['name'] ?? null,
|
||||||
isPrimary: (bool)($payload['is_primary'] ?? false),
|
isPrimary: (bool) ($payload['is_primary'] ?? false),
|
||||||
notes: $payload['notes'] ?? null
|
notes: $payload['notes'] ?? null
|
||||||
);
|
);
|
||||||
|
|
||||||
return $tpl;
|
return $tpl;
|
||||||
}, __('message.design.template_cloned'));
|
}, __('message.design.template_cloned'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
use App\Helpers\ApiResponse;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\Design\ModelService;
|
|
||||||
use App\Http\Requests\Common\PaginateRequest;
|
use App\Http\Requests\Common\PaginateRequest;
|
||||||
use App\Http\Requests\Design\Model\StoreRequest;
|
use App\Http\Requests\Design\Model\StoreRequest;
|
||||||
use App\Http\Requests\Design\Model\UpdateRequest;
|
use App\Http\Requests\Design\Model\UpdateRequest;
|
||||||
|
use App\Services\Design\ModelService;
|
||||||
|
|
||||||
class DesignModelController extends Controller
|
class DesignModelController extends Controller
|
||||||
{
|
{
|
||||||
@@ -19,11 +19,11 @@ public function __construct(
|
|||||||
public function index(PaginateRequest $request)
|
public function index(PaginateRequest $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request) {
|
return ApiResponse::handle(function () use ($request) {
|
||||||
$v = $request->validatedOrDefaults(); // page/size 기본값 주입됨
|
$v = $request->validatedOrDefaults(); // page/size 기본값 주입됨
|
||||||
$q = $v['q'] ?? '';
|
$q = $v['q'] ?? '';
|
||||||
$page = (int)($v['page'] ?? 1);
|
$page = (int) ($v['page'] ?? 1);
|
||||||
$size = (int)($v['size'] ?? 20);
|
$size = (int) ($v['size'] ?? 20);
|
||||||
$sort = $v['sort'] ?? null; // id|code|name|created_at
|
$sort = $v['sort'] ?? null; // id|code|name|created_at
|
||||||
$order = $v['order'] ?? 'desc'; // asc|desc
|
$order = $v['order'] ?? 'desc'; // asc|desc
|
||||||
|
|
||||||
return $this->service->list($q, $page, $size);
|
return $this->service->list($q, $page, $size);
|
||||||
@@ -33,7 +33,7 @@ public function index(PaginateRequest $request)
|
|||||||
public function store(StoreRequest $request)
|
public function store(StoreRequest $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(
|
return ApiResponse::handle(
|
||||||
fn() => $this->service->create($request->validated()),
|
fn () => $this->service->create($request->validated()),
|
||||||
__('message.created')
|
__('message.created')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ public function store(StoreRequest $request)
|
|||||||
public function show(int $id)
|
public function show(int $id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(
|
return ApiResponse::handle(
|
||||||
fn() => $this->service->find($id),
|
fn () => $this->service->find($id),
|
||||||
__('message.fetched')
|
__('message.fetched')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ public function show(int $id)
|
|||||||
public function update(UpdateRequest $request, int $id)
|
public function update(UpdateRequest $request, int $id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(
|
return ApiResponse::handle(
|
||||||
fn() => $this->service->update($id, $request->validated()),
|
fn () => $this->service->update($id, $request->validated()),
|
||||||
__('message.updated')
|
__('message.updated')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -58,6 +58,7 @@ public function destroy(int $id)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () use ($id) {
|
||||||
$this->service->delete($id);
|
$this->service->delete($id);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}, __('message.deleted'));
|
}, __('message.deleted'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,19 +15,20 @@ public function __construct(
|
|||||||
|
|
||||||
public function index(int $modelId)
|
public function index(int $modelId)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(fn() => $this->service->listByModel($modelId), __('message.fetched'));
|
return ApiResponse::handle(fn () => $this->service->listByModel($modelId), __('message.fetched'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createDraft(CreateDraftRequest $request, int $modelId)
|
public function createDraft(CreateDraftRequest $request, int $modelId)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request, $modelId) {
|
return ApiResponse::handle(function () use ($request, $modelId) {
|
||||||
$payload = $request->validated();
|
$payload = $request->validated();
|
||||||
|
|
||||||
return $this->service->createDraft($modelId, $payload);
|
return $this->service->createDraft($modelId, $payload);
|
||||||
}, __('message.created'));
|
}, __('message.created'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function release(int $versionId)
|
public function release(int $versionId)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(fn() => $this->service->release($versionId), __('message.updated'));
|
return ApiResponse::handle(fn () => $this->service->release($versionId), __('message.updated'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\Estimate\CreateEstimateRequest;
|
use App\Http\Requests\Estimate\CreateEstimateRequest;
|
||||||
use App\Http\Requests\Estimate\UpdateEstimateRequest;
|
use App\Http\Requests\Estimate\UpdateEstimateRequest;
|
||||||
use App\Services\Estimate\EstimateService;
|
use App\Services\Estimate\EstimateService;
|
||||||
use App\Helpers\ApiResponse;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,6 +27,7 @@ public function __construct(EstimateService $estimateService)
|
|||||||
* summary="견적 목록 조회",
|
* summary="견적 목록 조회",
|
||||||
* tags={"Estimate"},
|
* tags={"Estimate"},
|
||||||
* security={{"bearerAuth": {}}},
|
* security={{"bearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(name="status", in="query", description="견적 상태", @OA\Schema(type="string")),
|
* @OA\Parameter(name="status", in="query", description="견적 상태", @OA\Schema(type="string")),
|
||||||
* @OA\Parameter(name="customer_name", in="query", description="고객명", @OA\Schema(type="string")),
|
* @OA\Parameter(name="customer_name", in="query", description="고객명", @OA\Schema(type="string")),
|
||||||
* @OA\Parameter(name="model_set_id", in="query", description="모델셋 ID", @OA\Schema(type="integer")),
|
* @OA\Parameter(name="model_set_id", in="query", description="모델셋 ID", @OA\Schema(type="integer")),
|
||||||
@@ -34,6 +35,7 @@ public function __construct(EstimateService $estimateService)
|
|||||||
* @OA\Parameter(name="date_to", in="query", description="종료일", @OA\Schema(type="string", format="date")),
|
* @OA\Parameter(name="date_to", in="query", description="종료일", @OA\Schema(type="string", format="date")),
|
||||||
* @OA\Parameter(name="search", in="query", description="검색어", @OA\Schema(type="string")),
|
* @OA\Parameter(name="search", in="query", description="검색어", @OA\Schema(type="string")),
|
||||||
* @OA\Parameter(name="per_page", in="query", description="페이지당 항목수", @OA\Schema(type="integer", default=20)),
|
* @OA\Parameter(name="per_page", in="query", description="페이지당 항목수", @OA\Schema(type="integer", default=20)),
|
||||||
|
*
|
||||||
* @OA\Response(response=200, description="성공")
|
* @OA\Response(response=200, description="성공")
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
@@ -42,7 +44,7 @@ public function index(Request $request)
|
|||||||
$estimates = $this->estimateService->getEstimates($request->all());
|
$estimates = $this->estimateService->getEstimates($request->all());
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'estimates' => $estimates
|
'estimates' => $estimates,
|
||||||
], __('message.fetched'));
|
], __('message.fetched'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +54,9 @@ public function index(Request $request)
|
|||||||
* summary="견적 상세 조회",
|
* summary="견적 상세 조회",
|
||||||
* tags={"Estimate"},
|
* tags={"Estimate"},
|
||||||
* security={{"bearerAuth": {}}},
|
* security={{"bearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
||||||
|
*
|
||||||
* @OA\Response(response=200, description="성공")
|
* @OA\Response(response=200, description="성공")
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +65,7 @@ public function show($id)
|
|||||||
$estimate = $this->estimateService->getEstimateDetail($id);
|
$estimate = $this->estimateService->getEstimateDetail($id);
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'estimate' => $estimate
|
'estimate' => $estimate,
|
||||||
], __('message.fetched'));
|
], __('message.fetched'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,10 +75,13 @@ public function show($id)
|
|||||||
* summary="견적 생성",
|
* summary="견적 생성",
|
||||||
* tags={"Estimate"},
|
* tags={"Estimate"},
|
||||||
* security={{"bearerAuth": {}}},
|
* security={{"bearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* required={"model_set_id", "estimate_name", "parameters"},
|
* required={"model_set_id", "estimate_name", "parameters"},
|
||||||
|
*
|
||||||
* @OA\Property(property="model_set_id", type="integer", description="모델셋 ID"),
|
* @OA\Property(property="model_set_id", type="integer", description="모델셋 ID"),
|
||||||
* @OA\Property(property="estimate_name", type="string", description="견적명"),
|
* @OA\Property(property="estimate_name", type="string", description="견적명"),
|
||||||
* @OA\Property(property="customer_name", type="string", description="고객명"),
|
* @OA\Property(property="customer_name", type="string", description="고객명"),
|
||||||
@@ -83,6 +90,7 @@ public function show($id)
|
|||||||
* @OA\Property(property="notes", type="string", description="비고")
|
* @OA\Property(property="notes", type="string", description="비고")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(response=201, description="생성 성공")
|
* @OA\Response(response=201, description="생성 성공")
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
@@ -91,7 +99,7 @@ public function store(CreateEstimateRequest $request)
|
|||||||
$estimate = $this->estimateService->createEstimate($request->validated());
|
$estimate = $this->estimateService->createEstimate($request->validated());
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'estimate' => $estimate
|
'estimate' => $estimate,
|
||||||
], __('message.created'), 201);
|
], __('message.created'), 201);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,10 +109,14 @@ public function store(CreateEstimateRequest $request)
|
|||||||
* summary="견적 수정",
|
* summary="견적 수정",
|
||||||
* tags={"Estimate"},
|
* tags={"Estimate"},
|
||||||
* security={{"bearerAuth": {}}},
|
* security={{"bearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
|
*
|
||||||
* @OA\Property(property="estimate_name", type="string", description="견적명"),
|
* @OA\Property(property="estimate_name", type="string", description="견적명"),
|
||||||
* @OA\Property(property="customer_name", type="string", description="고객명"),
|
* @OA\Property(property="customer_name", type="string", description="고객명"),
|
||||||
* @OA\Property(property="project_name", type="string", description="프로젝트명"),
|
* @OA\Property(property="project_name", type="string", description="프로젝트명"),
|
||||||
@@ -113,6 +125,7 @@ public function store(CreateEstimateRequest $request)
|
|||||||
* @OA\Property(property="notes", type="string", description="비고")
|
* @OA\Property(property="notes", type="string", description="비고")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(response=200, description="수정 성공")
|
* @OA\Response(response=200, description="수정 성공")
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
@@ -121,7 +134,7 @@ public function update(UpdateEstimateRequest $request, $id)
|
|||||||
$estimate = $this->estimateService->updateEstimate($id, $request->validated());
|
$estimate = $this->estimateService->updateEstimate($id, $request->validated());
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'estimate' => $estimate
|
'estimate' => $estimate,
|
||||||
], __('message.updated'));
|
], __('message.updated'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +144,9 @@ public function update(UpdateEstimateRequest $request, $id)
|
|||||||
* summary="견적 삭제",
|
* summary="견적 삭제",
|
||||||
* tags={"Estimate"},
|
* tags={"Estimate"},
|
||||||
* security={{"bearerAuth": {}}},
|
* security={{"bearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
||||||
|
*
|
||||||
* @OA\Response(response=200, description="삭제 성공")
|
* @OA\Response(response=200, description="삭제 성공")
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
@@ -148,17 +163,22 @@ public function destroy($id)
|
|||||||
* summary="견적 복제",
|
* summary="견적 복제",
|
||||||
* tags={"Estimate"},
|
* tags={"Estimate"},
|
||||||
* security={{"bearerAuth": {}}},
|
* security={{"bearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* required={"estimate_name"},
|
* required={"estimate_name"},
|
||||||
|
*
|
||||||
* @OA\Property(property="estimate_name", type="string", description="새 견적명"),
|
* @OA\Property(property="estimate_name", type="string", description="새 견적명"),
|
||||||
* @OA\Property(property="customer_name", type="string", description="고객명"),
|
* @OA\Property(property="customer_name", type="string", description="고객명"),
|
||||||
* @OA\Property(property="project_name", type="string", description="프로젝트명"),
|
* @OA\Property(property="project_name", type="string", description="프로젝트명"),
|
||||||
* @OA\Property(property="notes", type="string", description="비고")
|
* @OA\Property(property="notes", type="string", description="비고")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(response=201, description="복제 성공")
|
* @OA\Response(response=201, description="복제 성공")
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
@@ -174,7 +194,7 @@ public function clone(Request $request, $id)
|
|||||||
$newEstimate = $this->estimateService->cloneEstimate($id, $request->all());
|
$newEstimate = $this->estimateService->cloneEstimate($id, $request->all());
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'estimate' => $newEstimate
|
'estimate' => $newEstimate,
|
||||||
], __('message.estimate.cloned'), 201);
|
], __('message.estimate.cloned'), 201);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,15 +204,20 @@ public function clone(Request $request, $id)
|
|||||||
* summary="견적 상태 변경",
|
* summary="견적 상태 변경",
|
||||||
* tags={"Estimate"},
|
* tags={"Estimate"},
|
||||||
* security={{"bearerAuth": {}}},
|
* security={{"bearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* required={"status"},
|
* required={"status"},
|
||||||
|
*
|
||||||
* @OA\Property(property="status", type="string", enum={"DRAFT","SENT","APPROVED","REJECTED","EXPIRED"}, description="변경할 상태"),
|
* @OA\Property(property="status", type="string", enum={"DRAFT","SENT","APPROVED","REJECTED","EXPIRED"}, description="변경할 상태"),
|
||||||
* @OA\Property(property="notes", type="string", description="상태 변경 사유")
|
* @OA\Property(property="notes", type="string", description="상태 변경 사유")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(response=200, description="상태 변경 성공")
|
* @OA\Response(response=200, description="상태 변경 성공")
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
@@ -210,7 +235,7 @@ public function changeStatus(Request $request, $id)
|
|||||||
);
|
);
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'estimate' => $estimate
|
'estimate' => $estimate,
|
||||||
], __('message.estimate.status_changed'));
|
], __('message.estimate.status_changed'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +245,9 @@ public function changeStatus(Request $request, $id)
|
|||||||
* summary="견적 폼 스키마 조회",
|
* summary="견적 폼 스키마 조회",
|
||||||
* tags={"Estimate"},
|
* tags={"Estimate"},
|
||||||
* security={{"bearerAuth": {}}},
|
* security={{"bearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(name="model_set_id", in="path", required=true, description="모델셋 ID", @OA\Schema(type="integer")),
|
* @OA\Parameter(name="model_set_id", in="path", required=true, description="모델셋 ID", @OA\Schema(type="integer")),
|
||||||
|
*
|
||||||
* @OA\Response(response=200, description="성공")
|
* @OA\Response(response=200, description="성공")
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
@@ -229,7 +256,7 @@ public function getFormSchema($modelSetId)
|
|||||||
$schema = $this->estimateService->getEstimateFormSchema($modelSetId);
|
$schema = $this->estimateService->getEstimateFormSchema($modelSetId);
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'form_schema' => $schema
|
'form_schema' => $schema,
|
||||||
], __('message.fetched'));
|
], __('message.fetched'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,14 +266,19 @@ public function getFormSchema($modelSetId)
|
|||||||
* summary="견적 계산 미리보기",
|
* summary="견적 계산 미리보기",
|
||||||
* tags={"Estimate"},
|
* tags={"Estimate"},
|
||||||
* security={{"bearerAuth": {}}},
|
* security={{"bearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(name="model_set_id", in="path", required=true, description="모델셋 ID", @OA\Schema(type="integer")),
|
* @OA\Parameter(name="model_set_id", in="path", required=true, description="모델셋 ID", @OA\Schema(type="integer")),
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* required={"parameters"},
|
* required={"parameters"},
|
||||||
|
*
|
||||||
* @OA\Property(property="parameters", type="object", description="견적 파라미터")
|
* @OA\Property(property="parameters", type="object", description="견적 파라미터")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(response=200, description="계산 성공")
|
* @OA\Response(response=200, description="계산 성공")
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
@@ -263,7 +295,7 @@ public function previewCalculation(Request $request, $modelSetId)
|
|||||||
);
|
);
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'calculation' => $calculation
|
'calculation' => $calculation,
|
||||||
], __('message.calculated'));
|
], __('message.calculated'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Services\FileService;
|
|
||||||
use App\Helpers\ApiResponse;
|
use App\Helpers\ApiResponse;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Services\FileService;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @OA\Tag(
|
* @OA\Tag(
|
||||||
@@ -22,33 +22,43 @@ class FileController extends Controller
|
|||||||
* description="파일을 업로드합니다.",
|
* description="파일을 업로드합니다.",
|
||||||
* tags={"Files"},
|
* tags={"Files"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\MediaType(
|
* @OA\MediaType(
|
||||||
* mediaType="multipart/form-data",
|
* mediaType="multipart/form-data",
|
||||||
|
*
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
* property="files[]",
|
* property="files[]",
|
||||||
* type="array",
|
* type="array",
|
||||||
|
*
|
||||||
* @OA\Items(type="string", format="binary"),
|
* @OA\Items(type="string", format="binary"),
|
||||||
* description="업로드할 파일들"
|
* description="업로드할 파일들"
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=201,
|
* response=201,
|
||||||
* description="파일 업로드 성공",
|
* description="파일 업로드 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="파일 업로드"),
|
* @OA\Property(property="message", type="string", example="파일 업로드"),
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
* property="data",
|
* property="data",
|
||||||
* type="array",
|
* type="array",
|
||||||
|
*
|
||||||
* @OA\Items(
|
* @OA\Items(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="id", type="integer", example=1),
|
* @OA\Property(property="id", type="integer", example=1),
|
||||||
* @OA\Property(property="filename", type="string", example="document.pdf"),
|
* @OA\Property(property="filename", type="string", example="document.pdf"),
|
||||||
* @OA\Property(property="path", type="string", example="/uploads/tenant/1/document.pdf"),
|
* @OA\Property(property="path", type="string", example="/uploads/tenant/1/document.pdf"),
|
||||||
@@ -57,29 +67,38 @@ class FileController extends Controller
|
|||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=400,
|
* response=400,
|
||||||
* description="파일 업로드 실패",
|
* description="파일 업로드 실패",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="파일 업로드에 실패했습니다.")
|
* @OA\Property(property="message", type="string", example="파일 업로드에 실패했습니다.")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=413,
|
* response=413,
|
||||||
* description="파일 크기 초과",
|
* description="파일 크기 초과",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="파일 크기가 너무 큽니다.")
|
* @OA\Property(property="message", type="string", example="파일 크기가 너무 큽니다.")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=415,
|
* response=415,
|
||||||
* description="지원하지 않는 파일 형식",
|
* description="지원하지 않는 파일 형식",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="허용되지 않는 파일 형식입니다.")
|
* @OA\Property(property="message", type="string", example="허용되지 않는 파일 형식입니다.")
|
||||||
* )
|
* )
|
||||||
@@ -100,23 +119,30 @@ public function upload(Request $request)
|
|||||||
* description="파일 목록을 조회합니다.",
|
* description="파일 목록을 조회합니다.",
|
||||||
* tags={"Files"},
|
* tags={"Files"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="page",
|
* name="page",
|
||||||
* in="query",
|
* in="query",
|
||||||
* description="페이지 번호",
|
* description="페이지 번호",
|
||||||
|
*
|
||||||
* @OA\Schema(type="integer", example=1)
|
* @OA\Schema(type="integer", example=1)
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="size",
|
* name="size",
|
||||||
* in="query",
|
* in="query",
|
||||||
* description="페이지 크기",
|
* description="페이지 크기",
|
||||||
|
*
|
||||||
* @OA\Schema(type="integer", example=10)
|
* @OA\Schema(type="integer", example=10)
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="파일 목록 조회 성공",
|
* description="파일 목록 조회 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="파일 목록조회"),
|
* @OA\Property(property="message", type="string", example="파일 목록조회"),
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
@@ -128,8 +154,10 @@ public function upload(Request $request)
|
|||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
* property="data",
|
* property="data",
|
||||||
* type="array",
|
* type="array",
|
||||||
|
*
|
||||||
* @OA\Items(
|
* @OA\Items(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="id", type="integer", example=1),
|
* @OA\Property(property="id", type="integer", example=1),
|
||||||
* @OA\Property(property="filename", type="string", example="document.pdf"),
|
* @OA\Property(property="filename", type="string", example="document.pdf"),
|
||||||
* @OA\Property(property="path", type="string", example="/uploads/tenant/1/document.pdf"),
|
* @OA\Property(property="path", type="string", example="/uploads/tenant/1/document.pdf"),
|
||||||
@@ -156,32 +184,42 @@ public function list(Request $request)
|
|||||||
* description="파일을 삭제합니다.",
|
* description="파일을 삭제합니다.",
|
||||||
* tags={"Files"},
|
* tags={"Files"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
* property="file_ids",
|
* property="file_ids",
|
||||||
* type="array",
|
* type="array",
|
||||||
|
*
|
||||||
* @OA\Items(type="integer"),
|
* @OA\Items(type="integer"),
|
||||||
* example={1, 2, 3}
|
* example={1, 2, 3}
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="파일 삭제 성공",
|
* description="파일 삭제 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="파일 삭제")
|
* @OA\Property(property="message", type="string", example="파일 삭제")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=404,
|
* response=404,
|
||||||
* description="파일을 찾을 수 없음",
|
* description="파일을 찾을 수 없음",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="파일을 찾을 수 없습니다.")
|
* @OA\Property(property="message", type="string", example="파일을 찾을 수 없습니다.")
|
||||||
* )
|
* )
|
||||||
@@ -202,18 +240,23 @@ public function delete(Request $request)
|
|||||||
* description="특정 파일의 정보를 조회합니다.",
|
* description="특정 파일의 정보를 조회합니다.",
|
||||||
* tags={"Files"},
|
* tags={"Files"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="file_id",
|
* name="file_id",
|
||||||
* in="query",
|
* in="query",
|
||||||
* required=true,
|
* required=true,
|
||||||
* description="파일 ID",
|
* description="파일 ID",
|
||||||
|
*
|
||||||
* @OA\Schema(type="integer", example=1)
|
* @OA\Schema(type="integer", example=1)
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="파일 정보 조회 성공",
|
* description="파일 정보 조회 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="파일 정보 조회"),
|
* @OA\Property(property="message", type="string", example="파일 정보 조회"),
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
@@ -228,11 +271,14 @@ public function delete(Request $request)
|
|||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=404,
|
* response=404,
|
||||||
* description="파일을 찾을 수 없음",
|
* description="파일을 찾을 수 없음",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="파일을 찾을 수 없습니다.")
|
* @OA\Property(property="message", type="string", example="파일을 찾을 수 없습니다.")
|
||||||
* )
|
* )
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\MaterialService;
|
use App\Services\MaterialService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @OA\Tag(
|
* @OA\Tag(
|
||||||
@@ -24,29 +24,38 @@ public function __construct(private MaterialService $service) {}
|
|||||||
* description="테넌트의 자재 목록을 조회합니다. (Products & Materials 통합 관리)",
|
* description="테넌트의 자재 목록을 조회합니다. (Products & Materials 통합 관리)",
|
||||||
* tags={"Products & Materials - Materials"},
|
* tags={"Products & Materials - Materials"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="page",
|
* name="page",
|
||||||
* in="query",
|
* in="query",
|
||||||
* description="페이지 번호",
|
* description="페이지 번호",
|
||||||
|
*
|
||||||
* @OA\Schema(type="integer", example=1)
|
* @OA\Schema(type="integer", example=1)
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="size",
|
* name="size",
|
||||||
* in="query",
|
* in="query",
|
||||||
* description="페이지 크기",
|
* description="페이지 크기",
|
||||||
|
*
|
||||||
* @OA\Schema(type="integer", example=10)
|
* @OA\Schema(type="integer", example=10)
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="q",
|
* name="q",
|
||||||
* in="query",
|
* in="query",
|
||||||
* description="검색어 (자재명, 코드)",
|
* description="검색어 (자재명, 코드)",
|
||||||
|
*
|
||||||
* @OA\Schema(type="string", example="스틸")
|
* @OA\Schema(type="string", example="스틸")
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="자재 목록 조회 성공",
|
* description="자재 목록 조회 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="조회 성공"),
|
* @OA\Property(property="message", type="string", example="조회 성공"),
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
@@ -58,8 +67,10 @@ public function __construct(private MaterialService $service) {}
|
|||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
* property="data",
|
* property="data",
|
||||||
* type="array",
|
* type="array",
|
||||||
|
*
|
||||||
* @OA\Items(
|
* @OA\Items(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="id", type="integer", example=1),
|
* @OA\Property(property="id", type="integer", example=1),
|
||||||
* @OA\Property(property="material_code", type="string", example="MAT001"),
|
* @OA\Property(property="material_code", type="string", example="MAT001"),
|
||||||
* @OA\Property(property="name", type="string", example="스틸파이프 10mm"),
|
* @OA\Property(property="name", type="string", example="스틸파이프 10mm"),
|
||||||
@@ -87,10 +98,13 @@ public function index(Request $request)
|
|||||||
* description="새로운 자재를 등록합니다.",
|
* description="새로운 자재를 등록합니다.",
|
||||||
* tags={"Products & Materials - Materials"},
|
* tags={"Products & Materials - Materials"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="material_code", type="string", example="MAT002"),
|
* @OA\Property(property="material_code", type="string", example="MAT002"),
|
||||||
* @OA\Property(property="name", type="string", example="알루미늄 프로파일"),
|
* @OA\Property(property="name", type="string", example="알루미늄 프로파일"),
|
||||||
* @OA\Property(property="specification", type="string", example="20x20x2mm"),
|
* @OA\Property(property="specification", type="string", example="20x20x2mm"),
|
||||||
@@ -98,11 +112,14 @@ public function index(Request $request)
|
|||||||
* @OA\Property(property="description", type="string", example="알루미늄 프로파일 20x20")
|
* @OA\Property(property="description", type="string", example="알루미늄 프로파일 20x20")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=201,
|
* response=201,
|
||||||
* description="자재 등록 성공",
|
* description="자재 등록 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="자재가 등록되었습니다."),
|
* @OA\Property(property="message", type="string", example="자재가 등록되었습니다."),
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
@@ -112,18 +129,23 @@ public function index(Request $request)
|
|||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=409,
|
* response=409,
|
||||||
* description="중복된 자재 코드",
|
* description="중복된 자재 코드",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="중복된 자재 코드입니다.")
|
* @OA\Property(property="message", type="string", example="중복된 자재 코드입니다.")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=422,
|
* response=422,
|
||||||
* description="유효성 검사 실패",
|
* description="유효성 검사 실패",
|
||||||
|
*
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
@@ -142,18 +164,23 @@ public function store(Request $request)
|
|||||||
* description="특정 자재의 상세 정보를 조회합니다.",
|
* description="특정 자재의 상세 정보를 조회합니다.",
|
||||||
* tags={"Products & Materials - Materials"},
|
* tags={"Products & Materials - Materials"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="id",
|
* name="id",
|
||||||
* in="path",
|
* in="path",
|
||||||
* required=true,
|
* required=true,
|
||||||
* description="자재 ID",
|
* description="자재 ID",
|
||||||
|
*
|
||||||
* @OA\Schema(type="integer", example=1)
|
* @OA\Schema(type="integer", example=1)
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="자재 상세 조회 성공",
|
* description="자재 상세 조회 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="조회 성공"),
|
* @OA\Property(property="message", type="string", example="조회 성공"),
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
@@ -171,9 +198,11 @@ public function store(Request $request)
|
|||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=404,
|
* response=404,
|
||||||
* description="자재 정보를 찾을 수 없음",
|
* description="자재 정보를 찾을 수 없음",
|
||||||
|
*
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
@@ -192,27 +221,35 @@ public function show(Request $request, int $id)
|
|||||||
* description="기존 자재 정보를 수정합니다.",
|
* description="기존 자재 정보를 수정합니다.",
|
||||||
* tags={"Products & Materials - Materials"},
|
* tags={"Products & Materials - Materials"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="id",
|
* name="id",
|
||||||
* in="path",
|
* in="path",
|
||||||
* required=true,
|
* required=true,
|
||||||
* description="자재 ID",
|
* description="자재 ID",
|
||||||
|
*
|
||||||
* @OA\Schema(type="integer", example=1)
|
* @OA\Schema(type="integer", example=1)
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="name", type="string", example="스틸파이프 12mm"),
|
* @OA\Property(property="name", type="string", example="스틸파이프 12mm"),
|
||||||
* @OA\Property(property="specification", type="string", example="직경 12mm, 두께 2mm"),
|
* @OA\Property(property="specification", type="string", example="직경 12mm, 두께 2mm"),
|
||||||
* @OA\Property(property="description", type="string", example="수정된 스틸 파이프")
|
* @OA\Property(property="description", type="string", example="수정된 스틸 파이프")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="자재 수정 성공",
|
* description="자재 수정 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="자재가 수정되었습니다.")
|
* @OA\Property(property="message", type="string", example="자재가 수정되었습니다.")
|
||||||
* )
|
* )
|
||||||
@@ -233,36 +270,47 @@ public function update(Request $request, int $id)
|
|||||||
* description="자재를 소프트 삭제합니다. 사용 중인 자재는 삭제할 수 없습니다.",
|
* description="자재를 소프트 삭제합니다. 사용 중인 자재는 삭제할 수 없습니다.",
|
||||||
* tags={"Products & Materials - Materials"},
|
* tags={"Products & Materials - Materials"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="id",
|
* name="id",
|
||||||
* in="path",
|
* in="path",
|
||||||
* required=true,
|
* required=true,
|
||||||
* description="자재 ID",
|
* description="자재 ID",
|
||||||
|
*
|
||||||
* @OA\Schema(type="integer", example=1)
|
* @OA\Schema(type="integer", example=1)
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="자재 삭제 성공",
|
* description="자재 삭제 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="자재가 삭제되었습니다.")
|
* @OA\Property(property="message", type="string", example="자재가 삭제되었습니다.")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=409,
|
* response=409,
|
||||||
* description="사용 중인 자재는 삭제 불가",
|
* description="사용 중인 자재는 삭제 불가",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="사용 중인 자재는 삭제할 수 없습니다.")
|
* @OA\Property(property="message", type="string", example="사용 중인 자재는 삭제할 수 없습니다.")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=404,
|
* response=404,
|
||||||
* description="자재 정보를 찾을 수 없음",
|
* description="자재 정보를 찾을 수 없음",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="자재 정보를 찾을 수 없습니다.")
|
* @OA\Property(property="message", type="string", example="자재 정보를 찾을 수 없습니다.")
|
||||||
* )
|
* )
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\MenuService;
|
use App\Services\MenuService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class MenuController extends Controller
|
class MenuController extends Controller
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@ public function index(Request $request)
|
|||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () use ($id) {
|
||||||
return MenuService::show(['id' => (int)$id]);
|
return MenuService::show(['id' => (int) $id]);
|
||||||
}, '메뉴 단건 조회');
|
}, '메뉴 단건 조회');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +33,9 @@ public function store(Request $request)
|
|||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request, $id) {
|
return ApiResponse::handle(function () use ($request, $id) {
|
||||||
$params = $request->all(); $params['id'] = (int)$id;
|
$params = $request->all();
|
||||||
|
$params['id'] = (int) $id;
|
||||||
|
|
||||||
return MenuService::update($params);
|
return MenuService::update($params);
|
||||||
}, '메뉴 수정');
|
}, '메뉴 수정');
|
||||||
}
|
}
|
||||||
@@ -41,7 +43,7 @@ public function update(Request $request, $id)
|
|||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () use ($id) {
|
||||||
return MenuService::destroy(['id' => (int)$id]);
|
return MenuService::destroy(['id' => (int) $id]);
|
||||||
}, '메뉴 삭제');
|
}, '메뉴 삭제');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +57,9 @@ public function reorder(Request $request)
|
|||||||
public function toggle(Request $request, $id)
|
public function toggle(Request $request, $id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request, $id) {
|
return ApiResponse::handle(function () use ($request, $id) {
|
||||||
$params = $request->all(); $params['id'] = (int)$id;
|
$params = $request->all();
|
||||||
|
$params['id'] = (int) $id;
|
||||||
|
|
||||||
return MenuService::toggle($params);
|
return MenuService::toggle($params);
|
||||||
}, '메뉴 상태 토글');
|
}, '메뉴 상태 토글');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\ModelSet\CloneModelSetRequest;
|
||||||
use App\Http\Requests\ModelSet\CreateModelSetRequest;
|
use App\Http\Requests\ModelSet\CreateModelSetRequest;
|
||||||
use App\Http\Requests\ModelSet\UpdateModelSetRequest;
|
use App\Http\Requests\ModelSet\UpdateModelSetRequest;
|
||||||
use App\Http\Requests\ModelSet\CloneModelSetRequest;
|
|
||||||
use App\Services\ModelSet\ModelSetService;
|
use App\Services\ModelSet\ModelSetService;
|
||||||
use App\Helpers\ApiResponse;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class ModelSetController extends Controller
|
class ModelSetController extends Controller
|
||||||
@@ -27,7 +27,7 @@ public function index(Request $request)
|
|||||||
$modelSets = $this->modelSetService->getModelSets($request->validated());
|
$modelSets = $this->modelSetService->getModelSets($request->validated());
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'model_sets' => $modelSets
|
'model_sets' => $modelSets,
|
||||||
], __('message.fetched'));
|
], __('message.fetched'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public function show($id)
|
|||||||
$modelSet = $this->modelSetService->getModelSetDetail($id);
|
$modelSet = $this->modelSetService->getModelSetDetail($id);
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'model_set' => $modelSet
|
'model_set' => $modelSet,
|
||||||
], __('message.fetched'));
|
], __('message.fetched'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ public function store(CreateModelSetRequest $request)
|
|||||||
$modelSet = $this->modelSetService->createModelSet($request->validated());
|
$modelSet = $this->modelSetService->createModelSet($request->validated());
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'model_set' => $modelSet
|
'model_set' => $modelSet,
|
||||||
], __('message.created'));
|
], __('message.created'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ public function update(UpdateModelSetRequest $request, $id)
|
|||||||
$modelSet = $this->modelSetService->updateModelSet($id, $request->validated());
|
$modelSet = $this->modelSetService->updateModelSet($id, $request->validated());
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'model_set' => $modelSet
|
'model_set' => $modelSet,
|
||||||
], __('message.updated'));
|
], __('message.updated'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ public function clone(CloneModelSetRequest $request, $id)
|
|||||||
$newModelSet = $this->modelSetService->cloneModelSet($id, $request->validated());
|
$newModelSet = $this->modelSetService->cloneModelSet($id, $request->validated());
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'model_set' => $newModelSet
|
'model_set' => $newModelSet,
|
||||||
], __('message.model_set.cloned'));
|
], __('message.model_set.cloned'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ public function getCategoryFields($id)
|
|||||||
$fields = $this->modelSetService->getModelSetCategoryFields($id);
|
$fields = $this->modelSetService->getModelSetCategoryFields($id);
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'category_fields' => $fields
|
'category_fields' => $fields,
|
||||||
], __('message.fetched'));
|
], __('message.fetched'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ public function getBomTemplates($id)
|
|||||||
$templates = $this->modelSetService->getModelSetBomTemplates($id);
|
$templates = $this->modelSetService->getModelSetBomTemplates($id);
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'bom_templates' => $templates
|
'bom_templates' => $templates,
|
||||||
], __('message.fetched'));
|
], __('message.fetched'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ public function getEstimateParameters($id, Request $request)
|
|||||||
$parameters = $this->modelSetService->getEstimateParameters($id, $request->all());
|
$parameters = $this->modelSetService->getEstimateParameters($id, $request->all());
|
||||||
|
|
||||||
return ApiResponse::success([
|
return ApiResponse::success([
|
||||||
'parameters' => $parameters
|
'parameters' => $parameters,
|
||||||
], __('message.fetched'));
|
], __('message.fetched'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,4 +134,4 @@ public function calculateBom($id, Request $request)
|
|||||||
|
|
||||||
return ApiResponse::success($result, __('message.calculated'));
|
return ApiResponse::success($result, __('message.calculated'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,4 +93,4 @@ public function destroy(int $id)
|
|||||||
return ['data' => null, 'message' => __('message.deleted')];
|
return ['data' => null, 'message' => __('message.deleted')];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public function destroy(int $id, int $item)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $item) {
|
return ApiResponse::handle(function () use ($id, $item) {
|
||||||
$this->service->destroy($id, $item);
|
$this->service->destroy($id, $item);
|
||||||
|
|
||||||
return 'success';
|
return 'success';
|
||||||
}, 'BOM 항목 삭제');
|
}, 'BOM 항목 삭제');
|
||||||
}
|
}
|
||||||
@@ -49,6 +50,7 @@ public function reorder(int $id, Request $request)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
$this->service->reorder($id, $request->input('items', []));
|
$this->service->reorder($id, $request->input('items', []));
|
||||||
|
|
||||||
return 'success';
|
return 'success';
|
||||||
}, 'BOM 정렬 변경');
|
}, 'BOM 정렬 변경');
|
||||||
}
|
}
|
||||||
@@ -81,7 +83,6 @@ public function replace(Request $request, int $id)
|
|||||||
}, __('message.bom.creat'));
|
}, __('message.bom.creat'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** 특정 제품 BOM에서 사용 중인 카테고리 목록 */
|
/** 특정 제품 BOM에서 사용 중인 카테고리 목록 */
|
||||||
public function listCategories(int $id)
|
public function listCategories(int $id)
|
||||||
{
|
{
|
||||||
@@ -94,14 +95,13 @@ public function listCategories(int $id)
|
|||||||
public function suggestCategories(Request $request)
|
public function suggestCategories(Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request) {
|
return ApiResponse::handle(function () use ($request) {
|
||||||
$q = $request->query('q');
|
$q = $request->query('q');
|
||||||
$limit = (int)($request->query('limit', 20));
|
$limit = (int) ($request->query('limit', 20));
|
||||||
|
|
||||||
return $this->service->listCategoriesForTenant($q, $limit);
|
return $this->service->listCategoriesForTenant($q, $limit);
|
||||||
}, __('message.bom.fetch'));
|
}, __('message.bom.fetch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Bom Tree */
|
/** Bom Tree */
|
||||||
public function tree(Request $request, int $id)
|
public function tree(Request $request, int $id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use App\Helpers\ApiResponse;
|
use App\Helpers\ApiResponse;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\ProductService;
|
use App\Services\ProductService;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class ProductController extends Controller
|
class ProductController extends Controller
|
||||||
{
|
{
|
||||||
@@ -56,6 +55,7 @@ public function destroy(int $id)
|
|||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () use ($id) {
|
||||||
$this->service->destroy($id);
|
$this->service->destroy($id);
|
||||||
|
|
||||||
return 'success';
|
return 'success';
|
||||||
}, '제품 삭제');
|
}, '제품 삭제');
|
||||||
}
|
}
|
||||||
@@ -76,4 +76,3 @@ public function toggle(int $id)
|
|||||||
}, '제품 활성 토글');
|
}, '제품 활성 토글');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\Authz\RoleService;
|
use App\Services\Authz\RoleService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class RoleController extends Controller
|
class RoleController extends Controller
|
||||||
{
|
{
|
||||||
@@ -26,21 +26,21 @@ public function store(Request $request)
|
|||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () use ($id) {
|
||||||
return RoleService::show((int)$id);
|
return RoleService::show((int) $id);
|
||||||
}, '역할 상세 조회');
|
}, '역할 상세 조회');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($request, $id) {
|
return ApiResponse::handle(function () use ($request, $id) {
|
||||||
return RoleService::update((int)$id, $request->all());
|
return RoleService::update((int) $id, $request->all());
|
||||||
}, '역할 수정');
|
}, '역할 수정');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () use ($id) {
|
||||||
return RoleService::destroy((int)$id);
|
return RoleService::destroy((int) $id);
|
||||||
}, '역할 삭제');
|
}, '역할 삭제');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,38 +2,38 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\Authz\RolePermissionService;
|
use App\Services\Authz\RolePermissionService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class RolePermissionController extends Controller
|
class RolePermissionController extends Controller
|
||||||
{
|
{
|
||||||
public function index($id, Request $request)
|
public function index($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () use ($id) {
|
||||||
return RolePermissionService::list((int)$id);
|
return RolePermissionService::list((int) $id);
|
||||||
}, '역할 퍼미션 목록 조회');
|
}, '역할 퍼미션 목록 조회');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function grant($id, Request $request)
|
public function grant($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return RolePermissionService::grant((int)$id, $request->all());
|
return RolePermissionService::grant((int) $id, $request->all());
|
||||||
}, '역할 퍼미션 부여');
|
}, '역할 퍼미션 부여');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function revoke($id, Request $request)
|
public function revoke($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return RolePermissionService::revoke((int)$id, $request->all());
|
return RolePermissionService::revoke((int) $id, $request->all());
|
||||||
}, '역할 퍼미션 회수');
|
}, '역할 퍼미션 회수');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sync($id, Request $request)
|
public function sync($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return RolePermissionService::sync((int)$id, $request->all());
|
return RolePermissionService::sync((int) $id, $request->all());
|
||||||
}, '역할 퍼미션 동기화');
|
}, '역할 퍼미션 동기화');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\TenantService;
|
use App\Services\TenantService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class TenantController extends Controller
|
class TenantController extends Controller
|
||||||
{
|
{
|
||||||
@@ -50,6 +50,4 @@ public function restore(Request $request)
|
|||||||
return TenantService::restoreTenant($request->all());
|
return TenantService::restoreTenant($request->all());
|
||||||
}, '테넌트 복구');
|
}, '테넌트 복구');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\TenantFieldSettingService;
|
use App\Services\TenantFieldSettingService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @OA\Tag(
|
* @OA\Tag(
|
||||||
@@ -22,18 +22,23 @@ class TenantFieldSettingController extends Controller
|
|||||||
* description="전역 + 테넌트별 병합된 필드 설정 효과값을 조회합니다.",
|
* description="전역 + 테넌트별 병합된 필드 설정 효과값을 조회합니다.",
|
||||||
* tags={"Settings - Fields"},
|
* tags={"Settings - Fields"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="필드 설정 목록 조회 성공",
|
* description="필드 설정 목록 조회 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=true),
|
* @OA\Property(property="success", type="boolean", example=true),
|
||||||
* @OA\Property(property="message", type="string", example="조회 성공"),
|
* @OA\Property(property="message", type="string", example="조회 성공"),
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
* property="data",
|
* property="data",
|
||||||
* type="array",
|
* type="array",
|
||||||
|
*
|
||||||
* @OA\Items(
|
* @OA\Items(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="field_key", type="string", example="product_name_required"),
|
* @OA\Property(property="field_key", type="string", example="product_name_required"),
|
||||||
* @OA\Property(property="field_value", type="string", example="true"),
|
* @OA\Property(property="field_value", type="string", example="true"),
|
||||||
* @OA\Property(property="source", type="string", example="tenant", description="global 또는 tenant")
|
* @OA\Property(property="source", type="string", example="tenant", description="global 또는 tenant")
|
||||||
@@ -57,38 +62,50 @@ public function index(Request $request)
|
|||||||
* description="여러 필드 설정을 트랜잭션으로 일괄 저장합니다.",
|
* description="여러 필드 설정을 트랜잭션으로 일괄 저장합니다.",
|
||||||
* tags={"Settings - Fields"},
|
* tags={"Settings - Fields"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(
|
* @OA\Property(
|
||||||
* property="fields",
|
* property="fields",
|
||||||
* type="array",
|
* type="array",
|
||||||
|
*
|
||||||
* @OA\Items(
|
* @OA\Items(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="field_key", type="string", example="product_name_required"),
|
* @OA\Property(property="field_key", type="string", example="product_name_required"),
|
||||||
* @OA\Property(property="field_value", type="string", example="true")
|
* @OA\Property(property="field_value", type="string", example="true")
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="대량 저장 성공",
|
* description="대량 저장 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
|
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=400,
|
* response=400,
|
||||||
* description="유효하지 않은 필드 타입",
|
* description="유효하지 않은 필드 타입",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="유효하지 않은 필드 타입입니다.")
|
* @OA\Property(property="message", type="string", example="유효하지 않은 필드 타입입니다.")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=422,
|
* response=422,
|
||||||
* description="유효성 검사 실패",
|
* description="유효성 검사 실패",
|
||||||
|
*
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
@@ -107,39 +124,52 @@ public function bulkUpsert(Request $request)
|
|||||||
* description="특정 필드 설정을 개별적으로 수정합니다.",
|
* description="특정 필드 설정을 개별적으로 수정합니다.",
|
||||||
* tags={"Settings - Fields"},
|
* tags={"Settings - Fields"},
|
||||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||||
|
*
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="key",
|
* name="key",
|
||||||
* in="path",
|
* in="path",
|
||||||
* required=true,
|
* required=true,
|
||||||
* description="필드 키",
|
* description="필드 키",
|
||||||
|
*
|
||||||
* @OA\Schema(type="string", example="product_name_required")
|
* @OA\Schema(type="string", example="product_name_required")
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\RequestBody(
|
* @OA\RequestBody(
|
||||||
* required=true,
|
* required=true,
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="field_value", type="string", example="false")
|
* @OA\Property(property="field_value", type="string", example="false")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="필드 설정 수정 성공",
|
* description="필드 설정 수정 성공",
|
||||||
|
*
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
|
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=404,
|
* response=404,
|
||||||
* description="필드 설정을 찾을 수 없음",
|
* description="필드 설정을 찾을 수 없음",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="해당 필드 설정을 찾을 수 없습니다.")
|
* @OA\Property(property="message", type="string", example="해당 필드 설정을 찾을 수 없습니다.")
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
|
*
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=400,
|
* response=400,
|
||||||
* description="유효하지 않은 필드 타입",
|
* description="유효하지 않은 필드 타입",
|
||||||
|
*
|
||||||
* @OA\JsonContent(
|
* @OA\JsonContent(
|
||||||
* type="object",
|
* type="object",
|
||||||
|
*
|
||||||
* @OA\Property(property="success", type="boolean", example=false),
|
* @OA\Property(property="success", type="boolean", example=false),
|
||||||
* @OA\Property(property="message", type="string", example="유효하지 않은 필드 타입입니다.")
|
* @OA\Property(property="message", type="string", example="유효하지 않은 필드 타입입니다.")
|
||||||
* )
|
* )
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\TenantOptionGroupService;
|
use App\Services\TenantOptionGroupService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class TenantOptionGroupController extends Controller
|
class TenantOptionGroupController extends Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\TenantOptionValueService;
|
use App\Services\TenantOptionValueService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class TenantOptionValueController extends Controller
|
class TenantOptionValueController extends Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\TenantUserProfileService;
|
use App\Services\TenantUserProfileService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class TenantUserProfileController extends Controller
|
class TenantUserProfileController extends Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\MemberService;
|
use App\Services\MemberService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class UserController extends Controller
|
class UserController extends Controller
|
||||||
{
|
{
|
||||||
@@ -53,10 +53,10 @@ public function tenants(Request $request)
|
|||||||
|
|
||||||
public function switchTenant(Request $request)
|
public function switchTenant(Request $request)
|
||||||
{
|
{
|
||||||
$tenant_id = $request->tenant_id;
|
$tenant_id = $request->tenant_id;
|
||||||
|
|
||||||
return ApiResponse::handle(function () use ($tenant_id) {
|
return ApiResponse::handle(function () use ($tenant_id) {
|
||||||
return MemberService::switchMyTenant($tenant_id);
|
return MemberService::switchMyTenant($tenant_id);
|
||||||
}, '활성 테넌트 전환');
|
}, '활성 테넌트 전환');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,38 +2,38 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Api\V1;
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use App\Helpers\ApiResponse;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\Authz\UserRoleService;
|
use App\Services\Authz\UserRoleService;
|
||||||
use App\Helpers\ApiResponse;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class UserRoleController extends Controller
|
class UserRoleController extends Controller
|
||||||
{
|
{
|
||||||
public function index($id)
|
public function index($id)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id) {
|
return ApiResponse::handle(function () use ($id) {
|
||||||
return UserRoleService::list((int)$id);
|
return UserRoleService::list((int) $id);
|
||||||
}, '사용자의 역할 목록 조회');
|
}, '사용자의 역할 목록 조회');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function grant($id, Request $request)
|
public function grant($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return UserRoleService::grant((int)$id, $request->all());
|
return UserRoleService::grant((int) $id, $request->all());
|
||||||
}, '사용자에게 역할 부여');
|
}, '사용자에게 역할 부여');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function revoke($id, Request $request)
|
public function revoke($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return UserRoleService::revoke((int)$id, $request->all());
|
return UserRoleService::revoke((int) $id, $request->all());
|
||||||
}, '사용자의 역할 회수');
|
}, '사용자의 역할 회수');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sync($id, Request $request)
|
public function sync($id, Request $request)
|
||||||
{
|
{
|
||||||
return ApiResponse::handle(function () use ($id, $request) {
|
return ApiResponse::handle(function () use ($id, $request) {
|
||||||
return UserRoleService::sync((int)$id, $request->all());
|
return UserRoleService::sync((int) $id, $request->all());
|
||||||
}, '사용자의 역할 동기화');
|
}, '사용자의 역할 동기화');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,4 +25,4 @@ class Kernel extends HttpKernel
|
|||||||
* 개별 미들웨어 설정
|
* 개별 미들웨어 설정
|
||||||
*/
|
*/
|
||||||
protected $routeMiddleware = [];
|
protected $routeMiddleware = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ public function handle(Request $request, Closure $next)
|
|||||||
'headers' => $request->headers->all(),
|
'headers' => $request->headers->all(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$apiKey = $request->header('X-API-KEY');
|
$apiKey = $request->header('X-API-KEY');
|
||||||
|
|
||||||
$validApiKey = false;
|
$validApiKey = false;
|
||||||
@@ -37,13 +36,13 @@ public function handle(Request $request, Closure $next)
|
|||||||
->exists();
|
->exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$validApiKey) {
|
if (! $validApiKey) {
|
||||||
return response()->json(['message' => 'Unauthorized. Invalid or missing API key'], 401);
|
return response()->json(['message' => 'Unauthorized. Invalid or missing API key'], 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bearer 인증 (Sanctum)
|
// Bearer 인증 (Sanctum)
|
||||||
$user = [];
|
$user = [];
|
||||||
if($token = $request->bearerToken()) {
|
if ($token = $request->bearerToken()) {
|
||||||
$accessToken = PersonalAccessToken::findToken($token);
|
$accessToken = PersonalAccessToken::findToken($token);
|
||||||
if ($accessToken && $accessToken->tokenable instanceof User) {
|
if ($accessToken && $accessToken->tokenable instanceof User) {
|
||||||
$user = $accessToken->tokenable;
|
$user = $accessToken->tokenable;
|
||||||
@@ -79,9 +78,9 @@ public function handle(Request $request, Closure $next)
|
|||||||
// 현재 라우트 확인 (경로 또는 이름)
|
// 현재 라우트 확인 (경로 또는 이름)
|
||||||
$currentRoute = $request->route()->uri(); // 또는 $request->path()
|
$currentRoute = $request->route()->uri(); // 또는 $request->path()
|
||||||
|
|
||||||
if (!in_array($currentRoute, $allowWithoutAuth)) {
|
if (! in_array($currentRoute, $allowWithoutAuth)) {
|
||||||
// 인증정보(api_user, tenant_id) 없으면 튕김
|
// 인증정보(api_user, tenant_id) 없으면 튕김
|
||||||
if (!app()->bound('api_user')) {
|
if (! app()->bound('api_user')) {
|
||||||
throw new AuthenticationException('회원정보 정보 없음');
|
throw new AuthenticationException('회원정보 정보 없음');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Models\Members\User as UserModel;
|
||||||
|
use App\Services\Authz\AccessService;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Spatie\Permission\PermissionRegistrar;
|
use Spatie\Permission\PermissionRegistrar;
|
||||||
use App\Services\Authz\AccessService;
|
|
||||||
use App\Models\Members\User as UserModel;
|
|
||||||
|
|
||||||
class CheckPermission
|
class CheckPermission
|
||||||
{
|
{
|
||||||
@@ -21,21 +21,21 @@ public function handle(Request $request, Closure $next)
|
|||||||
|
|
||||||
// perm 미지정 라우트 처리 정책
|
// perm 미지정 라우트 처리 정책
|
||||||
// TODO :: 초기 도입 단계: 통과. (정책에 따라 403으로 바꿔도 됨)
|
// TODO :: 초기 도입 단계: 통과. (정책에 따라 403으로 바꿔도 됨)
|
||||||
if (!$perm && !$permsAny) {
|
if (! $perm && ! $permsAny) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
// return response()->json(['success'=>false,'message'=>'권한 설정 누락','data'=>null], 403);
|
// return response()->json(['success'=>false,'message'=>'권한 설정 누락','data'=>null], 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 컨텍스트 확보
|
// 컨텍스트 확보
|
||||||
$tenantId = (int) app('tenant_id');
|
$tenantId = (int) app('tenant_id');
|
||||||
$userId = (int) app('api_user');
|
$userId = (int) app('api_user');
|
||||||
if (!$tenantId || !$userId) {
|
if (! $tenantId || ! $userId) {
|
||||||
return response()->json(['success'=>false,'message'=>'인증 또는 테넌트 정보가 없습니다.','data'=>null], 401);
|
return response()->json(['success' => false, 'message' => '인증 또는 테넌트 정보가 없습니다.', 'data' => null], 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = UserModel::find($userId);
|
$user = UserModel::find($userId);
|
||||||
if (!$user) {
|
if (! $user) {
|
||||||
return response()->json(['success'=>false,'message'=>'사용자 없음','data'=>null], 401);
|
return response()->json(['success' => false, 'message' => '사용자 없음', 'data' => null], 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spatie Teams 컨텍스트 고정
|
// Spatie Teams 컨텍스트 고정
|
||||||
@@ -48,10 +48,11 @@ public function handle(Request $request, Closure $next)
|
|||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return response()->json(['success'=>false,'message'=>'권한이 없습니다.','data'=>null], 403);
|
|
||||||
|
return response()->json(['success' => false, 'message' => '권한이 없습니다.', 'data' => null], 403);
|
||||||
}
|
}
|
||||||
if (! AccessService::allows($user, $perm, $tenantId, 'api')) {
|
if (! AccessService::allows($user, $perm, $tenantId, 'api')) {
|
||||||
return response()->json(['success'=>false,'message'=>'권한이 없습니다.','data'=>null], 403);
|
return response()->json(['success' => false, 'message' => '권한이 없습니다.', 'data' => null], 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Models\Member;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
use App\Models\Member;
|
|
||||||
|
|
||||||
class CheckSwaggerAuth
|
class CheckSwaggerAuth
|
||||||
{
|
{
|
||||||
@@ -13,19 +13,21 @@ public function handle(Request $request, Closure $next)
|
|||||||
{
|
{
|
||||||
$token = Session::get('user_token');
|
$token = Session::get('user_token');
|
||||||
|
|
||||||
if (!$token) {
|
if (! $token) {
|
||||||
// 원래 URL 저장 후 로그인 페이지로 이동
|
// 원래 URL 저장 후 로그인 페이지로 이동
|
||||||
Session::put('redirect_to', $request->fullUrl());
|
Session::put('redirect_to', $request->fullUrl());
|
||||||
|
|
||||||
return redirect()->route('login');
|
return redirect()->route('login');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = Member::where('remember_token', $token)->first();
|
$user = Member::where('remember_token', $token)->first();
|
||||||
|
|
||||||
if (!$user) {
|
if (! $user) {
|
||||||
Session::forget('user_token');
|
Session::forget('user_token');
|
||||||
Session::forget('user_id');
|
Session::forget('user_id');
|
||||||
|
|
||||||
Session::put('redirect_to', $request->fullUrl());
|
Session::put('redirect_to', $request->fullUrl());
|
||||||
|
|
||||||
return redirect()->route('login');
|
return redirect()->route('login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,4 +22,4 @@ public function handle(Request $request, Closure $next): Response
|
|||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,18 +9,18 @@ class PermMapper
|
|||||||
{
|
{
|
||||||
/** HTTP 메서드 → 액션 버킷 */
|
/** HTTP 메서드 → 액션 버킷 */
|
||||||
private array $actionMap = [
|
private array $actionMap = [
|
||||||
'GET' => 'view',
|
'GET' => 'view',
|
||||||
'HEAD' => 'view',
|
'HEAD' => 'view',
|
||||||
'POST' => 'create',
|
'POST' => 'create',
|
||||||
'PUT' => 'update',
|
'PUT' => 'update',
|
||||||
'PATCH' => 'update',
|
'PATCH' => 'update',
|
||||||
'DELETE' => 'delete',
|
'DELETE' => 'delete',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
$route = $request->route();
|
$route = $request->route();
|
||||||
if (!$route) {
|
if (! $route) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,6 +33,7 @@ public function handle(Request $request, Closure $next)
|
|||||||
$forced = $route->defaults['perm'] ?? $route->defaults['permission'] ?? null;
|
$forced = $route->defaults['perm'] ?? $route->defaults['permission'] ?? null;
|
||||||
if ($forced) {
|
if ($forced) {
|
||||||
$request->attributes->set('perm', $forced);
|
$request->attributes->set('perm', $forced);
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,16 +14,16 @@ public function authorize(): bool
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'page' => 'nullable|integer|min:1',
|
'page' => 'nullable|integer|min:1',
|
||||||
'size' => 'nullable|integer|min:1|max:200',
|
'size' => 'nullable|integer|min:1|max:200',
|
||||||
'target_type' => 'nullable|string|max:100',
|
'target_type' => 'nullable|string|max:100',
|
||||||
'target_id' => 'nullable|integer|min:1',
|
'target_id' => 'nullable|integer|min:1',
|
||||||
'action' => 'nullable|string|max:50',
|
'action' => 'nullable|string|max:50',
|
||||||
'actor_id' => 'nullable|integer|min:1',
|
'actor_id' => 'nullable|integer|min:1',
|
||||||
'from' => 'nullable|date',
|
'from' => 'nullable|date',
|
||||||
'to' => 'nullable|date|after_or_equal:from',
|
'to' => 'nullable|date|after_or_equal:from',
|
||||||
'sort' => 'nullable|string|in:created_at',
|
'sort' => 'nullable|string|in:created_at',
|
||||||
'order' => 'nullable|string|in:asc,desc',
|
'order' => 'nullable|string|in:asc,desc',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Requests\Common;
|
namespace App\Http\Requests\Common;
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class PaginateRequest extends FormRequest
|
class PaginateRequest extends FormRequest
|
||||||
{
|
{
|
||||||
public function authorize(): bool { return true; }
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'page' => 'nullable|integer|min:1',
|
'page' => 'nullable|integer|min:1',
|
||||||
'size' => 'nullable|integer|min:1|max:100',
|
'size' => 'nullable|integer|min:1|max:100',
|
||||||
'q' => 'nullable|string|max:100',
|
'q' => 'nullable|string|max:100',
|
||||||
'sort' => 'nullable|string|in:id,code,name,created_at',
|
'sort' => 'nullable|string|in:id,code,name,created_at',
|
||||||
'order' => 'nullable|string|in:asc,desc',
|
'order' => 'nullable|string|in:asc,desc',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -21,9 +25,10 @@ public function rules(): array
|
|||||||
public function validatedOrDefaults(): array
|
public function validatedOrDefaults(): array
|
||||||
{
|
{
|
||||||
$v = $this->validated();
|
$v = $this->validated();
|
||||||
$v['page'] = $v['page'] ?? 1;
|
$v['page'] = $v['page'] ?? 1;
|
||||||
$v['size'] = $v['size'] ?? 20;
|
$v['size'] = $v['size'] ?? 20;
|
||||||
$v['order'] = $v['order'] ?? 'desc';
|
$v['order'] = $v['order'] ?? 'desc';
|
||||||
|
|
||||||
return $v;
|
return $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ public function rules(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'target_version_id' => 'nullable|integer|min:1',
|
'target_version_id' => 'nullable|integer|min:1',
|
||||||
'name' => 'nullable|string|max:100',
|
'name' => 'nullable|string|max:100',
|
||||||
'is_primary' => 'nullable|boolean',
|
'is_primary' => 'nullable|boolean',
|
||||||
'notes' => 'nullable|string',
|
'notes' => 'nullable|string',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ public function messages(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'other_template_id.required' => __('validation.required', ['attribute' => 'other_template_id']),
|
'other_template_id.required' => __('validation.required', ['attribute' => 'other_template_id']),
|
||||||
'other_template_id.integer' => __('validation.integer', ['attribute' => 'other_template_id']),
|
'other_template_id.integer' => __('validation.integer', ['attribute' => 'other_template_id']),
|
||||||
'other_template_id.min' => __('validation.min.numeric', ['attribute' => 'other_template_id', 'min' => 1]),
|
'other_template_id.min' => __('validation.min.numeric', ['attribute' => 'other_template_id', 'min' => 1]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Requests\Design\BomTemplate;
|
namespace App\Http\Requests\Design\BomTemplate;
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
|
||||||
use App\Support\Validation\BomItemRules;
|
use App\Support\Validation\BomItemRules;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ReplaceItemsRequest extends FormRequest
|
class ReplaceItemsRequest extends FormRequest
|
||||||
{
|
{
|
||||||
public function authorize(): bool { return true; }
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
$itemRules = collect(BomItemRules::base())
|
$itemRules = collect(BomItemRules::base())
|
||||||
->mapWithKeys(fn($rule, $key) => ["items.*.$key" => $rule])
|
->mapWithKeys(fn ($rule, $key) => ["items.*.$key" => $rule])
|
||||||
->all();
|
->all();
|
||||||
|
|
||||||
return ['items' => 'required|array|min:1'] + $itemRules;
|
return ['items' => 'required|array|min:1'] + $itemRules;
|
||||||
@@ -21,8 +25,8 @@ public function messages(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'items.required' => __('validation.required', ['attribute' => 'items']),
|
'items.required' => __('validation.required', ['attribute' => 'items']),
|
||||||
'items.array' => __('validation.array', ['attribute' => 'items']),
|
'items.array' => __('validation.array', ['attribute' => 'items']),
|
||||||
'items.min' => __('validation.min.array', ['attribute' => 'items', 'min' => 1]),
|
'items.min' => __('validation.min.array', ['attribute' => 'items', 'min' => 1]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public function rules(): array
|
|||||||
'parameters.power_source' => 'nullable|string|in:manual,electric,automatic',
|
'parameters.power_source' => 'nullable|string|in:manual,electric,automatic',
|
||||||
'parameters.motor_type' => 'nullable|string|in:standard,low_noise,high_torque',
|
'parameters.motor_type' => 'nullable|string|in:standard,low_noise,high_torque',
|
||||||
'parameters.material_grade' => 'nullable|string|in:standard,premium,luxury',
|
'parameters.material_grade' => 'nullable|string|in:standard,premium,luxury',
|
||||||
'company_name' => 'nullable|string|max:100'
|
'company_name' => 'nullable|string|max:100',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ public function messages(): array
|
|||||||
'parameters.material_grade.string' => __('error.validation.string'),
|
'parameters.material_grade.string' => __('error.validation.string'),
|
||||||
'parameters.material_grade.in' => __('error.validation.in'),
|
'parameters.material_grade.in' => __('error.validation.in'),
|
||||||
'company_name.string' => __('error.validation.string'),
|
'company_name.string' => __('error.validation.string'),
|
||||||
'company_name.max' => __('error.validation.max.string')
|
'company_name.max' => __('error.validation.max.string'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ public function attributes(): array
|
|||||||
'parameters.power_source' => '동력원',
|
'parameters.power_source' => '동력원',
|
||||||
'parameters.motor_type' => '모터타입',
|
'parameters.motor_type' => '모터타입',
|
||||||
'parameters.material_grade' => '자재등급',
|
'parameters.material_grade' => '자재등급',
|
||||||
'company_name' => '업체명'
|
'company_name' => '업체명',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public function authorize(): bool
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'company_name' => 'nullable|string|max:100'
|
'company_name' => 'nullable|string|max:100',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ public function messages(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'company_name.string' => __('error.validation.string'),
|
'company_name.string' => __('error.validation.string'),
|
||||||
'company_name.max' => __('error.validation.max.string')
|
'company_name.max' => __('error.validation.max.string'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Requests\Design\Model;
|
namespace App\Http\Requests\Design\Model;
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class StoreRequest extends FormRequest
|
class StoreRequest extends FormRequest
|
||||||
{
|
{
|
||||||
public function authorize(): bool { return true; }
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'code' => 'required|string|max:100',
|
'code' => 'required|string|max:100',
|
||||||
'name' => 'required|string|max:200',
|
'name' => 'required|string|max:200',
|
||||||
'category_id' => 'nullable|integer',
|
'category_id' => 'nullable|integer',
|
||||||
'lifecycle' => 'nullable|string|max:50',
|
'lifecycle' => 'nullable|string|max:50',
|
||||||
'description' => 'nullable|string',
|
'description' => 'nullable|string',
|
||||||
'is_active' => 'boolean',
|
'is_active' => 'boolean',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public function rules(): array
|
|||||||
'validation_rules.*.field' => 'nullable|string|max:50',
|
'validation_rules.*.field' => 'nullable|string|max:50',
|
||||||
'validation_rules.*.rule' => 'nullable|string|max:200',
|
'validation_rules.*.rule' => 'nullable|string|max:200',
|
||||||
'validation_rules.*.message' => 'nullable|string|max:200',
|
'validation_rules.*.message' => 'nullable|string|max:200',
|
||||||
'description' => 'nullable|string|max:500'
|
'description' => 'nullable|string|max:500',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ public function messages(): array
|
|||||||
'validation_rules.*.message.string' => __('error.validation.string'),
|
'validation_rules.*.message.string' => __('error.validation.string'),
|
||||||
'validation_rules.*.message.max' => __('error.validation.max.string'),
|
'validation_rules.*.message.max' => __('error.validation.max.string'),
|
||||||
'description.string' => __('error.validation.string'),
|
'description.string' => __('error.validation.string'),
|
||||||
'description.max' => __('error.validation.max.string')
|
'description.max' => __('error.validation.max.string'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ public function attributes(): array
|
|||||||
'validation_rules.*.field' => '검증 필드',
|
'validation_rules.*.field' => '검증 필드',
|
||||||
'validation_rules.*.rule' => '검증 규칙',
|
'validation_rules.*.rule' => '검증 규칙',
|
||||||
'validation_rules.*.message' => '검증 메시지',
|
'validation_rules.*.message' => '검증 메시지',
|
||||||
'description' => '설명'
|
'description' => '설명',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,4 +35,4 @@ public function messages(): array
|
|||||||
'parameters.array' => __('validation.array', ['attribute' => '견적 파라미터']),
|
'parameters.array' => __('validation.array', ['attribute' => '견적 파라미터']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,4 +33,4 @@ public function messages(): array
|
|||||||
'status.in' => __('validation.in', ['attribute' => '상태']),
|
'status.in' => __('validation.in', ['attribute' => '상태']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ class AuditLog extends Model
|
|||||||
protected $table = 'audit_logs';
|
protected $table = 'audit_logs';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id','target_type','target_id','action','before','after','actor_id','ip','ua','created_at',
|
'tenant_id', 'target_type', 'target_id', 'action', 'before', 'after', 'actor_id', 'ip', 'ua', 'created_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'before' => 'array',
|
'before' => 'array',
|
||||||
'after' => 'array',
|
'after' => 'array',
|
||||||
'created_at' => 'datetime',
|
'created_at' => 'datetime',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models\Boards;
|
namespace App\Models\Boards;
|
||||||
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,15 +10,19 @@
|
|||||||
class Board extends Model
|
class Board extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'boards';
|
protected $table = 'boards';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id', 'board_code', 'name', 'description', 'editor_type',
|
'tenant_id', 'board_code', 'name', 'description', 'editor_type',
|
||||||
'allow_files', 'max_file_count', 'max_file_size', 'extra_settings', 'is_active'
|
'allow_files', 'max_file_count', 'max_file_size', 'extra_settings', 'is_active',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function customFields() {
|
public function customFields()
|
||||||
|
{
|
||||||
return $this->hasMany(BoardSetting::class, 'board_id');
|
return $this->hasMany(BoardSetting::class, 'board_id');
|
||||||
}
|
}
|
||||||
public function posts() {
|
|
||||||
|
public function posts()
|
||||||
|
{
|
||||||
return $this->hasMany(Post::class, 'board_id');
|
return $this->hasMany(Post::class, 'board_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Models\Boards;
|
namespace App\Models\Boards;
|
||||||
|
|
||||||
|
use App\Models\Members\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use App\Models\Members\User;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @mixin IdeHelperBoardComment
|
* @mixin IdeHelperBoardComment
|
||||||
@@ -14,20 +14,28 @@ class BoardComment extends Model
|
|||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'board_comments';
|
protected $table = 'board_comments';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'post_id', 'tenant_id', 'user_id', 'parent_id', 'content', 'ip_address', 'status'
|
'post_id', 'tenant_id', 'user_id', 'parent_id', 'content', 'ip_address', 'status',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function post() {
|
public function post()
|
||||||
|
{
|
||||||
return $this->belongsTo(Post::class, 'post_id');
|
return $this->belongsTo(Post::class, 'post_id');
|
||||||
}
|
}
|
||||||
public function user() {
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'user_id');
|
return $this->belongsTo(User::class, 'user_id');
|
||||||
}
|
}
|
||||||
public function parent() {
|
|
||||||
|
public function parent()
|
||||||
|
{
|
||||||
return $this->belongsTo(BoardComment::class, 'parent_id');
|
return $this->belongsTo(BoardComment::class, 'parent_id');
|
||||||
}
|
}
|
||||||
public function children() {
|
|
||||||
|
public function children()
|
||||||
|
{
|
||||||
return $this->hasMany(BoardComment::class, 'parent_id')->where('status', 'active');
|
return $this->hasMany(BoardComment::class, 'parent_id')->where('status', 'active');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,13 @@
|
|||||||
class BoardSetting extends Model
|
class BoardSetting extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'board_settings';
|
protected $table = 'board_settings';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'board_id', 'name', 'field_key', 'field_type', 'field_meta', 'is_required', 'sort_order'
|
'board_id', 'name', 'field_key', 'field_type', 'field_meta', 'is_required', 'sort_order',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function board() {
|
public function board()
|
||||||
|
{
|
||||||
return $this->belongsTo(Board::class, 'board_id');
|
return $this->belongsTo(Board::class, 'board_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Models\Boards;
|
namespace App\Models\Boards;
|
||||||
|
|
||||||
|
use App\Models\Commons\File;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use App\Models\Commons\File;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @mixin IdeHelperPost
|
* @mixin IdeHelperPost
|
||||||
@@ -14,18 +14,24 @@ class Post extends Model
|
|||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'posts';
|
protected $table = 'posts';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id', 'board_id', 'user_id', 'title', 'content', 'editor_type',
|
'tenant_id', 'board_id', 'user_id', 'title', 'content', 'editor_type',
|
||||||
'ip_address', 'is_notice', 'is_secret', 'views', 'status'
|
'ip_address', 'is_notice', 'is_secret', 'views', 'status',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function files() {
|
public function files()
|
||||||
|
{
|
||||||
return $this->morphMany(File::class, 'fileable');
|
return $this->morphMany(File::class, 'fileable');
|
||||||
}
|
}
|
||||||
public function comments() {
|
|
||||||
|
public function comments()
|
||||||
|
{
|
||||||
return $this->hasMany(BoardComment::class, 'post_id')->whereNull('parent_id')->where('status', 'active');
|
return $this->hasMany(BoardComment::class, 'post_id')->whereNull('parent_id')->where('status', 'active');
|
||||||
}
|
}
|
||||||
public function board() {
|
|
||||||
|
public function board()
|
||||||
|
{
|
||||||
return $this->belongsTo(Board::class, 'board_id');
|
return $this->belongsTo(Board::class, 'board_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,16 @@
|
|||||||
class PostCustomFieldValue extends Model
|
class PostCustomFieldValue extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'post_custom_field_values';
|
protected $table = 'post_custom_field_values';
|
||||||
|
|
||||||
protected $fillable = ['post_id', 'field_id', 'value'];
|
protected $fillable = ['post_id', 'field_id', 'value'];
|
||||||
|
|
||||||
public function post() {
|
public function post()
|
||||||
|
{
|
||||||
return $this->belongsTo(Post::class, 'post_id');
|
return $this->belongsTo(Post::class, 'post_id');
|
||||||
}
|
}
|
||||||
public function field() {
|
|
||||||
|
public function field()
|
||||||
|
{
|
||||||
return $this->belongsTo(BoardSetting::class, 'field_id');
|
return $this->belongsTo(BoardSetting::class, 'field_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Models\Calculation;
|
namespace App\Models\Calculation;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class CalculationConfig extends Model
|
class CalculationConfig extends Model
|
||||||
{
|
{
|
||||||
@@ -21,14 +21,14 @@ class CalculationConfig extends Model
|
|||||||
'description',
|
'description',
|
||||||
'is_active',
|
'is_active',
|
||||||
'created_by',
|
'created_by',
|
||||||
'updated_by'
|
'updated_by',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'parameters' => 'array',
|
'parameters' => 'array',
|
||||||
'conditions' => 'array',
|
'conditions' => 'array',
|
||||||
'validation_rules' => 'array',
|
'validation_rules' => 'array',
|
||||||
'is_active' => 'boolean'
|
'is_active' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,4 +99,4 @@ public static function getLatestFormula(int $tenantId, string $companyName, stri
|
|||||||
->latestVersion()
|
->latestVersion()
|
||||||
->first();
|
->first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,38 +9,61 @@
|
|||||||
|
|
||||||
class Category extends Model
|
class Category extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id','parent_id','code_group','code','name',
|
'tenant_id', 'parent_id', 'code_group', 'code', 'name',
|
||||||
'profile_code', // capability_profile 연결
|
'profile_code', // capability_profile 연결
|
||||||
'is_active','sort_order','description',
|
'is_active', 'sort_order', 'description',
|
||||||
'created_by','updated_by','deleted_by'
|
'created_by', 'updated_by', 'deleted_by',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'is_active' => 'boolean',
|
'is_active' => 'boolean',
|
||||||
'sort_order' => 'integer',
|
'sort_order' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
'deleted_by','deleted_at'
|
'deleted_by', 'deleted_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
// 계층
|
// 계층
|
||||||
public function parent() { return $this->belongsTo(self::class, 'parent_id'); }
|
public function parent()
|
||||||
public function children() { return $this->hasMany(self::class, 'parent_id'); }
|
{
|
||||||
|
return $this->belongsTo(self::class, 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function children()
|
||||||
|
{
|
||||||
|
return $this->hasMany(self::class, 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
// 카테고리의 제품들
|
// 카테고리의 제품들
|
||||||
public function products() { return $this->hasMany(\App\Models\Products\Product::class, 'category_id'); }
|
public function products()
|
||||||
|
{
|
||||||
|
return $this->hasMany(\App\Models\Products\Product::class, 'category_id');
|
||||||
|
}
|
||||||
|
|
||||||
// 카테고리 필드
|
// 카테고리 필드
|
||||||
public function categoryFields() { return $this->hasMany(CategoryField::class, 'category_id'); }
|
public function categoryFields()
|
||||||
|
{
|
||||||
|
return $this->hasMany(CategoryField::class, 'category_id');
|
||||||
|
}
|
||||||
|
|
||||||
// 태그(폴리모픽) — 이미 taggables 존재
|
// 태그(폴리모픽) — 이미 taggables 존재
|
||||||
public function tags() { return $this->morphToMany(\App\Models\Commons\Tag::class, 'taggable'); }
|
public function tags()
|
||||||
|
{
|
||||||
|
return $this->morphToMany(\App\Models\Commons\Tag::class, 'taggable');
|
||||||
|
}
|
||||||
|
|
||||||
// 스코프
|
// 스코프
|
||||||
public function scopeGroup($q, string $group) { return $q->where('code_group', $group); }
|
public function scopeGroup($q, string $group)
|
||||||
public function scopeCode($q, string $code) { return $q->where('code', $code); }
|
{
|
||||||
|
return $q->where('code_group', $group);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeCode($q, string $code)
|
||||||
|
{
|
||||||
|
return $q->where('code', $code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,21 +9,21 @@
|
|||||||
|
|
||||||
class CategoryField extends Model
|
class CategoryField extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'category_fields';
|
protected $table = 'category_fields';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id','category_id',
|
'tenant_id', 'category_id',
|
||||||
'field_key','field_name','field_type',
|
'field_key', 'field_name', 'field_type',
|
||||||
'is_required','sort_order','default_value','options','description',
|
'is_required', 'sort_order', 'default_value', 'options', 'description',
|
||||||
'created_by','updated_by','deleted_by',
|
'created_by', 'updated_by', 'deleted_by',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'is_required' => 'boolean',
|
'is_required' => 'boolean',
|
||||||
'sort_order' => 'integer',
|
'sort_order' => 'integer',
|
||||||
'options' => 'array',
|
'options' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function category()
|
public function category()
|
||||||
@@ -32,5 +32,8 @@ public function category()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 편의 스코프
|
// 편의 스코프
|
||||||
public function scopeRequired($q) { return $q->where('is_required', 1); }
|
public function scopeRequired($q)
|
||||||
|
{
|
||||||
|
return $q->where('is_required', 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,17 +11,18 @@ class CategoryLog extends Model
|
|||||||
use BelongsToTenant, ModelTrait;
|
use BelongsToTenant, ModelTrait;
|
||||||
|
|
||||||
protected $table = 'category_logs';
|
protected $table = 'category_logs';
|
||||||
|
|
||||||
public $timestamps = false; // changed_at 컬럼 단일 사용
|
public $timestamps = false; // changed_at 컬럼 단일 사용
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'category_id','tenant_id','action','changed_by','changed_at',
|
'category_id', 'tenant_id', 'action', 'changed_by', 'changed_at',
|
||||||
'before_json','after_json','remarks',
|
'before_json', 'after_json', 'remarks',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'changed_at' => 'datetime',
|
'changed_at' => 'datetime',
|
||||||
'before_json' => 'array',
|
'before_json' => 'array',
|
||||||
'after_json' => 'array',
|
'after_json' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function category()
|
public function category()
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ class CategoryTemplate extends Model
|
|||||||
protected $table = 'category_templates';
|
protected $table = 'category_templates';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id','category_id','version_no','template_json','applied_at',
|
'tenant_id', 'category_id', 'version_no', 'template_json', 'applied_at',
|
||||||
'created_by','updated_by','deleted_by','remarks',
|
'created_by', 'updated_by', 'deleted_by', 'remarks',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'version_no' => 'integer',
|
'version_no' => 'integer',
|
||||||
'template_json' => 'array',
|
'template_json' => 'array',
|
||||||
'applied_at' => 'datetime',
|
'applied_at' => 'datetime',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function category()
|
public function category()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
class Classification extends Model
|
class Classification extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, ModelTrait, BelongsToTenant;
|
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id',
|
'tenant_id',
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Models\Commons;
|
namespace App\Models\Commons;
|
||||||
|
|
||||||
|
use App\Models\Members\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use App\Models\Members\User;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @mixin IdeHelperFile
|
* @mixin IdeHelperFile
|
||||||
|
|||||||
@@ -2,18 +2,18 @@
|
|||||||
|
|
||||||
namespace App\Models\Commons;
|
namespace App\Models\Commons;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use App\Models\Scopes\TenantScope;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
use App\Traits\BelongsToTenant;
|
use App\Traits\BelongsToTenant;
|
||||||
use App\Traits\ModelTrait;
|
use App\Traits\ModelTrait;
|
||||||
use App\Models\Scopes\TenantScope;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @mixin IdeHelperMenu
|
* @mixin IdeHelperMenu
|
||||||
*/
|
*/
|
||||||
class Menu extends Model
|
class Menu extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id', 'parent_id', 'name', 'url', 'is_active', 'sort_order',
|
'tenant_id', 'parent_id', 'name', 'url', 'is_active', 'sort_order',
|
||||||
@@ -25,7 +25,7 @@ class Menu extends Model
|
|||||||
'created_by',
|
'created_by',
|
||||||
'updated_by',
|
'updated_by',
|
||||||
'deleted_by',
|
'deleted_by',
|
||||||
'deleted_at'
|
'deleted_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function parent()
|
public function parent()
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ public function tenant(): BelongsTo
|
|||||||
return $this->belongsTo(Tenant::class);
|
return $this->belongsTo(Tenant::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 제품(Product)와 연결 (N:M, 폴리모픽)
|
* 제품(Product)와 연결 (N:M, 폴리모픽)
|
||||||
*/
|
*/
|
||||||
@@ -47,5 +46,4 @@ public function materials(): MorphToMany
|
|||||||
{
|
{
|
||||||
return $this->morphedByMany(Material::class, 'taggable');
|
return $this->morphedByMany(Material::class, 'taggable');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ class BomTemplate extends Model
|
|||||||
protected $table = 'bom_templates';
|
protected $table = 'bom_templates';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id','model_version_id','name','is_primary','notes',
|
'tenant_id', 'model_version_id', 'name', 'is_primary', 'notes',
|
||||||
'calculation_schema','company_type','formula_version',
|
'calculation_schema', 'company_type', 'formula_version',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -21,11 +21,13 @@ class BomTemplate extends Model
|
|||||||
'calculation_schema' => 'array',
|
'calculation_schema' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function modelVersion() {
|
public function modelVersion()
|
||||||
|
{
|
||||||
return $this->belongsTo(ModelVersion::class, 'model_version_id');
|
return $this->belongsTo(ModelVersion::class, 'model_version_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function items() {
|
public function items()
|
||||||
|
{
|
||||||
return $this->hasMany(BomTemplateItem::class, 'bom_template_id');
|
return $this->hasMany(BomTemplateItem::class, 'bom_template_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ class BomTemplateItem extends Model
|
|||||||
protected $table = 'bom_template_items';
|
protected $table = 'bom_template_items';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id','bom_template_id','ref_type','ref_id','qty','waste_rate','uom_id','notes','sort_order',
|
'tenant_id', 'bom_template_id', 'ref_type', 'ref_id', 'qty', 'waste_rate', 'uom_id', 'notes', 'sort_order',
|
||||||
'is_calculated','calculation_formula','depends_on','calculation_config',
|
'is_calculated', 'calculation_formula', 'depends_on', 'calculation_config',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -21,7 +21,8 @@ class BomTemplateItem extends Model
|
|||||||
'calculation_config' => 'array',
|
'calculation_config' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function template() {
|
public function template()
|
||||||
|
{
|
||||||
return $this->belongsTo(BomTemplate::class, 'bom_template_id');
|
return $this->belongsTo(BomTemplate::class, 'bom_template_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class DesignModel extends Model
|
|||||||
protected $table = 'models';
|
protected $table = 'models';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id','code','name','category_id','lifecycle','description','is_active',
|
'tenant_id', 'code', 'name', 'category_id', 'lifecycle', 'description', 'is_active',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -20,7 +20,8 @@ class DesignModel extends Model
|
|||||||
];
|
];
|
||||||
|
|
||||||
// 관계: 모델은 여러 버전을 가짐
|
// 관계: 모델은 여러 버전을 가짐
|
||||||
public function versions() {
|
public function versions()
|
||||||
|
{
|
||||||
return $this->hasMany(ModelVersion::class, 'model_id');
|
return $this->hasMany(ModelVersion::class, 'model_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class ModelVersion extends Model
|
|||||||
protected $table = 'model_versions';
|
protected $table = 'model_versions';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id','model_id','version_no','status','effective_from','effective_to','notes','is_active',
|
'tenant_id', 'model_id', 'version_no', 'status', 'effective_from', 'effective_to', 'notes', 'is_active',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -21,15 +21,18 @@ class ModelVersion extends Model
|
|||||||
'effective_to' => 'datetime',
|
'effective_to' => 'datetime',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function model() {
|
public function model()
|
||||||
|
{
|
||||||
return $this->belongsTo(DesignModel::class, 'model_id');
|
return $this->belongsTo(DesignModel::class, 'model_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bomTemplates() {
|
public function bomTemplates()
|
||||||
|
{
|
||||||
return $this->hasMany(BomTemplate::class, 'model_version_id');
|
return $this->hasMany(BomTemplate::class, 'model_version_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeReleased($q) {
|
public function scopeReleased($q)
|
||||||
|
{
|
||||||
return $q->where('status', 'RELEASED');
|
return $q->where('status', 'RELEASED');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
class Estimate extends Model
|
class Estimate extends Model
|
||||||
{
|
{
|
||||||
use HasFactory, SoftDeletes, BelongsToTenant;
|
use BelongsToTenant, HasFactory, SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id',
|
'tenant_id',
|
||||||
@@ -75,7 +75,7 @@ public static function generateEstimateNo(int $tenantId): string
|
|||||||
|
|
||||||
$sequence = $lastEstimate ? (int) substr($lastEstimate->estimate_no, -3) + 1 : 1;
|
$sequence = $lastEstimate ? (int) substr($lastEstimate->estimate_no, -3) + 1 : 1;
|
||||||
|
|
||||||
return $prefix . $date . str_pad($sequence, 3, '0', STR_PAD_LEFT);
|
return $prefix.$date.str_pad($sequence, 3, '0', STR_PAD_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,6 +102,6 @@ public function scopeApproved($query)
|
|||||||
public function scopeExpired($query)
|
public function scopeExpired($query)
|
||||||
{
|
{
|
||||||
return $query->whereNotNull('valid_until')
|
return $query->whereNotNull('valid_until')
|
||||||
->where('valid_until', '<', now());
|
->where('valid_until', '<', now());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
class EstimateItem extends Model
|
class EstimateItem extends Model
|
||||||
{
|
{
|
||||||
use HasFactory, SoftDeletes, BelongsToTenant;
|
use BelongsToTenant, HasFactory, SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id',
|
'tenant_id',
|
||||||
@@ -77,4 +77,4 @@ protected static function boot()
|
|||||||
$item->total_price = $item->calculateTotalPrice();
|
$item->total_price = $item->calculateTotalPrice();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,12 +42,12 @@ public function flows(): HasMany
|
|||||||
*/
|
*/
|
||||||
public function estimates()
|
public function estimates()
|
||||||
{
|
{
|
||||||
//return $this->hasMany(MainRequestEstimate::class, 'main_request_id');
|
// return $this->hasMany(MainRequestEstimate::class, 'main_request_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function orders()
|
public function orders()
|
||||||
{
|
{
|
||||||
//return $this->hasMany(MainRequestOrder::class, 'main_request_id');
|
// return $this->hasMany(MainRequestOrder::class, 'main_request_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... 필요에 따라 파생 업무별 hasMany 관계 추가
|
// ... 필요에 따라 파생 업무별 hasMany 관계 추가
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Models\MainRequest;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||||
|
|||||||
@@ -5,9 +5,8 @@
|
|||||||
use App\Models\Commons\File;
|
use App\Models\Commons\File;
|
||||||
use App\Models\Commons\Tag;
|
use App\Models\Commons\Tag;
|
||||||
use App\Models\Qualitys\Lot;
|
use App\Models\Qualitys\Lot;
|
||||||
use App\Traits\ModelTrait;
|
|
||||||
use App\Traits\BelongsToTenant;
|
use App\Traits\BelongsToTenant;
|
||||||
use Filament\Forms\Components\Hidden;
|
use App\Traits\ModelTrait;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
class Material extends Model
|
class Material extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, ModelTrait, BelongsToTenant;
|
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id',
|
'tenant_id',
|
||||||
@@ -37,7 +36,7 @@ class Material extends Model
|
|||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'attributes' => 'array',
|
'attributes' => 'array',
|
||||||
'options' => 'array',
|
'options' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class MaterialReceipt extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'material_id', 'receipt_date', 'lot_number', 'received_qty', 'unit',
|
'material_id', 'receipt_date', 'lot_number', 'received_qty', 'unit',
|
||||||
'supplier_name', 'manufacturer_name', 'purchase_price_excl_vat',
|
'supplier_name', 'manufacturer_name', 'purchase_price_excl_vat',
|
||||||
'weight_kg', 'status_code', 'is_inspection', 'inspection_date', 'remarks'
|
'weight_kg', 'status_code', 'is_inspection', 'inspection_date', 'remarks',
|
||||||
];
|
];
|
||||||
|
|
||||||
// 자재 마스터
|
// 자재 마스터
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use HasApiTokens, Notifiable, SoftDeletes, ModelTrait, HasRoles;
|
use HasApiTokens, HasRoles, ModelTrait, Notifiable, SoftDeletes;
|
||||||
|
|
||||||
protected $guard_name = 'api'; // ★ 중요: 권한/역할 가드 통일
|
protected $guard_name = 'api'; // ★ 중요: 권한/역할 가드 통일
|
||||||
|
|
||||||
@@ -33,10 +33,10 @@ class User extends Authenticatable
|
|||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'email_verified_at' => 'datetime',
|
'email_verified_at' => 'datetime',
|
||||||
'last_login_at' => 'datetime',
|
'last_login_at' => 'datetime',
|
||||||
'options' => 'array',
|
'options' => 'array',
|
||||||
'deleted_at' => 'datetime',
|
'deleted_at' => 'datetime',
|
||||||
'password' => 'hashed', // ← 이걸 쓰면 자동 해싱
|
'password' => 'hashed', // ← 이걸 쓰면 자동 해싱
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
class UserMenuPermission extends Model
|
class UserMenuPermission extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id', 'menu_id', 'access', 'read', 'write', 'export', 'approve'
|
'user_id', 'menu_id', 'access', 'read', 'write', 'export', 'approve',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
*/
|
*/
|
||||||
class UserRole extends Model
|
class UserRole extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, BelongsToTenant;
|
use BelongsToTenant, SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id', 'tenant_id', 'role_id', 'assigned_at'
|
'user_id', 'tenant_id', 'role_id', 'assigned_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
*/
|
*/
|
||||||
class UserTenant extends Model
|
class UserTenant extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, ModelTrait, BelongsToTenant;
|
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id', 'tenant_id', 'is_active', 'is_default', 'joined_at', 'left_at'
|
'user_id', 'tenant_id', 'is_active', 'is_default', 'joined_at', 'left_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $guarded = [
|
protected $guarded = [
|
||||||
@@ -27,11 +27,11 @@ class UserTenant extends Model
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'joined_at' => 'datetime',
|
'joined_at' => 'datetime',
|
||||||
'left_at' => 'datetime',
|
'left_at' => 'datetime',
|
||||||
'created_at' => 'datetime',
|
'created_at' => 'datetime',
|
||||||
'updated_at' => 'datetime',
|
'updated_at' => 'datetime',
|
||||||
'deleted_at' => 'datetime',
|
'deleted_at' => 'datetime',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Order extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id', 'order_no', 'order_type_code', 'status_code', 'category_code', 'product_id',
|
'tenant_id', 'order_no', 'order_type_code', 'status_code', 'category_code', 'product_id',
|
||||||
'received_at', 'writer_id', 'client_id', 'client_contact', 'site_name', 'quantity', 'delivery_date',
|
'received_at', 'writer_id', 'client_id', 'client_contact', 'site_name', 'quantity', 'delivery_date',
|
||||||
'delivery_method_code', 'memo'
|
'delivery_method_code', 'memo',
|
||||||
];
|
];
|
||||||
|
|
||||||
// 상세(라인)
|
// 상세(라인)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class OrderHistory extends Model
|
|||||||
protected $table = 'order_histories';
|
protected $table = 'order_histories';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id', 'order_id', 'history_type', 'content', 'created_by'
|
'tenant_id', 'order_id', 'history_type', 'content', 'created_by',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function order()
|
public function order()
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class OrderItem extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id', 'order_id', 'serial_no', 'product_id', 'quantity',
|
'tenant_id', 'order_id', 'serial_no', 'product_id', 'quantity',
|
||||||
'status_code', 'design_code', 'remarks', 'attributes'
|
'status_code', 'design_code', 'remarks', 'attributes',
|
||||||
];
|
];
|
||||||
|
|
||||||
// 투입 구성(자재/BOM 등)
|
// 투입 구성(자재/BOM 등)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class OrderItemComponent extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id', 'order_item_id', 'component_type', 'component_id', 'quantity',
|
'tenant_id', 'order_item_id', 'component_type', 'component_id', 'quantity',
|
||||||
'unit', 'price', 'remarks', 'created_by', 'updated_by'
|
'unit', 'price', 'remarks', 'created_by', 'updated_by',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function orderItem()
|
public function orderItem()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class OrderVersion extends Model
|
|||||||
protected $table = 'order_versions';
|
protected $table = 'order_versions';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id', 'order_id', 'version_no', 'version_type', 'status_code', 'changed_fields', 'created_by', 'change_note'
|
'tenant_id', 'order_id', 'version_no', 'version_type', 'status_code', 'changed_fields', 'created_by', 'change_note',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function order()
|
public function order()
|
||||||
|
|||||||
@@ -17,4 +17,4 @@ public function tenant()
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(Tenant::class);
|
return $this->belongsTo(Tenant::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,15 +11,16 @@ class PermissionOverride extends Model
|
|||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'permission_overrides';
|
protected $table = 'permission_overrides';
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'tenant_id' => 'int',
|
'tenant_id' => 'int',
|
||||||
'model_id' => 'int',
|
'model_id' => 'int',
|
||||||
'permission_id' => 'int',
|
'permission_id' => 'int',
|
||||||
'effect' => 'int', // 1=ALLOW, -1=DENY
|
'effect' => 'int', // 1=ALLOW, -1=DENY
|
||||||
'effective_from' => 'datetime',
|
'effective_from' => 'datetime',
|
||||||
'effective_to' => 'datetime',
|
'effective_to' => 'datetime',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
class Role extends Model
|
class Role extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tenant_id', 'name', 'description'
|
'tenant_id', 'name', 'description',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function menuPermissions()
|
public function menuPermissions()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
class RoleMenuPermission extends Model
|
class RoleMenuPermission extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'role_id', 'menu_id', 'access', 'read', 'write', 'export', 'approve'
|
'role_id', 'menu_id', 'access', 'read', 'write', 'export', 'approve',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function role()
|
public function role()
|
||||||
|
|||||||
@@ -2,16 +2,17 @@
|
|||||||
|
|
||||||
namespace App\Models\Products;
|
namespace App\Models\Products;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
use App\Traits\BelongsToTenant;
|
use App\Traits\BelongsToTenant;
|
||||||
use App\Traits\ModelTrait;
|
use App\Traits\ModelTrait;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @mixin IdeHelperCommonCode
|
* @mixin IdeHelperCommonCode
|
||||||
*/
|
*/
|
||||||
class CommonCode extends Model
|
class CommonCode extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'common_codes';
|
protected $table = 'common_codes';
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ class CommonCode extends Model
|
|||||||
'attributes',
|
'attributes',
|
||||||
'description',
|
'description',
|
||||||
'is_active',
|
'is_active',
|
||||||
'sort_order'
|
'sort_order',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user