chore(API): Seeder 파일 정리

- Dummy Seeder 파일들 정리 및 개선
- ApprovalTestDataSeeder 수정
- PositionSeeder, StockReceivingSeeder 수정

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-01-13 19:49:28 +09:00
parent 1044b57e15
commit be90c351fa
23 changed files with 206 additions and 154 deletions

View File

@@ -2,9 +2,9 @@
namespace Database\Seeders;
use Carbon\Carbon;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Carbon\Carbon;
class ApprovalTestDataSeeder extends Seeder
{
@@ -29,6 +29,7 @@ public function run(): void
->toArray();
if (count($users) < 3) {
$this->command->error('최소 3명의 사용자가 필요합니다.');
return;
}
@@ -65,7 +66,7 @@ private function createApprovalForms(int $tenantId, int $userId, Carbon $now): a
['name' => 'description', 'type' => 'textarea', 'label' => '내용', 'required' => true],
['name' => 'reason', 'type' => 'textarea', 'label' => '사유', 'required' => true],
['name' => 'estimatedCost', 'type' => 'number', 'label' => '예상비용', 'required' => false],
]
],
]),
'is_active' => true,
'created_by' => $userId,
@@ -83,7 +84,7 @@ private function createApprovalForms(int $tenantId, int $userId, Carbon $now): a
['name' => 'paymentDate', 'type' => 'date', 'label' => '지급일', 'required' => true],
['name' => 'items', 'type' => 'array', 'label' => '지출항목', 'required' => true],
['name' => 'totalAmount', 'type' => 'number', 'label' => '총액', 'required' => true],
]
],
]),
'is_active' => true,
'created_by' => $userId,
@@ -100,7 +101,7 @@ private function createApprovalForms(int $tenantId, int $userId, Carbon $now): a
['name' => 'items', 'type' => 'array', 'label' => '비용항목', 'required' => true],
['name' => 'totalExpense', 'type' => 'number', 'label' => '총지출', 'required' => true],
['name' => 'accountBalance', 'type' => 'number', 'label' => '계좌잔액', 'required' => true],
]
],
]),
'is_active' => true,
'created_by' => $userId,
@@ -144,12 +145,12 @@ private function createApprovals(
];
$expenseItems = [
'교통비', '식비', '숙박비', '소모품비', '통신비', '유류비', '접대비', '회의비'
'교통비', '식비', '숙박비', '소모품비', '통신비', '유류비', '접대비', '회의비',
];
$vendors = [
'삼성전자', 'LG전자', 'SK하이닉스', '현대자동차', '네이버', '카카오',
'쿠팡', '배달의민족', '토스', '당근마켓'
'쿠팡', '배달의민족', '토스', '당근마켓',
];
$docNumber = 1;
@@ -223,7 +224,7 @@ private function createApprovals(
$formId = $forms[$formCode];
$drafter = $i < 3 ? $approver1 : $approver2;
$title = '추가 결재 요청 문서 ' . ($i + 1);
$title = '추가 결재 요청 문서 '.($i + 1);
$content = $this->generateContent($formCode, $title, $vendors, $expenseItems);
$approvalId = DB::table('approvals')->insertGetId([
@@ -262,7 +263,7 @@ private function generateContent(string $formCode, string $title, array $vendors
'title' => $title,
'vendor' => $vendors[array_rand($vendors)],
'vendorPaymentDate' => Carbon::now()->addDays(rand(7, 30))->format('Y-m-d'),
'description' => $title . '에 대한 상세 설명입니다. 업무 효율성 향상과 비용 절감을 위해 필요합니다.',
'description' => $title.'에 대한 상세 설명입니다. 업무 효율성 향상과 비용 절감을 위해 필요합니다.',
'reason' => '업무 효율성 향상 및 경쟁력 강화를 위해 필수적으로 진행해야 합니다.',
'estimatedCost' => rand(100, 5000) * 10000,
];
@@ -280,11 +281,12 @@ private function generateContent(string $formCode, string $title, array $vendors
'note' => '업무 관련 지출',
];
}
return [
'requestDate' => Carbon::now()->subDays(rand(1, 7))->format('Y-m-d'),
'paymentDate' => Carbon::now()->addDays(rand(1, 14))->format('Y-m-d'),
'items' => $items,
'cardId' => 'CARD-' . rand(1000, 9999),
'cardId' => 'CARD-'.rand(1000, 9999),
'totalAmount' => $total,
];
@@ -304,6 +306,7 @@ private function generateContent(string $formCode, string $title, array $vendors
'checked' => false,
];
}
return [
'items' => $items,
'totalExpense' => $total,