organization-feature
This commit is contained in:
@@ -88,6 +88,25 @@ class Organization(Durable, table=True):
|
||||
accounts: list["Account"] = Relationship(back_populates="organization")
|
||||
|
||||
|
||||
class OrganizationInstitution(SQLModel, table=True):
|
||||
__tablename__ = "organization_institution"
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"organization_id",
|
||||
"position",
|
||||
name="uq_organization_institution_position",
|
||||
),
|
||||
)
|
||||
|
||||
organization_id: uuid.UUID = Field(
|
||||
foreign_key="organization.id",
|
||||
primary_key=True,
|
||||
index=True,
|
||||
)
|
||||
openalex_institution_id: str = Field(primary_key=True, index=True)
|
||||
position: int = Field(nullable=False)
|
||||
|
||||
|
||||
class Account(Durable, table=True):
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
|
||||
@@ -22,6 +22,7 @@ from inse.auth.model import (
|
||||
IdTokenMetadata,
|
||||
LoginResponse,
|
||||
Organization,
|
||||
OrganizationInstitution,
|
||||
OtkResponse,
|
||||
RefreshTokenMetadata,
|
||||
Secret,
|
||||
@@ -98,9 +99,12 @@ def create_predefined_accounts(session: Session, file_path: str):
|
||||
with open(file_path, "r") as file:
|
||||
data: dict[str, Any] = json.loads(file.read())
|
||||
for organization_data in data.get("organizations", []):
|
||||
organization_id = organization_data.get("id")
|
||||
if organization_id is not None:
|
||||
organization_id = uuid.UUID(organization_id)
|
||||
organization_id_value = organization_data.get("id")
|
||||
organization_id = (
|
||||
uuid.UUID(organization_id_value)
|
||||
if organization_id_value is not None
|
||||
else uuid.uuid4()
|
||||
)
|
||||
organization_name = organization_data["name"]
|
||||
openalex_institution_id = organization_data.get(
|
||||
"openalex_institution_id"
|
||||
@@ -113,6 +117,14 @@ def create_predefined_accounts(session: Session, file_path: str):
|
||||
openalex_institution_id=openalex_institution_id,
|
||||
)
|
||||
session.add(organization)
|
||||
if openalex_institution_id:
|
||||
session.add(
|
||||
OrganizationInstitution(
|
||||
organization_id=organization.id,
|
||||
openalex_institution_id=openalex_institution_id,
|
||||
position=0,
|
||||
)
|
||||
)
|
||||
for account_data in data.get("accounts", []):
|
||||
organization_id = uuid.UUID(account_data["organization_id"])
|
||||
roles = normalize_roles(
|
||||
|
||||
@@ -107,6 +107,30 @@ def create_db_and_tables():
|
||||
)
|
||||
)
|
||||
|
||||
# Preserve the former single institution as the first manually selected
|
||||
# institution.
|
||||
# The legacy column remains synchronized for portal sections that have not yet
|
||||
# been migrated to organization-wide institution lists.
|
||||
with engine.begin() as connection:
|
||||
connection.execute(
|
||||
text(
|
||||
"""
|
||||
INSERT INTO organization_institution (
|
||||
organization_id, openalex_institution_id, position
|
||||
)
|
||||
SELECT id, openalex_institution_id, 0
|
||||
FROM organization
|
||||
WHERE openalex_institution_id IS NOT NULL
|
||||
AND TRIM(openalex_institution_id) != ''
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM organization_institution oi
|
||||
WHERE oi.organization_id = organization.id
|
||||
)
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def get_session():
|
||||
"""Yields a database session for use in FastAPI endpoints.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import uuid
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
@@ -7,6 +8,7 @@ class OrganizationProfile(BaseModel):
|
||||
id: uuid.UUID
|
||||
name: str
|
||||
other_inst_id: str | None = None
|
||||
selected_openalex_institution_ids: list[str] = Field(default_factory=list)
|
||||
deleted: bool
|
||||
member_count: int
|
||||
|
||||
@@ -21,9 +23,25 @@ class OrganizationPage(BaseModel):
|
||||
class CreateOrganizationRequest(BaseModel):
|
||||
name: str = Field(min_length=1)
|
||||
other_inst_id: str | None = None
|
||||
selected_openalex_institution_ids: list[str] | None = None
|
||||
|
||||
|
||||
class UpdateOrganizationRequest(BaseModel):
|
||||
name: str | None = Field(default=None, min_length=1)
|
||||
other_inst_id: str | None = None
|
||||
selected_openalex_institution_ids: list[str] | None = None
|
||||
deleted: bool | None = None
|
||||
|
||||
|
||||
class InstitutionAssociation(BaseModel):
|
||||
id: str
|
||||
display_name: str
|
||||
relationship: Literal["child", "related"]
|
||||
|
||||
|
||||
class InstitutionAssociationsResponse(BaseModel):
|
||||
id: str
|
||||
display_name: str
|
||||
associated_institutions: list[InstitutionAssociation] = Field(
|
||||
default_factory=list
|
||||
)
|
||||
|
||||
@@ -11,6 +11,7 @@ from inse.tags import Tags
|
||||
from . import service
|
||||
from .model import (
|
||||
CreateOrganizationRequest,
|
||||
InstitutionAssociationsResponse,
|
||||
OrganizationPage,
|
||||
OrganizationProfile,
|
||||
UpdateOrganizationRequest,
|
||||
@@ -19,6 +20,18 @@ from .model import (
|
||||
router = APIRouter(prefix="/api/organizations", tags=[Tags.ORGANIZATION])
|
||||
|
||||
|
||||
@router.get(
|
||||
"/institutions/associations",
|
||||
operation_id="getOrganizationInstitutionAssociations",
|
||||
response_model=list[InstitutionAssociationsResponse],
|
||||
)
|
||||
async def get_organization_institution_associations(
|
||||
institution_ids: list[str] = Query(),
|
||||
access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||
) -> list[InstitutionAssociationsResponse]:
|
||||
return await service.get_institution_associations(access_token, institution_ids)
|
||||
|
||||
|
||||
@router.get("", operation_id="getOrganisations", response_model=OrganizationPage)
|
||||
async def get_organizations(
|
||||
page: int = Query(default=0, ge=0),
|
||||
|
||||
@@ -1,18 +1,43 @@
|
||||
import logging
|
||||
import re
|
||||
import uuid
|
||||
|
||||
from fastapi import HTTPException, status
|
||||
from sqlmodel import Session, func, select
|
||||
|
||||
from inse.auth.model import AccessTokenMetadata, Account, Organization, UserRole
|
||||
from inse.auth.model import (
|
||||
AccessTokenMetadata,
|
||||
Account,
|
||||
Organization,
|
||||
OrganizationInstitution,
|
||||
UserRole,
|
||||
)
|
||||
from inse.integrations import elasticsearch
|
||||
from inse.model import ESIndex
|
||||
|
||||
from .model import (
|
||||
CreateOrganizationRequest,
|
||||
InstitutionAssociation,
|
||||
InstitutionAssociationsResponse,
|
||||
OrganizationPage,
|
||||
OrganizationProfile,
|
||||
UpdateOrganizationRequest,
|
||||
)
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
OPENALEX_INSTITUTION_ID_PATTERN = re.compile(
|
||||
r"^(?:https?://openalex\.org/)?(I\d+)/?$", re.IGNORECASE
|
||||
)
|
||||
KNOWN_ASSOCIATION_TYPES = {
|
||||
"parent",
|
||||
"child",
|
||||
"related",
|
||||
"predecessor",
|
||||
"successor",
|
||||
}
|
||||
|
||||
|
||||
def _require_super_admin(access_token: AccessTokenMetadata) -> None:
|
||||
if access_token.effective_role != UserRole.SUPER_ADMIN:
|
||||
raise HTTPException(
|
||||
@@ -31,6 +56,27 @@ def _normalize_name(name: str) -> str:
|
||||
return normalized_name
|
||||
|
||||
|
||||
def _normalize_institution_id(institution_id: str) -> str:
|
||||
match = OPENALEX_INSTITUTION_ID_PATTERN.fullmatch(institution_id.strip())
|
||||
if match is None:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||
detail=f"Invalid OpenAlex institution ID: {institution_id}",
|
||||
)
|
||||
return f"I{match.group(1)[1:]}"
|
||||
|
||||
|
||||
def _normalize_institution_ids(institution_ids: list[str]) -> list[str]:
|
||||
normalized: list[str] = []
|
||||
seen: set[str] = set()
|
||||
for institution_id in institution_ids:
|
||||
clean_id = _normalize_institution_id(institution_id)
|
||||
if clean_id not in seen:
|
||||
normalized.append(clean_id)
|
||||
seen.add(clean_id)
|
||||
return normalized
|
||||
|
||||
|
||||
def _ensure_name_available(
|
||||
session: Session,
|
||||
name: str,
|
||||
@@ -79,18 +125,76 @@ def _member_counts(
|
||||
return {organization_id: count for organization_id, count in rows}
|
||||
|
||||
|
||||
def _institution_data(
|
||||
session: Session, organization_ids: list[uuid.UUID]
|
||||
) -> dict[uuid.UUID, list[str]]:
|
||||
ids_by_organization: dict[uuid.UUID, list[str]] = {
|
||||
organization_id: [] for organization_id in organization_ids
|
||||
}
|
||||
if not organization_ids:
|
||||
return ids_by_organization
|
||||
|
||||
institution_rows = session.exec(
|
||||
select(OrganizationInstitution)
|
||||
.where(OrganizationInstitution.organization_id.in_(organization_ids))
|
||||
.order_by(
|
||||
OrganizationInstitution.organization_id,
|
||||
OrganizationInstitution.position,
|
||||
)
|
||||
).all()
|
||||
for row in institution_rows:
|
||||
ids_by_organization[row.organization_id].append(
|
||||
row.openalex_institution_id
|
||||
)
|
||||
|
||||
return ids_by_organization
|
||||
|
||||
|
||||
def _to_profile(
|
||||
organization: Organization, member_count: int
|
||||
organization: Organization,
|
||||
member_count: int,
|
||||
institution_ids: list[str],
|
||||
) -> OrganizationProfile:
|
||||
if not institution_ids and organization.openalex_institution_id:
|
||||
legacy_id = _normalize_institution_id(organization.openalex_institution_id)
|
||||
institution_ids = [legacy_id]
|
||||
return OrganizationProfile(
|
||||
id=organization.id,
|
||||
name=organization.name,
|
||||
other_inst_id=organization.openalex_institution_id,
|
||||
other_inst_id=institution_ids[0] if institution_ids else None,
|
||||
selected_openalex_institution_ids=institution_ids,
|
||||
deleted=organization.deleted,
|
||||
member_count=member_count,
|
||||
)
|
||||
|
||||
|
||||
def _replace_organization_institutions(
|
||||
session: Session,
|
||||
organization: Organization,
|
||||
institution_ids: list[str],
|
||||
) -> None:
|
||||
normalized_ids = _normalize_institution_ids(institution_ids)
|
||||
for row in session.exec(
|
||||
select(OrganizationInstitution).where(
|
||||
OrganizationInstitution.organization_id == organization.id
|
||||
)
|
||||
).all():
|
||||
session.delete(row)
|
||||
session.flush()
|
||||
|
||||
for position, institution_id in enumerate(normalized_ids):
|
||||
session.add(
|
||||
OrganizationInstitution(
|
||||
organization_id=organization.id,
|
||||
openalex_institution_id=institution_id,
|
||||
position=position,
|
||||
)
|
||||
)
|
||||
organization.openalex_institution_id = (
|
||||
normalized_ids[0] if normalized_ids else None
|
||||
)
|
||||
|
||||
|
||||
def _deactivate_organization_accounts(
|
||||
session: Session, organization_id: uuid.UUID
|
||||
) -> None:
|
||||
@@ -106,6 +210,27 @@ def _deactivate_organization_accounts(
|
||||
session.add(account)
|
||||
|
||||
|
||||
def _ensure_not_current_organization(
|
||||
session: Session,
|
||||
access_token: AccessTokenMetadata,
|
||||
organization_id: uuid.UUID,
|
||||
) -> None:
|
||||
protected_organization_ids = {access_token.effective_organization_id}
|
||||
if access_token.real_account_id is not None:
|
||||
real_account = session.get(Account, access_token.real_account_id)
|
||||
if real_account is not None:
|
||||
protected_organization_ids.add(real_account.organization_id)
|
||||
|
||||
if organization_id in protected_organization_ids:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_409_CONFLICT,
|
||||
detail=(
|
||||
"The organization of the real or effective account "
|
||||
"cannot be deleted."
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def get_organizations(
|
||||
session: Session,
|
||||
access_token: AccessTokenMetadata,
|
||||
@@ -130,10 +255,15 @@ def get_organizations(
|
||||
).all()
|
||||
organization_ids = [organization.id for organization in organizations]
|
||||
counts = _member_counts(session, organization_ids)
|
||||
institution_ids = _institution_data(session, organization_ids)
|
||||
|
||||
return OrganizationPage(
|
||||
items=[
|
||||
_to_profile(organization, counts.get(organization.id, 0))
|
||||
_to_profile(
|
||||
organization,
|
||||
counts.get(organization.id, 0),
|
||||
institution_ids.get(organization.id, []),
|
||||
)
|
||||
for organization in organizations
|
||||
],
|
||||
total=total,
|
||||
@@ -153,12 +283,25 @@ def create_organization(
|
||||
|
||||
organization = Organization(
|
||||
name=name,
|
||||
openalex_institution_id=(payload.other_inst_id or '').strip() or None,
|
||||
)
|
||||
session.add(organization)
|
||||
session.flush()
|
||||
requested_ids = payload.selected_openalex_institution_ids
|
||||
if requested_ids is None:
|
||||
requested_ids = [payload.other_inst_id] if payload.other_inst_id else []
|
||||
_replace_organization_institutions(
|
||||
session,
|
||||
organization,
|
||||
requested_ids,
|
||||
)
|
||||
session.commit()
|
||||
session.refresh(organization)
|
||||
return _to_profile(organization, 0)
|
||||
institution_ids = _institution_data(session, [organization.id])
|
||||
return _to_profile(
|
||||
organization,
|
||||
0,
|
||||
institution_ids[organization.id],
|
||||
)
|
||||
|
||||
|
||||
def update_organization(
|
||||
@@ -174,10 +317,21 @@ def update_organization(
|
||||
name = _normalize_name(payload.name)
|
||||
_ensure_name_available(session, name, organization.id)
|
||||
organization.name = name
|
||||
if payload.other_inst_id is not None:
|
||||
organization.openalex_institution_id = payload.other_inst_id.strip() or None
|
||||
if payload.selected_openalex_institution_ids is not None:
|
||||
_replace_organization_institutions(
|
||||
session,
|
||||
organization,
|
||||
payload.selected_openalex_institution_ids,
|
||||
)
|
||||
elif payload.other_inst_id is not None:
|
||||
_replace_organization_institutions(
|
||||
session,
|
||||
organization,
|
||||
[payload.other_inst_id] if payload.other_inst_id.strip() else [],
|
||||
)
|
||||
if payload.deleted is not None:
|
||||
if payload.deleted and not organization.deleted:
|
||||
_ensure_not_current_organization(session, access_token, organization.id)
|
||||
_deactivate_organization_accounts(session, organization.id)
|
||||
organization.deleted = payload.deleted
|
||||
|
||||
@@ -185,7 +339,107 @@ def update_organization(
|
||||
session.commit()
|
||||
session.refresh(organization)
|
||||
counts = _member_counts(session, [organization.id])
|
||||
return _to_profile(organization, counts.get(organization.id, 0))
|
||||
institution_ids = _institution_data(session, [organization.id])
|
||||
return _to_profile(
|
||||
organization,
|
||||
counts.get(organization.id, 0),
|
||||
institution_ids[organization.id],
|
||||
)
|
||||
|
||||
|
||||
async def get_institution_associations(
|
||||
access_token: AccessTokenMetadata,
|
||||
institution_ids: list[str],
|
||||
) -> list[InstitutionAssociationsResponse]:
|
||||
_require_super_admin(access_token)
|
||||
clean_ids = _normalize_institution_ids(institution_ids)
|
||||
if not clean_ids:
|
||||
return []
|
||||
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.OPENALEX_INSTITUTIONS,
|
||||
query={
|
||||
"terms": {
|
||||
"id": [
|
||||
f"https://openalex.org/{institution_id}"
|
||||
for institution_id in clean_ids
|
||||
]
|
||||
}
|
||||
},
|
||||
source=["id", "display_name", "associated_institutions"],
|
||||
size=len(clean_ids),
|
||||
)
|
||||
sources_by_id: dict[str, dict] = {}
|
||||
for hit in response.get("hits", {}).get("hits", []):
|
||||
source = hit.get("_source") or {}
|
||||
raw_id = source.get("id")
|
||||
if isinstance(raw_id, str):
|
||||
sources_by_id[_normalize_institution_id(raw_id)] = source
|
||||
|
||||
missing_id = next(
|
||||
(
|
||||
institution_id
|
||||
for institution_id in clean_ids
|
||||
if institution_id not in sources_by_id
|
||||
),
|
||||
None,
|
||||
)
|
||||
if missing_id is not None:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail=f"OpenAlex institution {missing_id} not found.",
|
||||
)
|
||||
|
||||
results: list[InstitutionAssociationsResponse] = []
|
||||
for clean_id in clean_ids:
|
||||
source = sources_by_id[clean_id]
|
||||
display_name = source.get("display_name")
|
||||
if not isinstance(display_name, str) or not display_name.strip():
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_502_BAD_GATEWAY,
|
||||
detail=f"OpenAlex institution {clean_id} has no display name.",
|
||||
)
|
||||
|
||||
associations_by_id: dict[str, InstitutionAssociation] = {}
|
||||
for association in source.get("associated_institutions") or []:
|
||||
if not isinstance(association, dict):
|
||||
continue
|
||||
relationship = str(association.get("relationship") or "").lower()
|
||||
if relationship not in KNOWN_ASSOCIATION_TYPES:
|
||||
logger.warning(
|
||||
"Ignoring unknown OpenAlex institution relationship %r for %s",
|
||||
relationship,
|
||||
clean_id,
|
||||
)
|
||||
continue
|
||||
if relationship not in {"child", "related"}:
|
||||
continue
|
||||
raw_association_id = association.get("id")
|
||||
association_name = association.get("display_name")
|
||||
if not isinstance(raw_association_id, str) or not isinstance(
|
||||
association_name, str
|
||||
):
|
||||
continue
|
||||
associated_id = _normalize_institution_id(raw_association_id)
|
||||
candidate = InstitutionAssociation(
|
||||
id=associated_id,
|
||||
display_name=association_name,
|
||||
relationship=relationship,
|
||||
)
|
||||
existing = associations_by_id.get(associated_id)
|
||||
if existing is None or (
|
||||
existing.relationship == "related" and relationship == "child"
|
||||
):
|
||||
associations_by_id[associated_id] = candidate
|
||||
|
||||
results.append(
|
||||
InstitutionAssociationsResponse(
|
||||
id=clean_id,
|
||||
display_name=display_name,
|
||||
associated_institutions=list(associations_by_id.values()),
|
||||
)
|
||||
)
|
||||
return results
|
||||
|
||||
|
||||
def delete_organization(
|
||||
@@ -196,6 +450,7 @@ def delete_organization(
|
||||
_require_super_admin(access_token)
|
||||
organization = _get_organization_or_404(session, organization_id)
|
||||
if not organization.deleted:
|
||||
_ensure_not_current_organization(session, access_token, organization.id)
|
||||
_deactivate_organization_accounts(session, organization.id)
|
||||
organization.deleted = True
|
||||
session.add(organization)
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import asyncio
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
from fastapi import HTTPException
|
||||
from sqlmodel import Session, SQLModel, create_engine
|
||||
from sqlmodel import Session, SQLModel, create_engine, select
|
||||
|
||||
from inse.auth.model import Account, Organization, UserRole
|
||||
from inse.auth.model import (
|
||||
Account,
|
||||
Organization,
|
||||
OrganizationInstitution,
|
||||
UserRole,
|
||||
)
|
||||
from inse.organization_management import service
|
||||
from inse.organization_management.model import (
|
||||
CreateOrganizationRequest,
|
||||
@@ -22,10 +28,11 @@ def session():
|
||||
yield database_session
|
||||
|
||||
|
||||
def token(role: UserRole, organization_id):
|
||||
def token(role: UserRole, organization_id, real_account_id=None):
|
||||
return SimpleNamespace(
|
||||
effective_role=role,
|
||||
effective_organization_id=organization_id,
|
||||
real_account_id=real_account_id,
|
||||
)
|
||||
|
||||
|
||||
@@ -105,8 +112,115 @@ def test_superadmin_can_create_update_and_soft_delete(session):
|
||||
assert session.get(Organization, created.id).deleted is True
|
||||
|
||||
|
||||
def test_organization_stores_ordered_selected_institution_ids(session):
|
||||
scope = Organization(name="Scope")
|
||||
session.add(scope)
|
||||
session.commit()
|
||||
|
||||
created = service.create_organization(
|
||||
session,
|
||||
token(UserRole.SUPER_ADMIN, scope.id),
|
||||
CreateOrganizationRequest(
|
||||
name="Institution list",
|
||||
selected_openalex_institution_ids=[
|
||||
"https://openalex.org/I123",
|
||||
"I456",
|
||||
"I123",
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
assert created.selected_openalex_institution_ids == ["I123", "I456"]
|
||||
assert created.other_inst_id == "I123"
|
||||
assert session.get(Organization, created.id).openalex_institution_id == "I123"
|
||||
rows = session.exec(
|
||||
select(OrganizationInstitution)
|
||||
.where(OrganizationInstitution.organization_id == created.id)
|
||||
.order_by(OrganizationInstitution.position)
|
||||
).all()
|
||||
assert [row.openalex_institution_id for row in rows] == ["I123", "I456"]
|
||||
|
||||
|
||||
def test_empty_institution_list_clears_legacy_primary_institution(session):
|
||||
organization = Organization(name="Organization", openalex_institution_id="I123")
|
||||
session.add(organization)
|
||||
session.commit()
|
||||
|
||||
updated = service.update_organization(
|
||||
session,
|
||||
token(UserRole.SUPER_ADMIN, organization.id),
|
||||
organization.id,
|
||||
UpdateOrganizationRequest(selected_openalex_institution_ids=[]),
|
||||
)
|
||||
|
||||
assert updated.selected_openalex_institution_ids == []
|
||||
assert updated.other_inst_id is None
|
||||
assert session.get(Organization, organization.id).openalex_institution_id is None
|
||||
|
||||
|
||||
def test_association_expansion_adds_only_child_and_related_with_child_priority(
|
||||
monkeypatch,
|
||||
):
|
||||
async def fake_search(**kwargs):
|
||||
return {
|
||||
"hits": {
|
||||
"hits": [
|
||||
{
|
||||
"_source": {
|
||||
"id": "https://openalex.org/I100",
|
||||
"display_name": "Selected institution",
|
||||
"associated_institutions": [
|
||||
{
|
||||
"id": "https://openalex.org/I200",
|
||||
"display_name": "Duplicate",
|
||||
"relationship": "related",
|
||||
},
|
||||
{
|
||||
"id": "https://openalex.org/I200",
|
||||
"display_name": "Duplicate",
|
||||
"relationship": "child",
|
||||
},
|
||||
{
|
||||
"id": "https://openalex.org/I300",
|
||||
"display_name": "Related",
|
||||
"relationship": "related",
|
||||
},
|
||||
{
|
||||
"id": "https://openalex.org/I400",
|
||||
"display_name": "Parent",
|
||||
"relationship": "parent",
|
||||
},
|
||||
{
|
||||
"id": "https://openalex.org/I500",
|
||||
"display_name": "Successor",
|
||||
"relationship": "successor",
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
monkeypatch.setattr(service.elasticsearch, "search", fake_search)
|
||||
|
||||
result = asyncio.run(
|
||||
service.get_institution_associations(
|
||||
token(UserRole.SUPER_ADMIN, None), ["https://openalex.org/I100"]
|
||||
)
|
||||
)
|
||||
|
||||
assert result[0].id == "I100"
|
||||
assert [
|
||||
(association.id, association.relationship)
|
||||
for association in result[0].associated_institutions
|
||||
] == [("I200", "child"), ("I300", "related")]
|
||||
|
||||
|
||||
def test_deleting_organization_deactivates_all_its_accounts(session):
|
||||
admin_scope = Organization(name="Admin scope for delete")
|
||||
organization = Organization(name="Organization to delete")
|
||||
session.add(admin_scope)
|
||||
session.add(organization)
|
||||
session.flush()
|
||||
active_account = Account(
|
||||
@@ -129,7 +243,7 @@ def test_deleting_organization_deactivates_all_its_accounts(session):
|
||||
session.commit()
|
||||
|
||||
service.delete_organization(
|
||||
session, token(UserRole.SUPER_ADMIN, organization.id), organization.id
|
||||
session, token(UserRole.SUPER_ADMIN, admin_scope.id), organization.id
|
||||
)
|
||||
|
||||
session.refresh(active_account)
|
||||
@@ -141,7 +255,9 @@ def test_deleting_organization_deactivates_all_its_accounts(session):
|
||||
|
||||
|
||||
def test_marking_organization_deleted_deactivates_its_accounts(session):
|
||||
admin_scope = Organization(name="Admin scope for update")
|
||||
organization = Organization(name="Organization to update")
|
||||
session.add(admin_scope)
|
||||
session.add(organization)
|
||||
session.flush()
|
||||
account = Account(
|
||||
@@ -155,7 +271,7 @@ def test_marking_organization_deleted_deactivates_its_accounts(session):
|
||||
|
||||
service.update_organization(
|
||||
session,
|
||||
token(UserRole.SUPER_ADMIN, organization.id),
|
||||
token(UserRole.SUPER_ADMIN, admin_scope.id),
|
||||
organization.id,
|
||||
UpdateOrganizationRequest(deleted=True),
|
||||
)
|
||||
@@ -165,6 +281,61 @@ def test_marking_organization_deleted_deactivates_its_accounts(session):
|
||||
assert account.epoch == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize("delete_via_update", [False, True])
|
||||
def test_current_organization_cannot_be_deleted(session, delete_via_update):
|
||||
organization = Organization(name="Current organization")
|
||||
session.add(organization)
|
||||
session.commit()
|
||||
access_token = token(UserRole.SUPER_ADMIN, organization.id)
|
||||
|
||||
with pytest.raises(HTTPException) as error:
|
||||
if delete_via_update:
|
||||
service.update_organization(
|
||||
session,
|
||||
access_token,
|
||||
organization.id,
|
||||
UpdateOrganizationRequest(deleted=True),
|
||||
)
|
||||
else:
|
||||
service.delete_organization(session, access_token, organization.id)
|
||||
|
||||
assert error.value.status_code == 409
|
||||
assert session.get(Organization, organization.id).deleted is False
|
||||
|
||||
|
||||
def test_real_account_organization_cannot_be_deleted_while_impersonating(session):
|
||||
real_organization = Organization(name="Real organization")
|
||||
effective_organization = Organization(name="Effective organization")
|
||||
session.add(real_organization)
|
||||
session.add(effective_organization)
|
||||
session.flush()
|
||||
real_account = Account(
|
||||
email="real-superadmin@example.org",
|
||||
name="Real superadmin",
|
||||
password_hash="hash",
|
||||
organization_id=real_organization.id,
|
||||
roles=[UserRole.SUPER_ADMIN],
|
||||
)
|
||||
session.add(real_account)
|
||||
session.commit()
|
||||
|
||||
access_token = token(
|
||||
UserRole.SUPER_ADMIN,
|
||||
effective_organization.id,
|
||||
real_account.id,
|
||||
)
|
||||
with pytest.raises(HTTPException) as error:
|
||||
service.delete_organization(
|
||||
session,
|
||||
access_token,
|
||||
real_organization.id,
|
||||
)
|
||||
|
||||
assert error.value.status_code == 409
|
||||
assert session.get(Organization, real_organization.id).deleted is False
|
||||
assert session.get(Account, real_account.id).activated is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize("role", [UserRole.ADMIN, UserRole.MANAGER, UserRole.USER])
|
||||
def test_only_superadmin_can_create_organizations(session, role):
|
||||
organization = Organization(name="Scope")
|
||||
|
||||
@@ -169,6 +169,8 @@ model/idTokenMetadata.ts
|
||||
model/inseAccountManagementModelOrganizationProfile.ts
|
||||
model/inseOrganizationManagementModelOrganizationProfile.ts
|
||||
model/institution.ts
|
||||
model/institutionAssociation.ts
|
||||
model/institutionAssociationsResponse.ts
|
||||
model/institutionFunderSummary.ts
|
||||
model/institutionGeo.ts
|
||||
model/institutionIds.ts
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -9,12 +9,18 @@
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import {
|
||||
HttpClient,
|
||||
HttpHeaders,
|
||||
HttpParams,
|
||||
HttpResponse,
|
||||
HttpEvent,
|
||||
HttpParameterCodec,
|
||||
HttpContext,
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { CreateOrganizationRequest } from '../model/createOrganizationRequest';
|
||||
@@ -23,292 +29,679 @@ import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
// @ts-ignore
|
||||
import { InseOrganizationManagementModelOrganizationProfile } from '../model/inseOrganizationManagementModelOrganizationProfile';
|
||||
// @ts-ignore
|
||||
import { InstitutionAssociationsResponse } from '../model/institutionAssociationsResponse';
|
||||
// @ts-ignore
|
||||
import { OrganizationPage } from '../model/organizationPage';
|
||||
// @ts-ignore
|
||||
import { UpdateOrganizationRequest } from '../model/updateOrganizationRequest';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class OrganizationService extends BaseService {
|
||||
constructor(
|
||||
protected httpClient: HttpClient,
|
||||
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||
@Optional() configuration?: Configuration,
|
||||
) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
/**
|
||||
* Create Organization
|
||||
* @endpoint post /api/organizations
|
||||
* @param createOrganizationRequest
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public createOrganisation(
|
||||
createOrganizationRequest: CreateOrganizationRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
||||
public createOrganisation(
|
||||
createOrganizationRequest: CreateOrganizationRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<
|
||||
HttpResponse<InseOrganizationManagementModelOrganizationProfile>
|
||||
>;
|
||||
public createOrganisation(
|
||||
createOrganizationRequest: CreateOrganizationRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
||||
public createOrganisation(
|
||||
createOrganizationRequest: CreateOrganizationRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (
|
||||
createOrganizationRequest === null ||
|
||||
createOrganizationRequest === undefined
|
||||
) {
|
||||
throw new Error(
|
||||
'Required parameter createOrganizationRequest was null or undefined when calling createOrganisation.',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Organization
|
||||
* @endpoint post /api/organizations
|
||||
* @param createOrganizationRequest
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
||||
public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InseOrganizationManagementModelOrganizationProfile>>;
|
||||
public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
||||
public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (createOrganizationRequest === null || createOrganizationRequest === undefined) {
|
||||
throw new Error('Required parameter createOrganizationRequest was null or undefined when calling createOrganisation.');
|
||||
}
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'HTTPBearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
);
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Accept',
|
||||
localVarHttpHeaderAcceptSelected,
|
||||
);
|
||||
}
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
const localVarHttpContext: HttpContext =
|
||||
options?.context ?? new HttpContext();
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = ['application/json'];
|
||||
const httpContentTypeSelected: string | undefined =
|
||||
this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Content-Type',
|
||||
httpContentTypeSelected,
|
||||
);
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (
|
||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||
) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
let localVarPath = `/api/organizations`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>(
|
||||
'post',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: createOrganizationRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Delete Organization
|
||||
* @endpoint delete /api/organizations/{organization_id}
|
||||
* @param organizationId
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public deleteOrganisation(
|
||||
organizationId: string,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any>;
|
||||
public deleteOrganisation(
|
||||
organizationId: string,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<any>>;
|
||||
public deleteOrganisation(
|
||||
organizationId: string,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<any>>;
|
||||
public deleteOrganisation(
|
||||
organizationId: string,
|
||||
secureFgpAcc?: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (organizationId === null || organizationId === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter organizationId was null or undefined when calling deleteOrganisation.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarPath = `/api/organizations`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: createOrganizationRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'HTTPBearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
);
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Accept',
|
||||
localVarHttpHeaderAcceptSelected,
|
||||
);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext =
|
||||
options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (
|
||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||
) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/organizations/${this.configuration.encodeParam({ name: 'organizationId', value: organizationId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: 'uuid' })}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<any>(
|
||||
'delete',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Organizations
|
||||
* @endpoint get /api/organizations
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @param offset
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getOrganisations(
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
offset?: number,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<OrganizationPage>;
|
||||
public getOrganisations(
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
offset?: number,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<OrganizationPage>>;
|
||||
public getOrganisations(
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
offset?: number,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<OrganizationPage>>;
|
||||
public getOrganisations(
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
offset?: number,
|
||||
secureFgpAcc?: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>page,
|
||||
'page',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>pageSize,
|
||||
'page_size',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>offset,
|
||||
'offset',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'HTTPBearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
);
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Accept',
|
||||
localVarHttpHeaderAcceptSelected,
|
||||
);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext =
|
||||
options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (
|
||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||
) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/organizations`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<OrganizationPage>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Organization Institution Associations
|
||||
* @endpoint get /api/organizations/institutions/associations
|
||||
* @param institutionIds
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getOrganizationInstitutionAssociations(
|
||||
institutionIds: Array<string>,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Array<InstitutionAssociationsResponse>>;
|
||||
public getOrganizationInstitutionAssociations(
|
||||
institutionIds: Array<string>,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Array<InstitutionAssociationsResponse>>>;
|
||||
public getOrganizationInstitutionAssociations(
|
||||
institutionIds: Array<string>,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Array<InstitutionAssociationsResponse>>>;
|
||||
public getOrganizationInstitutionAssociations(
|
||||
institutionIds: Array<string>,
|
||||
secureFgpAcc?: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (institutionIds === null || institutionIds === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter institutionIds was null or undefined when calling getOrganizationInstitutionAssociations.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||
if (institutionIds) {
|
||||
institutionIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>element,
|
||||
'institution_ids',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Organization
|
||||
* @endpoint delete /api/organizations/{organization_id}
|
||||
* @param organizationId
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
||||
public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
||||
public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
||||
public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (organizationId === null || organizationId === undefined) {
|
||||
throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganisation.');
|
||||
}
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'HTTPBearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
);
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/organizations/${this.configuration.encodeParam({name: "organizationId", value: organizationId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<any>('delete', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Accept',
|
||||
localVarHttpHeaderAcceptSelected,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Organizations
|
||||
* @endpoint get /api/organizations
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @param offset
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<OrganizationPage>;
|
||||
public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<OrganizationPage>>;
|
||||
public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<OrganizationPage>>;
|
||||
public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
const localVarHttpContext: HttpContext =
|
||||
options?.context ?? new HttpContext();
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>page, 'page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>pageSize, 'page_size');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>offset, 'offset');
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/organizations`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<OrganizationPage>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (
|
||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||
) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Organization
|
||||
* @endpoint put /api/organizations/{organization_id}
|
||||
* @param organizationId
|
||||
* @param updateOrganizationRequest
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InseOrganizationManagementModelOrganizationProfile>>;
|
||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (organizationId === null || organizationId === undefined) {
|
||||
throw new Error('Required parameter organizationId was null or undefined when calling updateOrganisation.');
|
||||
}
|
||||
if (updateOrganizationRequest === null || updateOrganizationRequest === undefined) {
|
||||
throw new Error('Required parameter updateOrganizationRequest was null or undefined when calling updateOrganisation.');
|
||||
}
|
||||
let localVarPath = `/api/organizations/institutions/associations`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<InstitutionAssociationsResponse>>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/organizations/${this.configuration.encodeParam({name: "organizationId", value: organizationId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>('put', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: updateOrganizationRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
/**
|
||||
* Update Organization
|
||||
* @endpoint put /api/organizations/{organization_id}
|
||||
* @param organizationId
|
||||
* @param updateOrganizationRequest
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public updateOrganisation(
|
||||
organizationId: string,
|
||||
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
||||
public updateOrganisation(
|
||||
organizationId: string,
|
||||
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<
|
||||
HttpResponse<InseOrganizationManagementModelOrganizationProfile>
|
||||
>;
|
||||
public updateOrganisation(
|
||||
organizationId: string,
|
||||
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
||||
public updateOrganisation(
|
||||
organizationId: string,
|
||||
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (organizationId === null || organizationId === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter organizationId was null or undefined when calling updateOrganisation.',
|
||||
);
|
||||
}
|
||||
if (
|
||||
updateOrganizationRequest === null ||
|
||||
updateOrganizationRequest === undefined
|
||||
) {
|
||||
throw new Error(
|
||||
'Required parameter updateOrganizationRequest was null or undefined when calling updateOrganisation.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'HTTPBearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
);
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Accept',
|
||||
localVarHttpHeaderAcceptSelected,
|
||||
);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext =
|
||||
options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = ['application/json'];
|
||||
const httpContentTypeSelected: string | undefined =
|
||||
this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Content-Type',
|
||||
httpContentTypeSelected,
|
||||
);
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (
|
||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||
) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/organizations/${this.configuration.encodeParam({ name: 'organizationId', value: organizationId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: 'uuid' })}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>(
|
||||
'put',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: updateOrganizationRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface CreateOrganizationRequest {
|
||||
name: string;
|
||||
other_inst_id?: string | null;
|
||||
export interface CreateOrganizationRequest {
|
||||
name: string;
|
||||
other_inst_id?: string | null;
|
||||
selected_openalex_institution_ids?: Array<string> | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface InseOrganizationManagementModelOrganizationProfile {
|
||||
id: string;
|
||||
name: string;
|
||||
other_inst_id?: string | null;
|
||||
deleted: boolean;
|
||||
member_count: number;
|
||||
export interface InseOrganizationManagementModelOrganizationProfile {
|
||||
id: string;
|
||||
name: string;
|
||||
other_inst_id?: string | null;
|
||||
selected_openalex_institution_ids?: Array<string>;
|
||||
deleted: boolean;
|
||||
member_count: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export interface InstitutionAssociation {
|
||||
id: string;
|
||||
display_name: string;
|
||||
relationship: InstitutionAssociation.RelationshipEnum;
|
||||
}
|
||||
export namespace InstitutionAssociation {
|
||||
export const RelationshipEnum = {
|
||||
Child: 'child',
|
||||
Related: 'related',
|
||||
} as const;
|
||||
export type RelationshipEnum =
|
||||
(typeof RelationshipEnum)[keyof typeof RelationshipEnum];
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { InstitutionAssociation } from './institutionAssociation';
|
||||
|
||||
export interface InstitutionAssociationsResponse {
|
||||
id: string;
|
||||
display_name: string;
|
||||
associated_institutions?: Array<InstitutionAssociation>;
|
||||
}
|
||||
@@ -134,6 +134,8 @@ export * from './idTokenMetadata';
|
||||
export * from './inseAccountManagementModelOrganizationProfile';
|
||||
export * from './inseOrganizationManagementModelOrganizationProfile';
|
||||
export * from './institution';
|
||||
export * from './institutionAssociation';
|
||||
export * from './institutionAssociationsResponse';
|
||||
export * from './institutionFunderSummary';
|
||||
export * from './institutionGeo';
|
||||
export * from './institutionIds';
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface UpdateOrganizationRequest {
|
||||
name?: string | null;
|
||||
other_inst_id?: string | null;
|
||||
deleted?: boolean | null;
|
||||
export interface UpdateOrganizationRequest {
|
||||
name?: string | null;
|
||||
other_inst_id?: string | null;
|
||||
selected_openalex_institution_ids?: Array<string> | null;
|
||||
deleted?: boolean | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,22 @@
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="account-toolbar">
|
||||
<app-query-param-input
|
||||
class="account-search"
|
||||
queryParamKey="search"
|
||||
label="Nach Name oder E-Mail suchen" />
|
||||
<app-query-param-selector
|
||||
class="account-organization"
|
||||
queryParamKey="organization_id"
|
||||
[options]="selectorOptions()"
|
||||
label="Organisation"
|
||||
[allowEmptyValue]="true" />
|
||||
@if (!isReadOnly) {
|
||||
<button
|
||||
class="create-account-button"
|
||||
mat-flat-button
|
||||
color="primary"
|
||||
type="button"
|
||||
@@ -21,19 +35,6 @@
|
||||
Neuer Account
|
||||
</button>
|
||||
}
|
||||
</header>
|
||||
|
||||
<section style="display: flex; gap: 1rem; align-items: center">
|
||||
<app-query-param-input
|
||||
queryParamKey="search"
|
||||
label="Nach Name oder E-Mail suchen"
|
||||
style="width: 35%" />
|
||||
<app-query-param-selector
|
||||
queryParamKey="organization_id"
|
||||
[options]="selectorOptions()"
|
||||
label="Organisation"
|
||||
[allowEmptyValue]="true"
|
||||
style="width: 25%" />
|
||||
</section>
|
||||
<mat-card appearance="outlined">
|
||||
<mat-card-content>
|
||||
|
||||
@@ -19,6 +19,25 @@
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.account-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.account-search {
|
||||
flex: 0 1 35%;
|
||||
}
|
||||
|
||||
.account-organization {
|
||||
flex: 0 1 25%;
|
||||
}
|
||||
|
||||
.create-account-button {
|
||||
flex: 0 0 auto;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
p {
|
||||
@@ -155,6 +174,22 @@ tr.deactivated:not(.deleted) {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.account-toolbar {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.account-search,
|
||||
.account-organization {
|
||||
flex-basis: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.create-account-button {
|
||||
align-self: flex-start;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
mat-card,
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import {
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialogActions,
|
||||
MatDialogContent,
|
||||
MatDialogRef,
|
||||
MatDialogTitle,
|
||||
} from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-institution-removal-dialog',
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatButtonModule,
|
||||
MatDialogActions,
|
||||
MatDialogContent,
|
||||
MatDialogTitle,
|
||||
],
|
||||
template: `
|
||||
<h3 mat-dialog-title>Manuelle Auswahl entfernen</h3>
|
||||
<mat-dialog-content>
|
||||
<p>
|
||||
Möchtest du die manuelle Auswahl der Institution „{{
|
||||
data.institutionName
|
||||
}}“ wirklich entfernen?
|
||||
</p>
|
||||
@if (data.dependentCount === 1) {
|
||||
<p>
|
||||
Dadurch wird außerdem 1 automatisch zugeordnete Institution aus der
|
||||
Organisation entfernt.
|
||||
</p>
|
||||
} @else if (data.dependentCount > 1) {
|
||||
<p>
|
||||
Dadurch werden außerdem {{ data.dependentCount }} automatisch
|
||||
zugeordnete Institutionen aus der Organisation entfernt.
|
||||
</p>
|
||||
}
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-button type="button" (click)="close()">Abbrechen</button>
|
||||
<button mat-flat-button color="primary" type="button" (click)="confirm()">
|
||||
Entfernen
|
||||
</button>
|
||||
</mat-dialog-actions>
|
||||
`,
|
||||
})
|
||||
export class InstitutionRemovalDialogComponent {
|
||||
private readonly dialogRef =
|
||||
inject<MatDialogRef<InstitutionRemovalDialogComponent, boolean>>(
|
||||
MatDialogRef,
|
||||
);
|
||||
protected readonly data = inject<{
|
||||
institutionName: string;
|
||||
dependentCount: number;
|
||||
}>(MAT_DIALOG_DATA);
|
||||
|
||||
protected close(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
|
||||
protected confirm(): void {
|
||||
this.dialogRef.close(true);
|
||||
}
|
||||
}
|
||||
+85
-5
@@ -16,10 +16,85 @@
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Externe Institutions-ID</mat-label>
|
||||
<input matInput formControlName="otherInstId" />
|
||||
</mat-form-field>
|
||||
<section class="institution-section">
|
||||
<div class="section-heading">
|
||||
<div>
|
||||
<h3>OpenAlex-Institutionen</h3>
|
||||
<p>
|
||||
Bei der Auswahl werden untergeordnete und verbundene Institutionen
|
||||
automatisch ergänzt.
|
||||
</p>
|
||||
</div>
|
||||
@if (isLoadingAssociations()) {
|
||||
<mat-spinner diameter="24" />
|
||||
}
|
||||
</div>
|
||||
|
||||
<mat-form-field appearance="outline" subscriptSizing="dynamic">
|
||||
<mat-label>Institution hinzufügen</mat-label>
|
||||
<mat-icon matPrefix>search</mat-icon>
|
||||
<input
|
||||
matInput
|
||||
type="text"
|
||||
placeholder="Name der Institution eingeben"
|
||||
[formControl]="institutionSearch"
|
||||
[matAutocomplete]="institutionAutocomplete"
|
||||
[readonly]="isLoadingAssociations()" />
|
||||
@if (isSearchingInstitutions()) {
|
||||
<mat-spinner matSuffix diameter="20" />
|
||||
}
|
||||
<mat-autocomplete
|
||||
#institutionAutocomplete="matAutocomplete"
|
||||
[displayWith]="displayInstitution"
|
||||
(optionSelected)="selectAutocompleteInstitution($event)">
|
||||
@for (
|
||||
institution of institutionSearchResults();
|
||||
track institution.id
|
||||
) {
|
||||
<mat-option [value]="institution">
|
||||
<span>{{ institution.display_name }}</span>
|
||||
<small class="autocomplete-description">
|
||||
{{ institution.country_code }} · {{ institution.type }}
|
||||
</small>
|
||||
</mat-option>
|
||||
}
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
|
||||
<div class="institution-list" aria-live="polite">
|
||||
@for (entry of institutions(); track entry.id) {
|
||||
<article class="institution-item">
|
||||
<mat-icon class="institution-icon">apartment</mat-icon>
|
||||
<div class="institution-details">
|
||||
<strong>{{ entry.institution.display_name }}</strong>
|
||||
<span class="institution-id">{{ entry.id }}</span>
|
||||
<div class="origin-labels">
|
||||
@for (label of originLabels(entry); track label.relationship) {
|
||||
<span
|
||||
class="origin-label"
|
||||
[matTooltip]="label.tooltip ?? ''"
|
||||
[matTooltipDisabled]="!label.tooltip"
|
||||
matTooltipClass="institution-origin-tooltip">
|
||||
{{ label.label }}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@if (entry.manuallySelected) {
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
aria-label="Manuelle Auswahl entfernen"
|
||||
(click)="removeInstitution(entry)">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
}
|
||||
</article>
|
||||
} @empty {
|
||||
<p class="empty-institutions">Noch keine Institution ausgewählt.</p>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@if (data.mode === 'edit') {
|
||||
<mat-checkbox formControlName="deleted">
|
||||
@@ -31,7 +106,12 @@
|
||||
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-button type="button" (click)="close()">Abbrechen</button>
|
||||
<button mat-flat-button color="primary" type="button" (click)="submit()">
|
||||
<button
|
||||
mat-flat-button
|
||||
color="primary"
|
||||
type="button"
|
||||
[disabled]="isLoadingAssociations()"
|
||||
(click)="submit()">
|
||||
<mat-icon>save</mat-icon>
|
||||
Speichern
|
||||
</button>
|
||||
|
||||
+93
-3
@@ -1,7 +1,7 @@
|
||||
.organization-form {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
min-width: min(540px, calc(100vw - 64px));
|
||||
gap: 18px;
|
||||
min-width: min(680px, calc(100vw - 64px));
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,101 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.institution-section {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.section-heading {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.section-heading h3 {
|
||||
margin: 0 0 4px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.section-heading p,
|
||||
.empty-institutions {
|
||||
margin: 0;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.institution-list {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
max-height: 320px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.autocomplete-description {
|
||||
display: block;
|
||||
color: var(--sg-text-muted);
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.institution-item {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 8px 10px 12px;
|
||||
border: 1px solid var(--sg-border-color, #d8d8d8);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.institution-icon {
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.institution-details {
|
||||
display: grid;
|
||||
min-width: 0;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.institution-details strong {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.institution-id {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.origin-labels {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 5px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.origin-label {
|
||||
padding: 2px 7px;
|
||||
border-radius: 999px;
|
||||
background: color-mix(in srgb, var(--mat-sys-primary) 10%, transparent);
|
||||
color: var(--mat-sys-primary);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.empty-institutions {
|
||||
padding: 14px;
|
||||
border: 1px dashed var(--sg-border-color, #d8d8d8);
|
||||
border-radius: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
mat-dialog-actions {
|
||||
padding: 12px 24px 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
@media (max-width: 760px) {
|
||||
.organization-form {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
+266
-20
@@ -1,58 +1,108 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Component, computed, DestroyRef, inject, signal } from '@angular/core';
|
||||
import {
|
||||
FormControl,
|
||||
FormGroup,
|
||||
ReactiveFormsModule,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
import {
|
||||
MatAutocompleteModule,
|
||||
MatAutocompleteSelectedEvent,
|
||||
} from '@angular/material/autocomplete';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import {
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialog,
|
||||
MatDialogModule,
|
||||
MatDialogRef,
|
||||
} from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { InseOrganizationManagementModelOrganizationProfile } from '../../../api';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import {
|
||||
catchError,
|
||||
debounceTime,
|
||||
distinctUntilChanged,
|
||||
finalize,
|
||||
of,
|
||||
switchMap,
|
||||
} from 'rxjs';
|
||||
import {
|
||||
CreateOrganizationRequest,
|
||||
InseOrganizationManagementModelOrganizationProfile,
|
||||
Institution,
|
||||
InstitutionAssociation,
|
||||
InstitutionAssociationsResponse,
|
||||
InstitutionsV2Service,
|
||||
OrganizationService,
|
||||
UpdateOrganizationRequest,
|
||||
} from '../../../api';
|
||||
import { InstitutionRemovalDialogComponent } from './institution-removal-dialog.component';
|
||||
|
||||
export interface CreateOrganizationPayload {
|
||||
name: string;
|
||||
other_inst_id?: string | null;
|
||||
type Relationship = InstitutionAssociation.RelationshipEnum;
|
||||
|
||||
interface InstitutionOrigin {
|
||||
sourceId: string;
|
||||
sourceName: string;
|
||||
relationship: Relationship;
|
||||
}
|
||||
|
||||
export interface UpdateOrganizationPayload {
|
||||
name?: string;
|
||||
other_inst_id?: string | null;
|
||||
deleted?: boolean;
|
||||
interface EditableInstitution {
|
||||
id: string;
|
||||
institution: Institution;
|
||||
manuallySelected: boolean;
|
||||
origins: InstitutionOrigin[];
|
||||
}
|
||||
|
||||
interface OriginLabel {
|
||||
relationship: 'selected' | Relationship;
|
||||
label: string;
|
||||
tooltip?: string;
|
||||
}
|
||||
|
||||
type OrganizationWithInstitutions =
|
||||
InseOrganizationManagementModelOrganizationProfile & {
|
||||
institutionAssociations?: InstitutionAssociationsResponse[];
|
||||
};
|
||||
|
||||
export interface OrganizationDialogData {
|
||||
mode: 'create' | 'edit';
|
||||
organization?: InseOrganizationManagementModelOrganizationProfile;
|
||||
organization?: OrganizationWithInstitutions;
|
||||
isCurrentOrganization?: boolean;
|
||||
}
|
||||
|
||||
export type OrganizationDialogResult =
|
||||
| { mode: 'create'; payload: CreateOrganizationPayload }
|
||||
| { mode: 'create'; payload: CreateOrganizationRequest }
|
||||
| {
|
||||
mode: 'edit';
|
||||
organizationId: string;
|
||||
payload: UpdateOrganizationPayload;
|
||||
payload: UpdateOrganizationRequest;
|
||||
};
|
||||
|
||||
const cleanInstitutionId = (id: string): string =>
|
||||
id.split('/').filter(Boolean).pop() ?? id;
|
||||
|
||||
@Component({
|
||||
selector: 'app-organization-dialog',
|
||||
imports: [
|
||||
CommonModule,
|
||||
ReactiveFormsModule,
|
||||
MatAutocompleteModule,
|
||||
MatButtonModule,
|
||||
MatCheckboxModule,
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSnackBarModule,
|
||||
MatTooltipModule,
|
||||
],
|
||||
templateUrl: './organization-dialog.component.html',
|
||||
styleUrl: './organization-dialog.component.scss',
|
||||
@@ -66,23 +116,217 @@ export class OrganizationDialogComponent {
|
||||
OrganizationDialogResult | undefined
|
||||
>
|
||||
>(MatDialogRef);
|
||||
private readonly dialog = inject(MatDialog);
|
||||
private readonly organizationService = inject(OrganizationService);
|
||||
private readonly institutionsService = inject(InstitutionsV2Service);
|
||||
private readonly snackBar = inject(MatSnackBar);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
protected readonly data = inject<OrganizationDialogData>(MAT_DIALOG_DATA);
|
||||
|
||||
protected readonly isLoadingAssociations = signal(false);
|
||||
protected readonly isSearchingInstitutions = signal(false);
|
||||
protected readonly institutionSearchResults = signal<Institution[]>([]);
|
||||
private readonly selectedAssociations = signal<
|
||||
InstitutionAssociationsResponse[]
|
||||
>([...(this.data.organization?.institutionAssociations ?? [])]);
|
||||
protected readonly institutions = computed(() =>
|
||||
this.expandInstitutions(this.selectedAssociations()),
|
||||
);
|
||||
protected readonly institutionSearch = new FormControl<string | Institution>(
|
||||
'',
|
||||
{ nonNullable: true },
|
||||
);
|
||||
|
||||
protected readonly form = new FormGroup({
|
||||
name: new FormControl(this.data.organization?.name ?? '', {
|
||||
nonNullable: true,
|
||||
validators: [Validators.required],
|
||||
}),
|
||||
otherInstId: new FormControl(this.data.organization?.other_inst_id ?? '', {
|
||||
nonNullable: true,
|
||||
}),
|
||||
deleted: new FormControl(this.data.organization?.deleted ?? false, {
|
||||
nonNullable: true,
|
||||
}),
|
||||
deleted: new FormControl(
|
||||
{
|
||||
value: this.data.organization?.deleted ?? false,
|
||||
disabled: this.data.isCurrentOrganization ?? false,
|
||||
},
|
||||
{ nonNullable: true },
|
||||
),
|
||||
});
|
||||
|
||||
constructor() {
|
||||
this.institutionSearch.valueChanges
|
||||
.pipe(
|
||||
debounceTime(300),
|
||||
distinctUntilChanged(),
|
||||
switchMap((value) => {
|
||||
if (typeof value !== 'string' || !value.trim()) {
|
||||
this.isSearchingInstitutions.set(false);
|
||||
return of({ elements: [] as Institution[] });
|
||||
}
|
||||
this.isSearchingInstitutions.set(true);
|
||||
return this.institutionsService
|
||||
.getInstitutionAutocompleteForSelector(value.trim())
|
||||
.pipe(
|
||||
catchError(() => {
|
||||
this.snackBar.open(
|
||||
'Institutionen konnten nicht geladen werden. Bitte versuche es später erneut.',
|
||||
'OK',
|
||||
{ duration: 5000 },
|
||||
);
|
||||
return of({ elements: [] as Institution[] });
|
||||
}),
|
||||
finalize(() => this.isSearchingInstitutions.set(false)),
|
||||
);
|
||||
}),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((page) =>
|
||||
this.institutionSearchResults.set(page.elements ?? []),
|
||||
);
|
||||
}
|
||||
|
||||
private expandInstitutions(
|
||||
roots: InstitutionAssociationsResponse[],
|
||||
): EditableInstitution[] {
|
||||
const entries = new Map<string, EditableInstitution>();
|
||||
for (const root of roots) {
|
||||
const id = cleanInstitutionId(root.id);
|
||||
entries.set(id, {
|
||||
id,
|
||||
institution: {
|
||||
id: `https://openalex.org/${id}`,
|
||||
display_name: root.display_name,
|
||||
},
|
||||
manuallySelected: true,
|
||||
origins: [],
|
||||
});
|
||||
}
|
||||
for (const root of roots) {
|
||||
const sourceId = cleanInstitutionId(root.id);
|
||||
for (const association of root.associated_institutions ?? []) {
|
||||
const id = cleanInstitutionId(association.id);
|
||||
const entry = entries.get(id) ?? {
|
||||
id,
|
||||
institution: {
|
||||
id: `https://openalex.org/${id}`,
|
||||
display_name: association.display_name,
|
||||
},
|
||||
manuallySelected: false,
|
||||
origins: [],
|
||||
};
|
||||
entry.origins.push({
|
||||
sourceId,
|
||||
sourceName: root.display_name,
|
||||
relationship: association.relationship,
|
||||
});
|
||||
entries.set(id, entry);
|
||||
}
|
||||
}
|
||||
return [...entries.values()];
|
||||
}
|
||||
|
||||
protected selectInstitution(institution: Institution): void {
|
||||
if (!institution.id || this.isLoadingAssociations()) return;
|
||||
|
||||
const selectedId = cleanInstitutionId(institution.id);
|
||||
this.isLoadingAssociations.set(true);
|
||||
this.organizationService
|
||||
.getOrganizationInstitutionAssociations([selectedId])
|
||||
.pipe(finalize(() => this.isLoadingAssociations.set(false)))
|
||||
.subscribe({
|
||||
next: ([response]) => {
|
||||
if (!response) return;
|
||||
const roots = [...this.selectedAssociations()];
|
||||
const existingIndex = roots.findIndex(
|
||||
(root) => cleanInstitutionId(root.id) === selectedId,
|
||||
);
|
||||
if (existingIndex === -1) roots.push(response);
|
||||
else roots[existingIndex] = response;
|
||||
this.selectedAssociations.set(roots);
|
||||
},
|
||||
error: () => {
|
||||
this.snackBar.open(
|
||||
'Die Institution konnte nicht hinzugefügt werden. Bitte versuche es später erneut.',
|
||||
'OK',
|
||||
{ duration: 5000 },
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
protected selectAutocompleteInstitution(
|
||||
event: MatAutocompleteSelectedEvent,
|
||||
): void {
|
||||
const institution = event.option.value as Institution;
|
||||
this.institutionSearch.setValue('', { emitEvent: false });
|
||||
this.institutionSearchResults.set([]);
|
||||
this.selectInstitution(institution);
|
||||
}
|
||||
|
||||
protected displayInstitution(institution: Institution | string): string {
|
||||
return typeof institution === 'string'
|
||||
? institution
|
||||
: (institution.display_name ?? '');
|
||||
}
|
||||
|
||||
protected originLabels(entry: EditableInstitution): OriginLabel[] {
|
||||
const labels: OriginLabel[] = [];
|
||||
if (entry.manuallySelected) {
|
||||
labels.push({ relationship: 'selected', label: 'Manuell ausgewählt' });
|
||||
}
|
||||
for (const relationship of ['child', 'related'] as const) {
|
||||
const sourceNames = [
|
||||
...new Set(
|
||||
entry.origins
|
||||
.filter((origin) => origin.relationship === relationship)
|
||||
.map((origin) => origin.sourceName),
|
||||
),
|
||||
];
|
||||
if (sourceNames.length === 0) continue;
|
||||
labels.push({
|
||||
relationship,
|
||||
label: relationship === 'child' ? 'Untergeordnet' : 'Verbunden',
|
||||
tooltip: `Automatisch hinzugefügt durch:\n${sourceNames.map((name) => `• ${name}`).join('\n')}`,
|
||||
});
|
||||
}
|
||||
return labels;
|
||||
}
|
||||
|
||||
protected removeInstitution(entry: EditableInstitution): void {
|
||||
if (!entry.manuallySelected) return;
|
||||
|
||||
const remainingRoots = this.selectedAssociations().filter(
|
||||
(root) => cleanInstitutionId(root.id) !== entry.id,
|
||||
);
|
||||
const remainingIds = new Set(
|
||||
this.expandInstitutions(remainingRoots).map(
|
||||
(institution) => institution.id,
|
||||
),
|
||||
);
|
||||
const dependentCount = this.institutions().filter(
|
||||
(institution) =>
|
||||
institution.id !== entry.id && !remainingIds.has(institution.id),
|
||||
).length;
|
||||
|
||||
this.dialog
|
||||
.open<
|
||||
InstitutionRemovalDialogComponent,
|
||||
{ institutionName: string; dependentCount: number },
|
||||
boolean | undefined
|
||||
>(InstitutionRemovalDialogComponent, {
|
||||
data: {
|
||||
institutionName: entry.institution.display_name ?? entry.id,
|
||||
dependentCount,
|
||||
},
|
||||
width: '520px',
|
||||
maxWidth: 'calc(100vw - 32px)',
|
||||
})
|
||||
.afterClosed()
|
||||
.subscribe((confirmed) => {
|
||||
if (confirmed) this.selectedAssociations.set(remainingRoots);
|
||||
});
|
||||
}
|
||||
|
||||
protected submit(): void {
|
||||
if (this.form.invalid) {
|
||||
if (this.form.invalid || this.isLoadingAssociations()) {
|
||||
this.form.markAllAsTouched();
|
||||
return;
|
||||
}
|
||||
@@ -90,7 +334,9 @@ export class OrganizationDialogComponent {
|
||||
const value = this.form.getRawValue();
|
||||
const payload = {
|
||||
name: value.name.trim(),
|
||||
other_inst_id: value.otherInstId.trim(),
|
||||
selected_openalex_institution_ids: this.selectedAssociations().map(
|
||||
(root) => cleanInstitutionId(root.id),
|
||||
),
|
||||
};
|
||||
|
||||
if (this.data.mode === 'create') {
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
<section class="organizations-page">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<h1>Organisationen</h1>
|
||||
<p>Mandanten, externe Institutions-IDs und Status verwalten.</p>
|
||||
<!-- Was meinte die KI mit Mandanten? -->
|
||||
<h1>Organisationen</h1>
|
||||
<div class="page-header-meta">
|
||||
<p>Organisationen verwalten, OpenAlex-Institutionen zuordnen und Status festlegen</p>
|
||||
<button
|
||||
mat-flat-button
|
||||
color="primary"
|
||||
type="button"
|
||||
(click)="startCreate()">
|
||||
<mat-icon>add_business</mat-icon>
|
||||
Neue Organisation
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
mat-flat-button
|
||||
color="primary"
|
||||
type="button"
|
||||
(click)="startCreate()">
|
||||
<mat-icon>add_business</mat-icon>
|
||||
Neue Organisation
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<mat-card appearance="outlined">
|
||||
@@ -31,6 +30,32 @@
|
||||
</span>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #organizationInstitutionsTmp let-row>
|
||||
@if ($any(row).institutions.length > 0) {
|
||||
<span>
|
||||
@for (
|
||||
institution of $any(row).institutions;
|
||||
track institution.id;
|
||||
let index = $index
|
||||
) {
|
||||
@if (index < 3) {
|
||||
{{ institution.display_name
|
||||
}}{{
|
||||
index < 2 && index < $any(row).institutions.length - 1 ? ', ' : ''
|
||||
}}
|
||||
}
|
||||
}
|
||||
@if ($any(row).institutions.length > 3) {
|
||||
<span class="more-institutions">
|
||||
+ {{ $any(row).institutions.length - 3 }} weitere
|
||||
</span>
|
||||
}
|
||||
</span>
|
||||
} @else {
|
||||
<span class="no-institutions">Keine Institutionen</span>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #organizationActionsTmp let-row>
|
||||
<div class="row-actions">
|
||||
<button
|
||||
@@ -44,7 +69,7 @@
|
||||
mat-icon-button
|
||||
type="button"
|
||||
aria-label="Deaktivieren"
|
||||
[disabled]="row.deleted"
|
||||
[disabled]="row.deleted || isCurrentOrganization(row)"
|
||||
(click)="deleteOrganization(row)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.page-header-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
@@ -24,7 +30,7 @@ p {
|
||||
}
|
||||
|
||||
.page-header p {
|
||||
margin-top: 6px;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.status {
|
||||
@@ -49,7 +55,7 @@ p {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
.page-header-meta {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
@@ -59,3 +65,8 @@ mat-card,
|
||||
mat-paginator {
|
||||
background-color: var(--sg-background);
|
||||
}
|
||||
|
||||
.more-institutions,
|
||||
.no-institutions {
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
@@ -16,11 +16,7 @@ import type {
|
||||
OrganizationDialogData,
|
||||
OrganizationDialogResult,
|
||||
} from './organization-dialog/organization-dialog.component';
|
||||
import {
|
||||
InseOrganizationManagementModelOrganizationProfile,
|
||||
OrganizationPage,
|
||||
OrganizationService,
|
||||
} from '../../api';
|
||||
import { OrganizationService } from '../../api';
|
||||
import {
|
||||
GenericColumn,
|
||||
DataTableComponent,
|
||||
@@ -29,6 +25,11 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { StatusPipe } from '../../shared/pipes/status.pipe';
|
||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
import { Router } from '@angular/router';
|
||||
import {
|
||||
OrganizationPageWithInstitutions,
|
||||
OrganizationWithInstitutions,
|
||||
} from '../../resolvers/organizations-organizations.resolver';
|
||||
import { CredentialService } from '../../shared/services/credential.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-organizations',
|
||||
@@ -52,10 +53,10 @@ export class OrganizationsComponent implements OnInit {
|
||||
private readonly dialog = inject(MatDialog);
|
||||
private readonly snackBar = inject(MatSnackBar);
|
||||
private readonly organizationService = inject(OrganizationService);
|
||||
private readonly credentialService = inject(CredentialService);
|
||||
|
||||
organizationPage = input.required<OrganizationPage>();
|
||||
organizationColumns: GenericColumn<InseOrganizationManagementModelOrganizationProfile>[] =
|
||||
[];
|
||||
organizationPage = input.required<OrganizationPageWithInstitutions>();
|
||||
organizationColumns: GenericColumn<OrganizationWithInstitutions>[] = [];
|
||||
|
||||
organizationStatusTmp = viewChild.required<TemplateRef<any>>(
|
||||
'organizationStatusTmp',
|
||||
@@ -63,6 +64,9 @@ export class OrganizationsComponent implements OnInit {
|
||||
organizationActionsTmp = viewChild.required<TemplateRef<any>>(
|
||||
'organizationActionsTmp',
|
||||
);
|
||||
organizationInstitutionsTmp = viewChild.required<TemplateRef<any>>(
|
||||
'organizationInstitutionsTmp',
|
||||
);
|
||||
|
||||
ngOnInit(): void {
|
||||
this.organizationColumns = [
|
||||
@@ -73,10 +77,10 @@ export class OrganizationsComponent implements OnInit {
|
||||
accessorKey: 'name',
|
||||
},
|
||||
{
|
||||
id: 'other_inst_id',
|
||||
header: 'Externe ID',
|
||||
type: 'accessor',
|
||||
accessorKey: 'other_inst_id',
|
||||
id: 'institutions',
|
||||
header: 'OpenAlex-Institutionen',
|
||||
type: 'display',
|
||||
cellTemplate: this.organizationInstitutionsTmp(),
|
||||
},
|
||||
{
|
||||
id: 'member_count',
|
||||
@@ -104,16 +108,29 @@ export class OrganizationsComponent implements OnInit {
|
||||
this.openDialog({ mode: 'create' });
|
||||
}
|
||||
|
||||
protected startEdit(
|
||||
organization: InseOrganizationManagementModelOrganizationProfile,
|
||||
): void {
|
||||
this.openDialog({ mode: 'edit', organization });
|
||||
protected startEdit(organization: OrganizationWithInstitutions): void {
|
||||
this.openDialog({
|
||||
mode: 'edit',
|
||||
organization,
|
||||
isCurrentOrganization: this.isCurrentOrganization(organization),
|
||||
});
|
||||
}
|
||||
|
||||
protected isCurrentOrganization(
|
||||
organization: OrganizationWithInstitutions,
|
||||
): boolean {
|
||||
return organization.id === this.credentialService.effectiveOrganizationId();
|
||||
}
|
||||
|
||||
protected deleteOrganization(
|
||||
organization: InseOrganizationManagementModelOrganizationProfile,
|
||||
organization: OrganizationWithInstitutions,
|
||||
): void {
|
||||
if (organization.deleted) return;
|
||||
if (
|
||||
organization.deleted ||
|
||||
this.isCurrentOrganization(organization)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
import('../../shared/ui/confirmation-dialog/confirmation-dialog.component').then(
|
||||
({ ConfirmationDialogComponent }) => {
|
||||
@@ -134,7 +151,7 @@ export class OrganizationsComponent implements OnInit {
|
||||
}
|
||||
|
||||
private softDeleteOrganization(
|
||||
organization: InseOrganizationManagementModelOrganizationProfile,
|
||||
organization: OrganizationWithInstitutions,
|
||||
): void {
|
||||
this.organizationService.deleteOrganisation(organization.id).subscribe({
|
||||
next: () => {
|
||||
@@ -146,8 +163,12 @@ export class OrganizationsComponent implements OnInit {
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
},
|
||||
error: () =>
|
||||
this.showError('Organisation konnte nicht deaktiviert werden.'),
|
||||
error: (error) =>
|
||||
this.showError(
|
||||
this.isProtectedOrganizationError(error)
|
||||
? 'Die eigene Organisation kann nicht deaktiviert werden.'
|
||||
: 'Organisation konnte nicht deaktiviert werden.',
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -159,7 +180,7 @@ export class OrganizationsComponent implements OnInit {
|
||||
OrganizationDialogData,
|
||||
OrganizationDialogResult | undefined
|
||||
>(OrganizationDialogComponent, {
|
||||
width: '620px',
|
||||
width: '780px',
|
||||
maxWidth: 'calc(100vw - 32px)',
|
||||
data,
|
||||
});
|
||||
@@ -192,13 +213,24 @@ export class OrganizationsComponent implements OnInit {
|
||||
},
|
||||
error: (error) =>
|
||||
this.showError(
|
||||
error.status === 409
|
||||
this.isProtectedOrganizationError(error)
|
||||
? 'Die eigene Organisation kann nicht deaktiviert werden.'
|
||||
: error.status === 409
|
||||
? 'Eine Organisation mit diesem Namen existiert bereits.'
|
||||
: 'Organisation konnte nicht gespeichert werden.',
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
private isProtectedOrganizationError(error: {
|
||||
error?: { detail?: string };
|
||||
}): boolean {
|
||||
return (
|
||||
error.error?.detail ===
|
||||
'The organization of the real or effective account cannot be deleted.'
|
||||
);
|
||||
}
|
||||
|
||||
private showError(message: string): void {
|
||||
this.snackBar.open(message, 'OK', { duration: 5000 });
|
||||
}
|
||||
|
||||
@@ -1,13 +1,107 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { OrganizationPage, OrganizationService } from '../api';
|
||||
import {
|
||||
InseOrganizationManagementModelOrganizationProfile,
|
||||
Institution,
|
||||
InstitutionAssociationsResponse,
|
||||
OrganizationPage,
|
||||
OrganizationService,
|
||||
} from '../api';
|
||||
import { map, of, switchMap } from 'rxjs';
|
||||
|
||||
export const organizationsOrganizationsResolver: ResolveFn<OrganizationPage> = (
|
||||
route,
|
||||
state,
|
||||
) => {
|
||||
export type OrganizationWithInstitutions =
|
||||
InseOrganizationManagementModelOrganizationProfile & {
|
||||
institutions: Institution[];
|
||||
institutionAssociations: InstitutionAssociationsResponse[];
|
||||
};
|
||||
|
||||
export type OrganizationPageWithInstitutions = Omit<
|
||||
OrganizationPage,
|
||||
'items'
|
||||
> & {
|
||||
items: OrganizationWithInstitutions[];
|
||||
};
|
||||
|
||||
const cleanInstitutionId = (id: string): string =>
|
||||
id.split('/').filter(Boolean).pop() ?? id;
|
||||
|
||||
const expandInstitutions = (
|
||||
associations: InstitutionAssociationsResponse[],
|
||||
): Institution[] => {
|
||||
const institutions = new Map<string, Institution>();
|
||||
for (const root of associations) {
|
||||
institutions.set(cleanInstitutionId(root.id), {
|
||||
id: `https://openalex.org/${cleanInstitutionId(root.id)}`,
|
||||
display_name: root.display_name,
|
||||
});
|
||||
}
|
||||
for (const root of associations) {
|
||||
for (const association of root.associated_institutions ?? []) {
|
||||
const id = cleanInstitutionId(association.id);
|
||||
if (!institutions.has(id)) {
|
||||
institutions.set(id, {
|
||||
id: `https://openalex.org/${id}`,
|
||||
display_name: association.display_name,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return [...institutions.values()];
|
||||
};
|
||||
|
||||
export const organizationsOrganizationsResolver: ResolveFn<
|
||||
OrganizationPageWithInstitutions
|
||||
> = (route) => {
|
||||
const page = Number(route.queryParamMap.get('page') ?? '0');
|
||||
const size = Number(route.queryParamMap.get('size') ?? '10');
|
||||
const organizationService = inject(OrganizationService);
|
||||
|
||||
return inject(OrganizationService).getOrganisations(page, size);
|
||||
return organizationService.getOrganisations(page, size).pipe(
|
||||
switchMap((organizationPage) => {
|
||||
const selectedIds = [
|
||||
...new Set(
|
||||
organizationPage.items.flatMap(
|
||||
(organization) =>
|
||||
organization.selected_openalex_institution_ids ?? [],
|
||||
),
|
||||
),
|
||||
];
|
||||
if (selectedIds.length === 0) {
|
||||
return of({
|
||||
...organizationPage,
|
||||
items: organizationPage.items.map((organization) => ({
|
||||
...organization,
|
||||
institutions: [],
|
||||
institutionAssociations: [],
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
||||
return organizationService
|
||||
.getOrganizationInstitutionAssociations(selectedIds)
|
||||
.pipe(
|
||||
map((associationResponses) => {
|
||||
const responsesById = new Map(
|
||||
associationResponses.map((response) => [
|
||||
cleanInstitutionId(response.id),
|
||||
response,
|
||||
]),
|
||||
);
|
||||
return {
|
||||
...organizationPage,
|
||||
items: organizationPage.items.map((organization) => {
|
||||
const institutionAssociations = (
|
||||
organization.selected_openalex_institution_ids ?? []
|
||||
).map((id) => responsesById.get(cleanInstitutionId(id))!);
|
||||
return {
|
||||
...organization,
|
||||
institutions: expandInstitutions(institutionAssociations),
|
||||
institutionAssociations,
|
||||
};
|
||||
}),
|
||||
};
|
||||
}),
|
||||
);
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-form-field style="width: 100%" subscriptSizing="dynamic">
|
||||
@if (label()) {
|
||||
<mat-label>{{ label() }}</mat-label>
|
||||
}
|
||||
|
||||
@@ -513,7 +513,10 @@ html.dark-theme {
|
||||
|
||||
.topic-chip-tooltip,
|
||||
.topic-chip-tooltip .mdc-tooltip__surface,
|
||||
.topic-chip-tooltip .mat-mdc-tooltip-surface {
|
||||
.topic-chip-tooltip .mat-mdc-tooltip-surface,
|
||||
.institution-origin-tooltip,
|
||||
.institution-origin-tooltip .mdc-tooltip__surface,
|
||||
.institution-origin-tooltip .mat-mdc-tooltip-surface {
|
||||
max-width: 320px;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user