(
&self,
input: NewCommentTaskInput,
)
| 287 | } |
| 288 | |
| 289 | pub async fn create_comment_task( |
| 290 | &self, |
| 291 | input: NewCommentTaskInput, |
| 292 | ) -> Result<CommentTaskRecord> { |
| 293 | let now = now_ms(); |
| 294 | let record = CommentTaskRecord { |
| 295 | task_id: input.task_id, |
| 296 | article_id: input.article_id, |
| 297 | entry_type: input.entry_type, |
| 298 | status: COMMENT_STATUS_PENDING.to_string(), |
| 299 | comment_text: input.comment_text, |
| 300 | selected_text: normalize_optional_text(input.selected_text), |
| 301 | anchor_block_id: normalize_optional_text(input.anchor_block_id), |
| 302 | anchor_context_before: normalize_optional_text(input.anchor_context_before), |
| 303 | anchor_context_after: normalize_optional_text(input.anchor_context_after), |
| 304 | reply_to_comment_id: normalize_optional_text(input.reply_to_comment_id), |
| 305 | reply_to_comment_text: normalize_optional_text(input.reply_to_comment_text), |
| 306 | reply_to_ai_reply_markdown: normalize_optional_text(input.reply_to_ai_reply_markdown), |
| 307 | client_ip: input.client_ip, |
| 308 | ip_region: input.ip_region, |
| 309 | fingerprint: input.fingerprint, |
| 310 | ua: normalize_optional_text(input.ua), |
| 311 | language: normalize_optional_text(input.language), |
| 312 | platform: normalize_optional_text(input.platform), |
| 313 | timezone: normalize_optional_text(input.timezone), |
| 314 | viewport: normalize_optional_text(input.viewport), |
| 315 | referrer: normalize_optional_text(input.referrer), |
| 316 | admin_note: None, |
| 317 | failure_reason: None, |
| 318 | attempt_count: 0, |
| 319 | created_at: now, |
| 320 | updated_at: now, |
| 321 | approved_at: None, |
| 322 | completed_at: None, |
| 323 | }; |
| 324 | |
| 325 | let table = self.tasks_table().await?; |
| 326 | upsert_comment_task_record(&table, &record).await?; |
| 327 | Ok(record) |
| 328 | } |
| 329 | |
| 330 | pub async fn get_comment_task(&self, task_id: &str) -> Result<Option<CommentTaskRecord>> { |
| 331 | let table = self.tasks_table().await?; |
no test coverage detected