mirror of
https://github.com/stardrophere/InsightRadar.git
synced 2026-06-05 23:56:36 +08:00
optimize+注释
This commit is contained in:
@@ -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)
|
||||
|
||||
# 遍历更新模型对象的属性
|
||||
|
||||
Reference in New Issue
Block a user