(
*,
affiliation: str = "",
core_directions_text: str = "",
topic_weights_text: str = "",
must_read_keywords: Optional[List[str]] = None,
must_read_authors: Optional[List[str]] = None,
must_read_institutions: Optional[List[str]] = None,
)
| 1873 | ) |
| 1874 | return {"result": result, **list_roles()} |
| 1875 | |
| 1876 | |
| 1877 | def switch_role(role_name: str) -> Dict[str, Any]: |
| 1878 | role_name = str(role_name or "").strip() |
| 1879 | if not role_name: |
| 1880 | raise ValueError("role_name is required") |
| 1881 | result = role_manager.switch_role(role_name) |
| 1882 | return {"result": result, **list_roles()} |
| 1883 | |
| 1884 | |
| 1885 | def delete_role(role_name: str) -> Dict[str, Any]: |
| 1886 | role_name = str(role_name or "").strip() |
| 1887 | if not role_name: |
| 1888 | raise ValueError("role_name is required") |
| 1889 | result = role_manager.delete_role(role_name) |
| 1890 | return {"result": result, **list_roles()} |
| 1891 | |
| 1892 | |
| 1893 | def get_profile(user_id: str) -> Dict[str, Any]: |
| 1894 | profile = db_ops.get_profile(user_id) |
| 1895 | return {"profile": _profile_summary(profile), "raw": profile} |
| 1896 | |
| 1897 | |
| 1898 | def list_must_read(user_id: str) -> Dict[str, Any]: |
| 1899 | profile = db_ops.get_profile(user_id) or {} |
| 1900 | must_read = profile.get("must_read") or {"authors": [], "institutions": [], "keywords": []} |
| 1901 | return { |
| 1902 | "must_read": { |
| 1903 | "authors": list(must_read.get("authors") or []), |
| 1904 | "institutions": list(must_read.get("institutions") or []), |
| 1905 | "keywords": list(must_read.get("keywords") or []), |
| 1906 | } |
| 1907 | } |
no test coverage detected