89cecce6b5
新增 MEDICAL_REVIEW 项目角色,界面显示为医学审核,并通过 Alembic 迁移扩展 user_role 枚举。 为医学审核配置独立默认权限:项目总览、参与者、风险问题、监查稽查、FAQ、共享库按医学审核职责开放,不再复制 PV 默认权限。 同步前后端类型、项目成员角色下拉、权限矩阵展示、文件分发角色兜底和用户协议文案,并补充权限矩阵回归测试。
35 lines
804 B
Python
35 lines
804 B
Python
import uuid
|
|
from datetime import datetime
|
|
from typing import Literal, Optional
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
from app.schemas.user import UserDisplay
|
|
|
|
StudyRole = Literal["PM", "CRA", "PV", "MEDICAL_REVIEW", "IMP", "QA", "ADMIN"]
|
|
|
|
|
|
class StudyMemberCreate(BaseModel):
|
|
user_id: uuid.UUID
|
|
role_in_study: StudyRole
|
|
is_active: bool = True
|
|
|
|
|
|
class StudyMemberUpdate(BaseModel):
|
|
role_in_study: Optional[StudyRole] = None
|
|
is_active: Optional[bool] = None
|
|
|
|
|
|
class StudyMemberRead(BaseModel):
|
|
id: uuid.UUID
|
|
study_id: uuid.UUID
|
|
user_id: uuid.UUID
|
|
role_in_study: StudyRole
|
|
is_active: bool
|
|
added_at: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class StudyMemberReadWithUser(StudyMemberRead):
|
|
user: Optional[UserDisplay] = None
|