# Bilingual Enterprise News Implementation Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** Update enterprise news APIs to store, filter, and return Chinese and English article fields without maintaining legacy content fields. **Architecture:** Keep the existing DSPY endpoint structure and database table. Add and update endpoints write the eight language-specific columns; search and detail endpoints return those columns directly. Shared publication, image, date, status, and read-count behavior remains unchanged. **Tech Stack:** DSPY Python endpoints, async DBPools/sor database access, MySQL. --- ### Task 1: Add and update bilingual content **Files:** - Modify: `b/news/news_article_add.dspy` - Modify: `b/news/news_article_update.dspy` - [ ] **Step 1: Update add validation** Replace the legacy `title` requirement with: ```python if not ns.get('title_zh'): return { 'status': False, 'msg': '请传递中文标题' } ``` - [ ] **Step 2: Update add insert fields** Write these fields in `ns_dic`: ```python 'title_zh': ns.get('title_zh'), 'title_en': ns.get('title_en'), 'article_type_zh': ns.get('article_type_zh'), 'article_type_en': ns.get('article_type_en'), 'summary_zh': ns.get('summary_zh'), 'summary_en': ns.get('summary_en'), 'content_zh': ns.get('content_zh'), 'content_en': ns.get('content_en'), ``` Do not write `title`, `article_type`, `summary`, or `content`. - [ ] **Step 3: Update editable fields** In `news_article_update.dspy`, loop through the eight bilingual fields and copy only keys present in `ns`: ```python for field in [ 'title_zh', 'title_en', 'article_type_zh', 'article_type_en', 'summary_zh', 'summary_en', 'content_zh', 'content_en' ]: if field in ns: ns_dic[field] = ns.get(field) ``` - [ ] **Step 4: Verify static diagnostics** Run IDE lint diagnostics for both files. Expected: no new errors. ### Task 2: Update backend search and detail **Files:** - Modify: `b/news/news_article_search.dspy` - Verify: `b/news/news_article_detail.dspy` - [ ] **Step 1: Add bilingual filters** Build optional conditions for exact type matching and fuzzy title matching: ```python if ns.get('title_zh'): conditions.append("title_zh like '%%%%%s%%%%'" % ns.get('title_zh')) if ns.get('title_en'): conditions.append("title_en like '%%%%%s%%%%'" % ns.get('title_en')) if ns.get('article_type_zh'): conditions.append("article_type_zh = '%s'" % ns.get('article_type_zh')) if ns.get('article_type_en'): conditions.append("article_type_en = '%s'" % ns.get('article_type_en')) ``` - [ ] **Step 2: Return bilingual list fields** Select: ```sql id, domain_name, title_zh, title_en, article_type_zh, article_type_en, summary_zh, summary_en, content_zh, content_en, cover_img, status, publish_time, read_count, update_time, create_at ``` - [ ] **Step 3: Return bilingual type summaries** Aggregate Chinese and English article types separately and return: ```python 'article_type_summary_zh': article_type_summary_zh, 'article_type_summary_en': article_type_summary_en, ``` Each item keeps `article_type`, `article_count`, and `read_count`. - [ ] **Step 4: Verify backend detail** `news_article_detail.dspy` already uses `select *`; confirm it returns the new columns without changing publication behavior. - [ ] **Step 5: Verify static diagnostics** Run IDE lint diagnostics for backend search and detail. Expected: no new errors. ### Task 3: Update frontend search and detail **Files:** - Modify: `b/news/front_news_search.dspy` - Modify: `b/news/front_news_detail.dspy` - [ ] **Step 1: Add bilingual frontend filters** Support `title_zh`, `title_en`, `article_type_zh`, and `article_type_en` using the same matching rules as backend search. - [ ] **Step 2: Return bilingual frontend list fields** Select: ```sql id, title_zh, title_en, article_type_zh, article_type_en, summary_zh, summary_en, cover_img, publish_time, read_count ``` - [ ] **Step 3: Return bilingual frontend detail fields** After incrementing `read_count`, select: ```sql id, title_zh, title_en, article_type_zh, article_type_en, summary_zh, summary_en, cover_img, content_zh, content_en, publish_time, read_count ``` - [ ] **Step 4: Verify publication and read-count behavior** Confirm both frontend queries retain `status = '1' AND del_flg = '0'`, and detail still increments `read_count` once. - [ ] **Step 5: Verify static diagnostics** Run IDE lint diagnostics for both frontend files. Expected: no new errors. ### Task 4: Final verification **Files:** - Verify: `b/news/news_article_add.dspy` - Verify: `b/news/news_article_update.dspy` - Verify: `b/news/news_article_search.dspy` - Verify: `b/news/news_article_detail.dspy` - Verify: `b/news/front_news_search.dspy` - Verify: `b/news/front_news_detail.dspy` - [ ] **Step 1: Check legacy-field removal** Search the six endpoints for writes or selected output fields named exactly `title`, `article_type`, `summary`, or `content`. Expected: none except comments or compatibility-neutral code. - [ ] **Step 2: Check diff scope** Run: ```powershell git diff -- b/news ``` Expected: only the requested bilingual endpoint changes plus the user's existing SQL schema update. - [ ] **Step 3: Check whitespace** Run: ```powershell git diff --check -- b/news ``` Expected: no output and exit code 0.