Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ spring:
- classpath:sql/00-truncate.sql
- classpath:sql/01-insert-internal-users.sql
- classpath:sql/02-insert-external-users.sql
- classpath:sql/03-insert-workflow.sql
encoding: UTF-8

mybatis:
Expand Down
22 changes: 21 additions & 1 deletion apps/user-service/src/main/resources/sql/01-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,24 @@ CREATE TABLE `task_run` (
INDEX `idx_task_run_job_run_id` (`job_run_id`),
INDEX `idx_task_run_status` (`status`),
INDEX `idx_task_run_task_id` (`task_id`)
);
);

-- v0.0.3
DROP TABLE IF EXISTS `config`;

ALTER TABLE `workflow_job`
ADD COLUMN `execution_order` INT NULL AFTER `job_id`;


ALTER TABLE `schedule`
ADD COLUMN `schedule_text` varchar(20) NULL;

ALTER TABLE `workflow`
ADD COLUMN `default_config`json NULL;


ALTER TABLE `user`
ADD COLUMN `joined_at` timestamp NULL;

ALTER TABLE `department`
ADD COLUMN `description` varchar(100) NULL;
120 changes: 120 additions & 0 deletions apps/user-service/src/main/resources/sql/03-insert-workflow.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
-- ์›Œํฌํ”Œ๋กœ์šฐ ๊ด€๋ จ ๋ฐ์ดํ„ฐ ์‚ฝ์ž…

-- ์นดํ…Œ๊ณ ๋ฆฌ ์‚ฝ์ž…
INSERT INTO `category` (`name`, `description`) VALUES
('๋งˆ์ผ€ํŒ…', '๋งˆ์ผ€ํŒ… ๊ด€๋ จ ์ž๋™ํ™” ์›Œํฌํ”Œ๋กœ์šฐ'),
('์ฝ˜ํ…์ธ ', '์ฝ˜ํ…์ธ  ์ƒ์„ฑ ๋ฐ ๊ด€๋ฆฌ'),
('๋ฐ์ดํ„ฐ ์ˆ˜์ง‘', '์›น ํฌ๋กค๋ง ๋ฐ ๋ฐ์ดํ„ฐ ์ˆ˜์ง‘ ๊ด€๋ จ');

-- ์›Œํฌํ”Œ๋กœ์šฐ ์ƒ์„ฑ
INSERT INTO `workflow` (`name`, `description`, `is_enabled`, `created_by`) VALUES
('ํŠธ๋ Œ๋“œ_๋ธ”๋กœ๊ทธ_์ž๋™ํ™”', 'ํŠธ๋ Œ๋“œ ๊ฒ€์ƒ‰๋ถ€ํ„ฐ ๋ธ”๋กœ๊ทธ ๊ธ€ ์ž‘์„ฑ๊นŒ์ง€ ์ „์ฒด ์ž๋™ํ™” ํ”„๋กœ์„ธ์Šค', TRUE, 1);

-- Job ์ƒ์„ฑ
INSERT INTO `job` (`name`, `description`, `is_enabled`, `created_by`) VALUES
('ํŠธ๋ Œ๋“œ_๊ฒ€์ƒ‰_์ž‘์—…', '์ตœ์‹  ํŠธ๋ Œ๋“œ ํ‚ค์›Œ๋“œ ๊ฒ€์ƒ‰ ๋ฐ ๋ถ„์„', TRUE, 1),
('์‹ธ๋‹ค๊ตฌ_ํฌ๋กค๋ง_์ž‘์—…', '์‹ธ๋‹ค๊ตฌ ์‚ฌ์ดํŠธ์—์„œ ๊ด€๋ จ ์ƒํ’ˆ ์ •๋ณด ํฌ๋กค๋ง', TRUE, 1),
('๋ธ”๋กœ๊ทธ_๊ธ€_์ž‘์„ฑ_์ž‘์—…', '์ˆ˜์ง‘๋œ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๋ธ”๋กœ๊ทธ ๊ธ€ ์ž๋™ ์ƒ์„ฑ', TRUE, 1);

-- Task ์ƒ์„ฑ
INSERT INTO `task` (`name`, `type`, `parameters`) VALUES
-- ํŠธ๋ Œ๋“œ ๊ฒ€์ƒ‰ ๊ด€๋ จ ํƒœ์Šคํฌ
('๊ตฌ๊ธ€_ํŠธ๋ Œ๋“œ_๊ฒ€์ƒ‰', 'API_CALL', JSON_OBJECT(
'api_endpoint', 'https://trends.googleapis.com/trends/api',
'search_region', 'KR',
'timeframe', 'now 7-d',
'category', '0'
)),
('๋„ค์ด๋ฒ„_ํŠธ๋ Œ๋“œ_๊ฒ€์ƒ‰', 'API_CALL', JSON_OBJECT(
'api_endpoint', 'https://datalab.naver.com/keyword/trendSearch.naver',
'period', 'week',
'device', 'pc'
)),
('ํ‚ค์›Œ๋“œ_๋ถ„์„_๋ฐ_ํ•„ํ„ฐ๋ง', 'DATA_PROCESSING', JSON_OBJECT(
'min_score', 50,
'max_keywords', 10,
'filter_rules', JSON_ARRAY('adult_content', 'spam_keywords')
)),

-- ์‹ธ๋‹ค๊ตฌ ํฌ๋กค๋ง ๊ด€๋ จ ํƒœ์Šคํฌ
('์‹ธ๋‹ค๊ตฌ_์ƒํ’ˆ_๊ฒ€์ƒ‰', 'WEB_SCRAPING', JSON_OBJECT(
'base_url', 'https://www.ssg.com',
'search_path', '/search.ssg',
'max_pages', 3,
'delay_ms', 2000
)),
('์ƒํ’ˆ_์ •๋ณด_์ถ”์ถœ', 'DATA_EXTRACTION', JSON_OBJECT(
'extract_fields', JSON_ARRAY('title', 'price', 'rating', 'review_count', 'image_url'),
'data_validation', true
)),
('๊ฐ€๊ฒฉ_๋น„๊ต_๋ถ„์„', 'DATA_ANALYSIS', JSON_OBJECT(
'comparison_sites', JSON_ARRAY('์ฟ ํŒก', '11๋ฒˆ๊ฐ€', '์˜ฅ์…˜'),
'price_threshold', 0.1
)),

-- ๋ธ”๋กœ๊ทธ ๊ธ€ ์ž‘์„ฑ ๊ด€๋ จ ํƒœ์Šคํฌ
('๋ธ”๋กœ๊ทธ_ํ…œํ”Œ๋ฆฟ_์„ ํƒ', 'TEMPLATE_PROCESSING', JSON_OBJECT(
'template_type', 'product_review',
'style', 'conversational',
'target_length', 1500
)),
('AI_์ฝ˜ํ…์ธ _์ƒ์„ฑ', 'AI_GENERATION', JSON_OBJECT(
'model', 'gpt-4',
'temperature', 0.7,
'max_tokens', 2000,
'prompt_template', 'ํŠธ๋ Œ๋“œ ํ‚ค์›Œ๋“œ์™€ ์ƒํ’ˆ ์ •๋ณด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ž์—ฐ์Šค๋Ÿฌ์šด ๋ธ”๋กœ๊ทธ ๊ธ€์„ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”.'
)),
('์ฝ˜ํ…์ธ _๊ฒ€์ˆ˜_๋ฐ_์ตœ์ ํ™”', 'CONTENT_REVIEW', JSON_OBJECT(
'seo_optimization', true,
'readability_check', true,
'plagiarism_check', true
)),
('๋ธ”๋กœ๊ทธ_ํ”Œ๋žซํผ_๋ฐœํ–‰', 'PUBLISHING', JSON_OBJECT(
'platforms', JSON_ARRAY('๋„ค์ด๋ฒ„ ๋ธ”๋กœ๊ทธ', 'ํ‹ฐ์Šคํ† ๋ฆฌ', '๋ธŒ๋Ÿฐ์น˜'),
'schedule_publish', false,
'auto_tags', true
));

-- ์›Œํฌํ”Œ๋กœ์šฐ-Job ์—ฐ๊ฒฐ
INSERT INTO `workflow_job` (`workflow_id`, `job_id`) VALUES
(1, 1), -- ํŠธ๋ Œ๋“œ_๋ธ”๋กœ๊ทธ_์ž๋™ํ™” + ํŠธ๋ Œ๋“œ_๊ฒ€์ƒ‰_์ž‘์—…
(1, 2), -- ํŠธ๋ Œ๋“œ_๋ธ”๋กœ๊ทธ_์ž๋™ํ™” + ์‹ธ๋‹ค๊ตฌ_ํฌ๋กค๋ง_์ž‘์—…
(1, 3); -- ํŠธ๋ Œ๋“œ_๋ธ”๋กœ๊ทธ_์ž๋™ํ™” + ๋ธ”๋กœ๊ทธ_๊ธ€_์ž‘์„ฑ_์ž‘์—…

-- Job-Task ์—ฐ๊ฒฐ (์‹คํ–‰ ์ˆœ์„œ ํฌํ•จ)
-- ํŠธ๋ Œ๋“œ ๊ฒ€์ƒ‰ ์ž‘์—…์˜ ํƒœ์Šคํฌ๋“ค
INSERT INTO `job_task` (`job_id`, `task_id`, `execution_order`) VALUES
(1, 1, 1), -- ๊ตฌ๊ธ€_ํŠธ๋ Œ๋“œ_๊ฒ€์ƒ‰
(1, 2, 2), -- ๋„ค์ด๋ฒ„_ํŠธ๋ Œ๋“œ_๊ฒ€์ƒ‰
(1, 3, 3); -- ํ‚ค์›Œ๋“œ_๋ถ„์„_๋ฐ_ํ•„ํ„ฐ๋ง

-- ์‹ธ๋‹ค๊ตฌ ํฌ๋กค๋ง ์ž‘์—…์˜ ํƒœ์Šคํฌ๋“ค
INSERT INTO `job_task` (`job_id`, `task_id`, `execution_order`) VALUES
(2, 4, 1), -- ์‹ธ๋‹ค๊ตฌ_์ƒํ’ˆ_๊ฒ€์ƒ‰
(2, 5, 2), -- ์ƒํ’ˆ_์ •๋ณด_์ถ”์ถœ
(2, 6, 3); -- ๊ฐ€๊ฒฉ_๋น„๊ต_๋ถ„์„

-- ๋ธ”๋กœ๊ทธ ๊ธ€ ์ž‘์„ฑ ์ž‘์—…์˜ ํƒœ์Šคํฌ๋“ค
INSERT INTO `job_task` (`job_id`, `task_id`, `execution_order`) VALUES
(3, 7, 1), -- ๋ธ”๋กœ๊ทธ_ํ…œํ”Œ๋ฆฟ_์„ ํƒ
(3, 8, 2), -- AI_์ฝ˜ํ…์ธ _์ƒ์„ฑ
(3, 9, 3), -- ์ฝ˜ํ…์ธ _๊ฒ€์ˆ˜_๋ฐ_์ตœ์ ํ™”
(3, 10, 4); -- ๋ธ”๋กœ๊ทธ_ํ”Œ๋žซํผ_๋ฐœํ–‰

-- ์Šค์ผ€์ค„ ์„ค์ • (๋งค์ผ ์˜ค์ „ 8์‹œ ์‹คํ–‰)
INSERT INTO `schedule` (`workflow_id`, `cron_expression`, `parameters`, `is_active`, `created_by`) VALUES
(1, '0 0 8 * * *', JSON_OBJECT(
'timezone', 'Asia/Seoul',
'retry_count', 3,
'timeout_minutes', 60,
'notification_email', 'admin@icebang.site'
), TRUE, 1);

-- ์‚ฌ์šฉ์ž๋ณ„ ์„ค์ • (๊ด€๋ฆฌ์ž์šฉ)
INSERT INTO `user_config` (`user_id`, `type`, `name`, `json`, `is_active`) VALUES
(1, 'workflow_preference', 'ํŠธ๋ Œ๋“œ_๋ธ”๋กœ๊ทธ_์„ค์ •', JSON_OBJECT(
'preferred_keywords', JSON_ARRAY('ํ…Œํฌ', 'IT', 'ํŠธ๋ Œ๋“œ', '๋ฆฌ๋ทฐ'),
'blog_style', 'casual',
'auto_publish', false,
'notification_enabled', true
), TRUE);
Loading