optimize+注释

This commit is contained in:
stardrophere
2026-03-13 23:48:49 +08:00
parent 6aee65af6c
commit da00ebb8f2
41 changed files with 874 additions and 174 deletions
+4 -2
View File
@@ -1,4 +1,7 @@
# app/crud/crud_source.py
"""
信息源 CRUD:对 InfoSource 的增删改查,供 API 与爬虫使用
"""
from sqlalchemy.orm import Session
from typing import List, Optional
@@ -26,8 +29,7 @@ def create(db: Session, obj_in: InfoSourceCreate) -> InfoSource:
def update(db: Session, db_obj: InfoSource, obj_in: InfoSourceUpdate) -> InfoSource:
"""更新信息源"""
# 提取前端真正要求更新的字段
"""更新信息源,仅更新前端传入的字段(exclude_unset=True"""
update_data = obj_in.model_dump(exclude_unset=True)
# 遍历更新模型对象的属性