1d26646a96
- 新增协作文件夹、文件、不可变修订、成员、会话、回调回执、编辑申请与分享链接数据模型。 - 补齐新建、导入、复制、下载、回收站、恢复、成员授权、所有权转让及文件级权限接口。 - 接入 ONLYOFFICE 共同编辑、历史版本预览与恢复、修订另存副本、导出下载审计和幂等回调保存。 - 增加编辑权限申请、审批通知、项目提醒聚合、通知 Feed、已读处理及历史待办数据回填。 - 支持公开分享的查看或编辑模式、有效期、密码哈希、失败锁定、短时访问凭证与固定分享地址。 - 增加协作者导出、申请编辑、工作表结构保护和所有权管理策略,并纳入项目接口权限矩阵。 - 新增协作文件库、编辑工作区、公开分享页、下载与另存为对话框,以及导航、路由和权限入口。 - 统一网页端与桌面端通知布局,增加沉浸式工作区和浏览器、Tauri 双端全屏能力。 - 扩展运行时文件下载适配、Tauri 环境识别和原生全屏命令,继续保持业务代码运行时边界。 - 加固 ONLYOFFICE 消息桥的同源下载、签名地址隔离和保存为能力校验,并更新桌面发布检查。 - 增加连续数据库迁移、50MB 上传限制、OnlyOffice 中文文案与开发启动路由校验。 - 补充协作、通知、权限、路由、运行时、布局和 OnlyOffice 相关测试及模块说明文档。
73 lines
2.5 KiB
Python
73 lines
2.5 KiB
Python
from __future__ import annotations
|
|
|
|
import uuid
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.core.deps import get_cra_site_scope, is_system_admin
|
|
from app.core.project_permissions import role_has_api_permission
|
|
from app.crud import ae as ae_crud
|
|
from app.crud import member as member_crud
|
|
from app.crud import monitoring_visit_issue as monitoring_issue_crud
|
|
from app.services import notification_service
|
|
|
|
|
|
async def sync_project_reminders(db: AsyncSession, study_id: uuid.UUID, user) -> None:
|
|
membership = await member_crud.get_member(db, study_id, user.id)
|
|
if not is_system_admin(user) and (not membership or not membership.is_active):
|
|
return
|
|
role = membership.role_in_study if membership else ""
|
|
can_read_aes = is_system_admin(user) or await role_has_api_permission(
|
|
db, study_id, role, "subject_aes:read"
|
|
)
|
|
can_read_monitoring = is_system_admin(user) or await role_has_api_permission(
|
|
db, study_id, role, "monitoring_issues:read"
|
|
)
|
|
|
|
overdue_aes = 0
|
|
if can_read_aes:
|
|
cra_scope = await get_cra_site_scope(db, study_id, user)
|
|
items = await ae_crud.list_ae(
|
|
db,
|
|
study_id,
|
|
overdue=True,
|
|
site_ids=cra_scope[0] if cra_scope else None,
|
|
)
|
|
overdue_aes = len(items)
|
|
await notification_service.sync_aggregate_notification(
|
|
db,
|
|
study_id=study_id,
|
|
recipient_id=user.id,
|
|
category="RISK_OVERDUE_AE",
|
|
priority="HIGH",
|
|
title="逾期 AE 待处理",
|
|
message=f"当前有 {overdue_aes} 条逾期 AE 需要跟进",
|
|
action_path="/risk-issues/sae",
|
|
source_type="RISK_OVERDUE_AE",
|
|
source_id=str(study_id),
|
|
count=overdue_aes if can_read_aes else 0,
|
|
)
|
|
|
|
overdue_monitoring = 0
|
|
if can_read_monitoring:
|
|
overdue_monitoring = len(await monitoring_issue_crud.list_issues(
|
|
db,
|
|
study_id,
|
|
overdue=True,
|
|
limit=2000,
|
|
))
|
|
await notification_service.sync_aggregate_notification(
|
|
db,
|
|
study_id=study_id,
|
|
recipient_id=user.id,
|
|
category="RISK_OVERDUE_MONITORING",
|
|
priority="HIGH",
|
|
title="监查问题已逾期",
|
|
message=f"当前有 {overdue_monitoring} 条监查问题已超过计划解决日期",
|
|
action_path="/risk-issues/monitoring-visits",
|
|
source_type="RISK_OVERDUE_MONITORING",
|
|
source_id=str(study_id),
|
|
count=overdue_monitoring if can_read_monitoring else 0,
|
|
)
|
|
await db.commit()
|