diff --git a/backend/api/inputs.py b/backend/api/inputs.py index f70250a9..45f1d4cd 100644 --- a/backend/api/inputs.py +++ b/backend/api/inputs.py @@ -151,6 +151,12 @@ class UpdateLocationNodeInput: parent_id: strawberry.ID | None = None +@strawberry.enum +class ScopeVisibility(Enum): + PRIVATE = "private" + PUBLIC = "public" + + @strawberry.input class CreatePropertyDefinitionInput: name: str @@ -159,6 +165,7 @@ class CreatePropertyDefinitionInput: description: str | None = None options: list[str] | None = None is_active: bool = True + visibility: ScopeVisibility = ScopeVisibility.PRIVATE location_id: strawberry.ID | None = None @@ -169,6 +176,8 @@ class UpdatePropertyDefinitionInput: options: list[str] | None = None is_active: bool | None = None allowed_entities: list[PropertyEntity] | None = None + visibility: ScopeVisibility | None = None + location_id: strawberry.ID | None = None @strawberry.input @@ -194,12 +203,6 @@ class SavedViewEntityType(Enum): PATIENT = "patient" -@strawberry.enum -class SavedViewVisibility(Enum): - PRIVATE = "private" - LINK_SHARED = "link_shared" - - @strawberry.input class CreateSavedViewInput: name: str @@ -210,7 +213,7 @@ class CreateSavedViewInput: related_filter_definition: str = "{}" related_sort_definition: str = "{}" related_parameters: str = "{}" - visibility: SavedViewVisibility = SavedViewVisibility.LINK_SHARED + visibility: ScopeVisibility = ScopeVisibility.PRIVATE location_id: strawberry.ID | None = None @@ -223,13 +226,8 @@ class UpdateSavedViewInput: related_filter_definition: str | None = None related_sort_definition: str | None = None related_parameters: str | None = None - visibility: SavedViewVisibility | None = None - - -@strawberry.enum -class TaskPresetScope(Enum): - PERSONAL = "PERSONAL" - GLOBAL = "GLOBAL" + visibility: ScopeVisibility | None = None + location_id: strawberry.ID | None = None @strawberry.input @@ -256,9 +254,10 @@ class TaskGraphInput: @strawberry.input class CreateTaskPresetInput: name: str - key: str | None = None - scope: TaskPresetScope graph: TaskGraphInput + key: str | None = None + visibility: ScopeVisibility = ScopeVisibility.PRIVATE + location_id: strawberry.ID | None = None @strawberry.input @@ -266,6 +265,8 @@ class UpdateTaskPresetInput: name: str | None = None key: str | None = None graph: TaskGraphInput | None = None + visibility: ScopeVisibility | None = None + location_id: strawberry.ID | None = None @strawberry.input diff --git a/backend/api/resolvers/property.py b/backend/api/resolvers/property.py index a0f792c4..638eb84b 100644 --- a/backend/api/resolvers/property.py +++ b/backend/api/resolvers/property.py @@ -7,10 +7,18 @@ ) from api.resolvers.base import BaseMutationResolver from api.services.authorization import AuthorizationService +from api.services.scope import ( + apply_scope_update, + can_manage_property_definition, + can_read_scoped, + normalize_root_location_ids, + resolve_scope_input, + scoped_visibility_condition, +) from api.types.property import PropertyDefinitionType from database import models from graphql import GraphQLError -from sqlalchemy import or_, select +from sqlalchemy import select def _require_user(info: Info) -> models.User: @@ -26,19 +34,17 @@ class PropertyDefinitionQuery: async def property_definitions( self, info: Info, + root_location_ids: list[strawberry.ID] | None = None, ) -> list[PropertyDefinitionType]: user = _require_user(info) auth_service = AuthorizationService(info.context.db) - accessible = await auth_service.get_user_accessible_location_ids( - user, info.context + scope = await auth_service.get_scope_location_ids( + user, info.context, normalize_root_location_ids(root_location_ids) ) - conditions = [models.PropertyDefinition.location_id.is_(None)] - if accessible: - conditions.append( - models.PropertyDefinition.location_id.in_(accessible) - ) result = await info.context.db.execute( - select(models.PropertyDefinition).where(or_(*conditions)), + select(models.PropertyDefinition).where( + scoped_visibility_condition(models.PropertyDefinition, user.id, scope) + ), ) return result.scalars().all() @@ -56,22 +62,9 @@ async def create_property_definition( data: CreatePropertyDefinitionInput, ) -> PropertyDefinitionType: user = _require_user(info) - auth_service = AuthorizationService(info.context.db) - - if data.location_id is not None: - if not await auth_service.can_access_location( - user, str(data.location_id), info.context - ): - raise_forbidden() - location_id = str(data.location_id) - else: - location_id = await auth_service.default_scope_location_id( - user, info.context - ) - if location_id is None: - raise_forbidden( - "You must belong to a location to create property definitions." - ) + visibility, location_id = await resolve_scope_input( + info, user, data.visibility, data.location_id + ) entities_str = ",".join([e.value for e in data.allowed_entities]) options_str = ",".join(data.options) if data.options else None @@ -83,6 +76,8 @@ async def create_property_definition( options=options_str, is_active=data.is_active, allowed_entities=entities_str, + visibility=visibility, + owner_user_id=user.id, location_id=location_id, ) return await BaseMutationResolver.create_and_notify( @@ -116,6 +111,7 @@ async def update_property_definition( defn.allowed_entities = ",".join( [e.value for e in data.allowed_entities], ) + await apply_scope_update(info, user, defn, data.visibility, data.location_id) return await BaseMutationResolver.update_and_notify( info, defn, models.PropertyDefinition, "property_definition" @@ -146,15 +142,12 @@ async def _require_definition_scope( user: models.User, defn: models.PropertyDefinition, ) -> None: - if defn.location_id is None: + if defn.visibility != "private" and defn.location_id is None: raise_forbidden( "This property definition is global and cannot be modified. " "Recreate it within a location to manage it." ) - auth_service = AuthorizationService(info.context.db) - if not await auth_service.can_access_location( - user, defn.location_id, info.context - ): + if not await can_manage_property_definition(info, user, defn): raise_forbidden() @@ -167,21 +160,17 @@ async def user_can_use_definition( return False db = info.context.db result = await db.execute( - select(models.PropertyDefinition.location_id).where( + select(models.PropertyDefinition).where( models.PropertyDefinition.id == str(definition_id), ) ) - row = result.first() - if row is None: + defn = result.scalars().first() + if defn is None: raise GraphQLError( "Property definition not found.", extensions={"code": "BAD_REQUEST"}, ) - location_id = row[0] - if location_id is None: - return True - auth_service = AuthorizationService(db) - return await auth_service.can_access_location(user, location_id, info.context) + return await can_read_scoped(info, user, defn) async def validate_property_value_inputs(info: Info, props) -> None: diff --git a/backend/api/resolvers/saved_view.py b/backend/api/resolvers/saved_view.py index 6ff392f6..62e52289 100644 --- a/backend/api/resolvers/saved_view.py +++ b/backend/api/resolvers/saved_view.py @@ -6,13 +6,20 @@ from api.context import Info from api.errors import raise_unauthenticated -from api.services.authorization import AuthorizationService -from api.services.base import BaseRepository from api.inputs import ( CreateSavedViewInput, - SavedViewVisibility, UpdateSavedViewInput, ) +from api.services.authorization import AuthorizationService +from api.services.base import BaseRepository +from api.services.scope import ( + PRIVATE, + apply_scope_update, + can_read_scoped, + normalize_root_location_ids, + resolve_scope_input, + scoped_visibility_condition, +) from api.types.saved_view import SavedViewType from database import models @@ -24,38 +31,12 @@ def _require_user(info: Info) -> models.User: return user -async def _can_read_shared( - info: Info, - user: models.User, - row: models.SavedView, -) -> bool: - if row.owner_user_id == user.id: - return True - if row.visibility != SavedViewVisibility.LINK_SHARED.value: - return False - if not row.location_id: - return False - auth_service = AuthorizationService(info.context.db) - return await auth_service.can_access_location( - user, row.location_id, info.context - ) - - -async def _resolve_scope_location( - info: Info, - user: models.User, - requested_location_id: strawberry.ID | None, -) -> str | None: - auth_service = AuthorizationService(info.context.db) - if requested_location_id is not None: - if not await auth_service.can_access_location( - user, str(requested_location_id), info.context - ): - from api.errors import raise_forbidden - - raise_forbidden() - return str(requested_location_id) - return await auth_service.default_scope_location_id(user, info.context) +def _validated_json(blob: str, label: str) -> str: + try: + json.loads(blob) + except json.JSONDecodeError as e: + raise GraphQLError(f"Invalid JSON in {label}") from e + return blob @strawberry.type @@ -70,17 +51,25 @@ async def saved_view(self, info: Info, id: strawberry.ID) -> SavedViewType | Non row = result.scalars().first() if not row: return None - if not await _can_read_shared(info, user, row): + if not await can_read_scoped(info, user, row): raise GraphQLError("Not found or access denied") return SavedViewType.from_model(row, current_user_id=user.id) @strawberry.field - async def my_saved_views(self, info: Info) -> list[SavedViewType]: + async def my_saved_views( + self, + info: Info, + root_location_ids: list[strawberry.ID] | None = None, + ) -> list[SavedViewType]: user = _require_user(info) db = info.context.db + auth_service = AuthorizationService(db) + scope = await auth_service.get_scope_location_ids( + user, info.context, normalize_root_location_ids(root_location_ids) + ) result = await db.execute( select(models.SavedView) - .where(models.SavedView.owner_user_id == user.id) + .where(scoped_visibility_condition(models.SavedView, user.id, scope)) .order_by(models.SavedView.updated_at.desc()) ) rows = result.scalars().all() @@ -96,7 +85,9 @@ async def create_saved_view( data: CreateSavedViewInput, ) -> SavedViewType: user = _require_user(info) - location_id = await _resolve_scope_location(info, user, data.location_id) + visibility, location_id = await resolve_scope_input( + info, user, data.visibility, data.location_id + ) for blob, label in ( (data.filter_definition, "filter_definition"), (data.sort_definition, "sort_definition"), @@ -105,10 +96,7 @@ async def create_saved_view( (data.related_sort_definition, "related_sort_definition"), (data.related_parameters, "related_parameters"), ): - try: - json.loads(blob) - except json.JSONDecodeError as e: - raise GraphQLError(f"Invalid JSON in {label}") from e + _validated_json(blob, label) row = models.SavedView( name=data.name.strip(), @@ -121,7 +109,7 @@ async def create_saved_view( related_parameters=data.related_parameters, owner_user_id=user.id, location_id=location_id, - visibility=data.visibility.value, + visibility=visibility, ) info.context.db.add(row) await info.context.db.commit() @@ -149,43 +137,28 @@ async def update_saved_view( if data.name is not None: row.name = data.name.strip() if data.filter_definition is not None: - try: - json.loads(data.filter_definition) - except json.JSONDecodeError as e: - raise GraphQLError("Invalid JSON in filter_definition") from e - row.filter_definition = data.filter_definition + row.filter_definition = _validated_json( + data.filter_definition, "filter_definition" + ) if data.sort_definition is not None: - try: - json.loads(data.sort_definition) - except json.JSONDecodeError as e: - raise GraphQLError("Invalid JSON in sort_definition") from e - row.sort_definition = data.sort_definition + row.sort_definition = _validated_json( + data.sort_definition, "sort_definition" + ) if data.parameters is not None: - try: - json.loads(data.parameters) - except json.JSONDecodeError as e: - raise GraphQLError("Invalid JSON in parameters") from e - row.parameters = data.parameters + row.parameters = _validated_json(data.parameters, "parameters") if data.related_filter_definition is not None: - try: - json.loads(data.related_filter_definition) - except json.JSONDecodeError as e: - raise GraphQLError("Invalid JSON in related_filter_definition") from e - row.related_filter_definition = data.related_filter_definition + row.related_filter_definition = _validated_json( + data.related_filter_definition, "related_filter_definition" + ) if data.related_sort_definition is not None: - try: - json.loads(data.related_sort_definition) - except json.JSONDecodeError as e: - raise GraphQLError("Invalid JSON in related_sort_definition") from e - row.related_sort_definition = data.related_sort_definition + row.related_sort_definition = _validated_json( + data.related_sort_definition, "related_sort_definition" + ) if data.related_parameters is not None: - try: - json.loads(data.related_parameters) - except json.JSONDecodeError as e: - raise GraphQLError("Invalid JSON in related_parameters") from e - row.related_parameters = data.related_parameters - if data.visibility is not None: - row.visibility = data.visibility.value + row.related_parameters = _validated_json( + data.related_parameters, "related_parameters" + ) + await apply_scope_update(info, user, row, data.visibility, data.location_id) await db.commit() await db.refresh(row) @@ -222,7 +195,7 @@ async def duplicate_saved_view( src = result.scalars().first() if not src: raise GraphQLError("View not found") - if not await _can_read_shared(info, user, src): + if not await can_read_scoped(info, user, src): raise GraphQLError("Not found or access denied") clone = models.SavedView( @@ -235,8 +208,8 @@ async def duplicate_saved_view( related_sort_definition=src.related_sort_definition, related_parameters=src.related_parameters, owner_user_id=user.id, - location_id=await _resolve_scope_location(info, user, None), - visibility=SavedViewVisibility.PRIVATE.value, + location_id=None, + visibility=PRIVATE, ) db.add(clone) await db.commit() diff --git a/backend/api/resolvers/task.py b/backend/api/resolvers/task.py index 94e10cf6..2ce05ae0 100644 --- a/backend/api/resolvers/task.py +++ b/backend/api/resolvers/task.py @@ -22,6 +22,7 @@ from api.query.registry import TASK from api.resolvers.base import BaseMutationResolver, BaseSubscriptionResolver from api.services.authorization import AuthorizationService +from api.services.scope import can_read_scoped from api.services.subscription import effective_root_location_ids from api.services.checksum import validate_checksum from api.services.datetime import normalize_datetime_to_utc @@ -37,7 +38,6 @@ ) from api.types.task import TaskType from database import models -from database.models.task_preset import TaskPresetScope as DbTaskPresetScope from graphql import GraphQLError from sqlalchemy import and_, exists, or_, select from sqlalchemy.orm import aliased, selectinload @@ -1194,10 +1194,7 @@ async def apply_task_graph( "Preset not found", extensions={"code": "NOT_FOUND"}, ) - if ( - preset.scope == DbTaskPresetScope.PERSONAL.value - and preset.owner_user_id != user.id - ): + if not await can_read_scoped(info, user, preset): raise_forbidden() graph_dict = preset.graph_json else: @@ -1222,10 +1219,7 @@ async def apply_task_graph( "Preset not found", extensions={"code": "NOT_FOUND"}, ) - if ( - preset_src.scope == DbTaskPresetScope.PERSONAL.value - and preset_src.owner_user_id != user.id - ): + if not await can_read_scoped(info, user, preset_src): raise_forbidden() source_preset_id = str(data.source_preset_id) else: diff --git a/backend/api/resolvers/task_preset.py b/backend/api/resolvers/task_preset.py index 472d2aff..cb35b0ce 100644 --- a/backend/api/resolvers/task_preset.py +++ b/backend/api/resolvers/task_preset.py @@ -2,18 +2,26 @@ import uuid import strawberry +from graphql import GraphQLError +from sqlalchemy import select + from api.context import Info from api.errors import raise_forbidden from api.inputs import CreateTaskPresetInput, UpdateTaskPresetInput +from api.services.authorization import AuthorizationService +from api.services.scope import ( + apply_scope_update, + can_read_scoped, + normalize_root_location_ids, + resolve_scope_input, + scoped_visibility_condition, +) from api.services.task_graph import ( graph_dict_from_preset_inputs, validate_task_graph_dict, ) from api.types.task_preset import TaskPresetType, task_preset_type_from_model from database import models -from database.models.task_preset import TaskPresetScope as DbTaskPresetScope -from graphql import GraphQLError -from sqlalchemy import and_, or_, select def _slugify(name: str) -> str: @@ -61,32 +69,53 @@ def _can_delete_preset( return preset.owner_user_id is not None and preset.owner_user_id == user_id +def _require_user(info: Info) -> models.User: + user = info.context.user + if not user: + raise GraphQLError( + "Not authenticated", + extensions={"code": "UNAUTHENTICATED"}, + ) + return user + + +async def _readable_preset_or_raise( + info: Info, + user: models.User, + query, +) -> models.TaskPreset | None: + r = await info.context.db.execute(query) + preset = r.scalars().first() + if not preset: + return None + if not await can_read_scoped(info, user, preset): + raise_forbidden() + return preset + + @strawberry.type class TaskPresetQuery: @strawberry.field - async def task_presets(self, info: Info) -> list[TaskPresetType]: - user = info.context.user - if not user: - raise GraphQLError( - "Not authenticated", - extensions={"code": "UNAUTHENTICATED"}, - ) + async def task_presets( + self, + info: Info, + root_location_ids: list[strawberry.ID] | None = None, + ) -> list[TaskPresetType]: + user = _require_user(info) + auth_service = AuthorizationService(info.context.db) + scope = await auth_service.get_scope_location_ids( + user, info.context, normalize_root_location_ids(root_location_ids) + ) q = ( select(models.TaskPreset) - .where( - or_( - models.TaskPreset.scope == DbTaskPresetScope.GLOBAL.value, - and_( - models.TaskPreset.scope == DbTaskPresetScope.PERSONAL.value, - models.TaskPreset.owner_user_id == user.id, - ), - ), - ) + .where(scoped_visibility_condition(models.TaskPreset, user.id, scope)) .order_by(models.TaskPreset.name) ) r = await info.context.db.execute(q) rows = r.scalars().all() - return [task_preset_type_from_model(p) for p in rows] + return [ + task_preset_type_from_model(p, current_user_id=user.id) for p in rows + ] @strawberry.field async def task_preset( @@ -94,21 +123,15 @@ async def task_preset( info: Info, id: strawberry.ID, ) -> TaskPresetType | None: - user = info.context.user - if not user: - raise GraphQLError( - "Not authenticated", - extensions={"code": "UNAUTHENTICATED"}, - ) - r = await info.context.db.execute( + user = _require_user(info) + preset = await _readable_preset_or_raise( + info, + user, select(models.TaskPreset).where(models.TaskPreset.id == id), ) - preset = r.scalars().first() if not preset: return None - if preset.scope == DbTaskPresetScope.PERSONAL.value and preset.owner_user_id != user.id: - raise_forbidden() - return task_preset_type_from_model(preset) + return task_preset_type_from_model(preset, current_user_id=user.id) @strawberry.field async def task_preset_by_key( @@ -116,21 +139,15 @@ async def task_preset_by_key( info: Info, key: str, ) -> TaskPresetType | None: - user = info.context.user - if not user: - raise GraphQLError( - "Not authenticated", - extensions={"code": "UNAUTHENTICATED"}, - ) - r = await info.context.db.execute( + user = _require_user(info) + preset = await _readable_preset_or_raise( + info, + user, select(models.TaskPreset).where(models.TaskPreset.key == key), ) - preset = r.scalars().first() if not preset: return None - if preset.scope == DbTaskPresetScope.PERSONAL.value and preset.owner_user_id != user.id: - raise_forbidden() - return task_preset_type_from_model(preset) + return task_preset_type_from_model(preset, current_user_id=user.id) @strawberry.type @@ -141,16 +158,12 @@ async def create_task_preset( info: Info, data: CreateTaskPresetInput, ) -> TaskPresetType: - user = info.context.user - if not user: - raise GraphQLError( - "Not authenticated", - extensions={"code": "UNAUTHENTICATED"}, - ) + user = _require_user(info) graph_dict = graph_dict_from_preset_inputs(data.graph.nodes, data.graph.edges) validate_task_graph_dict(graph_dict) - scope_val = data.scope.value - owner_id = user.id + visibility, location_id = await resolve_scope_input( + info, user, data.visibility, data.location_id + ) if data.key: if not await _key_is_available(info.context.db, data.key): raise GraphQLError( @@ -163,14 +176,15 @@ async def create_task_preset( preset = models.TaskPreset( name=data.name, key=key, - scope=scope_val, - owner_user_id=owner_id, + visibility=visibility, + owner_user_id=user.id, + location_id=location_id, graph_json=graph_dict, ) info.context.db.add(preset) await info.context.db.commit() await info.context.db.refresh(preset) - return task_preset_type_from_model(preset) + return task_preset_type_from_model(preset, current_user_id=user.id) @strawberry.mutation async def update_task_preset( @@ -179,12 +193,7 @@ async def update_task_preset( id: strawberry.ID, data: UpdateTaskPresetInput, ) -> TaskPresetType: - user = info.context.user - if not user: - raise GraphQLError( - "Not authenticated", - extensions={"code": "UNAUTHENTICATED"}, - ) + user = _require_user(info) r = await info.context.db.execute( select(models.TaskPreset).where(models.TaskPreset.id == id), ) @@ -209,9 +218,10 @@ async def update_task_preset( graph_dict = graph_dict_from_preset_inputs(data.graph.nodes, data.graph.edges) validate_task_graph_dict(graph_dict) preset.graph_json = graph_dict + await apply_scope_update(info, user, preset, data.visibility, data.location_id) await info.context.db.commit() await info.context.db.refresh(preset) - return task_preset_type_from_model(preset) + return task_preset_type_from_model(preset, current_user_id=user.id) @strawberry.mutation async def delete_task_preset( @@ -219,12 +229,7 @@ async def delete_task_preset( info: Info, id: strawberry.ID, ) -> bool: - user = info.context.user - if not user: - raise GraphQLError( - "Not authenticated", - extensions={"code": "UNAUTHENTICATED"}, - ) + user = _require_user(info) r = await info.context.db.execute( select(models.TaskPreset).where(models.TaskPreset.id == id), ) diff --git a/backend/api/services/authorization.py b/backend/api/services/authorization.py index 80cdf81a..7f0f4638 100644 --- a/backend/api/services/authorization.py +++ b/backend/api/services/authorization.py @@ -46,25 +46,88 @@ async def _compute_accessible_location_ids( context._accessible_location_ids = result return result + accessible_ids = await self._collect_descendant_ids(root_location_ids) + + if context: + context._accessible_location_ids = accessible_ids + + return accessible_ids + + async def _collect_descendant_ids(self, node_ids: set[str]) -> set[str]: + if not node_ids: + return set() cte = ( select(models.LocationNode.id) - .where(models.LocationNode.id.in_(root_location_ids)) + .where(models.LocationNode.id.in_(node_ids)) .cte(name="accessible_locations", recursive=True) ) - children = select(models.LocationNode.id).join( cte, models.LocationNode.parent_id == cte.c.id ) cte = cte.union_all(children) + result = await self.db.execute(select(cte.c.id)) + return {row[0] for row in result.fetchall()} + async def _collect_ancestor_ids(self, node_ids: set[str]) -> set[str]: + if not node_ids: + return set() + cte = ( + select(models.LocationNode.id, models.LocationNode.parent_id) + .where(models.LocationNode.id.in_(node_ids)) + .cte(name="ancestor_locations", recursive=True) + ) + parents = select(models.LocationNode.id, models.LocationNode.parent_id).join( + cte, models.LocationNode.id == cte.c.parent_id + ) + cte = cte.union_all(parents) result = await self.db.execute(select(cte.c.id)) - rows = result.fetchall() - accessible_ids = {row[0] for row in rows} + return {row[0] for row in result.fetchall()} - if context: - context._accessible_location_ids = accessible_ids + async def get_user_root_location_ids(self, user: models.User | None) -> set[str]: + if not user: + return set() + result = await self.db.execute( + select(models.user_root_locations.c.location_id).where( + models.user_root_locations.c.user_id == user.id + ) + ) + return {row[0] for row in result.fetchall()} - return accessible_ids + async def get_scope_location_ids( + self, + user: models.User | None, + context=None, + root_location_ids: list[str] | None = None, + ) -> set[str]: + if not user: + return set() + accessible = await self.get_user_accessible_location_ids(user, context) + if not accessible: + return set() + + requested = [str(lid) for lid in root_location_ids or []] + cache_key = tuple(sorted(requested)) + cache = getattr(context, "_scope_location_ids_cache", None) + if cache is not None and cache_key in cache: + return cache[cache_key] + + if requested: + roots = {lid for lid in requested if lid in accessible} + if not roots: + scope: set[str] = set() + else: + scope = await self._collect_descendant_ids(roots) + scope |= await self._collect_ancestor_ids(roots) + else: + roots = await self.get_user_root_location_ids(user) + scope = set(accessible) | await self._collect_ancestor_ids(roots) + + if context is not None: + if cache is None: + cache = {} + context._scope_location_ids_cache = cache + cache[cache_key] = scope + return scope async def can_access_location( self, diff --git a/backend/api/services/scope.py b/backend/api/services/scope.py new file mode 100644 index 00000000..48de4fe9 --- /dev/null +++ b/backend/api/services/scope.py @@ -0,0 +1,131 @@ +from __future__ import annotations + +from typing import Any + +import strawberry +from graphql import GraphQLError +from sqlalchemy import and_, or_, select + +from api.context import Info +from api.errors import raise_forbidden +from api.inputs import ScopeVisibility +from api.services.authorization import AuthorizationService +from database import models + +PRIVATE = ScopeVisibility.PRIVATE.value +PUBLIC = ScopeVisibility.PUBLIC.value + + +def normalize_root_location_ids( + root_location_ids: list[strawberry.ID] | None, +) -> list[str] | None: + if not root_location_ids: + return None + return [str(lid) for lid in root_location_ids] + + +def scoped_visibility_condition( + model: Any, + user_id: str | None, + scope_location_ids: set[str], +): + public_reachable = and_( + model.visibility == PUBLIC, + or_( + model.location_id.is_(None), + model.location_id.in_(scope_location_ids) if scope_location_ids else False, + ), + ) + if user_id is None: + return public_reachable + return or_(model.owner_user_id == user_id, public_reachable) + + +async def can_read_scoped(info: Info, user: models.User | None, row: Any) -> bool: + if not user: + return False + owner_user_id = getattr(row, "owner_user_id", None) + if owner_user_id is not None and owner_user_id == user.id: + return True + if row.visibility != PUBLIC: + return False + if row.location_id is None: + return True + auth_service = AuthorizationService(info.context.db) + scope = await auth_service.get_scope_location_ids(user, info.context) + return row.location_id in scope + + +async def resolve_scope_input( + info: Info, + user: models.User, + visibility: ScopeVisibility, + location_id: strawberry.ID | str | None, +) -> tuple[str, str | None]: + if visibility == ScopeVisibility.PRIVATE: + return PRIVATE, None + auth_service = AuthorizationService(info.context.db) + if location_id is None: + default_location_id = await auth_service.default_scope_location_id( + user, info.context + ) + if default_location_id is None: + raise GraphQLError( + "A location is required to share this entry.", + extensions={"code": "BAD_REQUEST"}, + ) + return PUBLIC, default_location_id + if not await auth_service.can_access_location( + user, str(location_id), info.context + ): + raise_forbidden() + return PUBLIC, str(location_id) + + +async def apply_scope_update( + info: Info, + user: models.User, + row: Any, + visibility: ScopeVisibility | None, + location_id: strawberry.ID | None, +) -> None: + if visibility is None and location_id is None: + return + target_visibility = ( + visibility if visibility is not None else ScopeVisibility(row.visibility) + ) + target_location_id = ( + str(location_id) if location_id is not None else row.location_id + ) + row.visibility, row.location_id = await resolve_scope_input( + info, user, target_visibility, target_location_id + ) + + +async def can_manage_property_definition( + info: Info, + user: models.User | None, + defn: models.PropertyDefinition, +) -> bool: + if not user: + return False + if defn.visibility != PUBLIC: + return defn.owner_user_id is not None and defn.owner_user_id == user.id + if defn.location_id is None: + return False + auth_service = AuthorizationService(info.context.db) + return await auth_service.can_access_location( + user, defn.location_id, info.context + ) + + +async def load_scope_location( + info: Info, + location_id: str | None, +) -> models.LocationNode | None: + if not location_id: + return None + result = await info.context.db.execute( + select(models.LocationNode).where(models.LocationNode.id == location_id), + ) + return result.scalars().first() diff --git a/backend/api/types/property.py b/backend/api/types/property.py index f4dfd15e..4278d75e 100644 --- a/backend/api/types/property.py +++ b/backend/api/types/property.py @@ -3,7 +3,8 @@ import strawberry from api.context import Info -from api.inputs import FieldType, PropertyEntity +from api.inputs import FieldType, PropertyEntity, ScopeVisibility +from api.services.scope import can_manage_property_definition, load_scope_location from database import models from sqlalchemy import select @@ -19,8 +20,24 @@ class PropertyDefinitionType: description: str | None field_type: FieldType is_active: bool + visibility: ScopeVisibility + owner_user_id: strawberry.ID | None location_id: strawberry.ID | None + @strawberry.field + async def location( + self, + info: Info, + ) -> ( + Annotated["LocationNodeType", strawberry.lazy("api.types.location")] + | None + ): + return await load_scope_location(info, self.location_id) + + @strawberry.field + async def can_edit(self, info: Info) -> bool: + return await can_manage_property_definition(info, info.context.user, self) + @strawberry.field def options(self) -> list[str]: return self.options.split(",") if self.options else [] diff --git a/backend/api/types/saved_view.py b/backend/api/types/saved_view.py index 35ad5920..1bc0c756 100644 --- a/backend/api/types/saved_view.py +++ b/backend/api/types/saved_view.py @@ -1,10 +1,17 @@ from __future__ import annotations +from typing import TYPE_CHECKING, Annotated + import strawberry -from api.inputs import SavedViewEntityType, SavedViewVisibility +from api.context import Info +from api.inputs import SavedViewEntityType, ScopeVisibility +from api.services.scope import load_scope_location from database.models.saved_view import SavedView as SavedViewModel +if TYPE_CHECKING: + from api.types.location import LocationNodeType + @strawberry.type(name="SavedView") class SavedViewType: @@ -19,11 +26,21 @@ class SavedViewType: related_parameters: str owner_user_id: strawberry.ID location_id: strawberry.ID | None - visibility: SavedViewVisibility + visibility: ScopeVisibility created_at: str updated_at: str is_owner: bool + @strawberry.field + async def location( + self, + info: Info, + ) -> ( + Annotated["LocationNodeType", strawberry.lazy("api.types.location")] + | None + ): + return await load_scope_location(info, self.location_id) + @staticmethod def from_model( row: SavedViewModel, @@ -44,7 +61,7 @@ def from_model( location_id=( strawberry.ID(row.location_id) if row.location_id else None ), - visibility=SavedViewVisibility(row.visibility), + visibility=ScopeVisibility(row.visibility), created_at=row.created_at.isoformat() if row.created_at else "", updated_at=row.updated_at.isoformat() if row.updated_at else "", is_owner=current_user_id is not None and row.owner_user_id == current_user_id, diff --git a/backend/api/types/task_preset.py b/backend/api/types/task_preset.py index 6c5d37be..17c3f528 100644 --- a/backend/api/types/task_preset.py +++ b/backend/api/types/task_preset.py @@ -1,7 +1,14 @@ -from typing import Any +from typing import TYPE_CHECKING, Annotated, Any import strawberry +from api.context import Info +from api.inputs import ScopeVisibility +from api.services.scope import load_scope_location + +if TYPE_CHECKING: + from api.types.location import LocationNodeType + @strawberry.type class TaskGraphNodeType: @@ -58,21 +65,39 @@ class TaskPresetType: id: strawberry.ID name: str key: str - scope: str + visibility: ScopeVisibility owner_user_id: strawberry.ID | None + location_id: strawberry.ID | None + is_owner: bool _graph_json: strawberry.Private[dict[str, Any]] @strawberry.field def graph(self) -> TaskGraphType: return task_graph_type_from_dict(self._graph_json) + @strawberry.field + async def location( + self, + info: Info, + ) -> ( + Annotated["LocationNodeType", strawberry.lazy("api.types.location")] + | None + ): + return await load_scope_location(info, self.location_id) + -def task_preset_type_from_model(p: Any) -> TaskPresetType: +def task_preset_type_from_model( + p: Any, + *, + current_user_id: str | None = None, +) -> TaskPresetType: return TaskPresetType( id=p.id, name=p.name, key=p.key, - scope=p.scope, + visibility=ScopeVisibility(p.visibility), owner_user_id=p.owner_user_id, + location_id=strawberry.ID(p.location_id) if p.location_id else None, + is_owner=current_user_id is not None and p.owner_user_id == current_user_id, _graph_json=p.graph_json, ) diff --git a/backend/database/migrations/versions/add_scope_visibility.py b/backend/database/migrations/versions/add_scope_visibility.py new file mode 100644 index 00000000..60d0e5d9 --- /dev/null +++ b/backend/database/migrations/versions/add_scope_visibility.py @@ -0,0 +1,115 @@ +"""Scope presets, saved views and property definitions to a location node. + +Revision ID: add_scope_visibility +Revises: add_scope_location_prop_view +Create Date: 2026-09-02 12:00:00.000000 +""" + +from typing import Sequence, Union + +import sqlalchemy as sa +from alembic import op + +revision: str = "add_scope_visibility" +down_revision: Union[str, Sequence[str], None] = "add_scope_location_prop_view" +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def _root_location_id(conn) -> str | None: + rows = conn.execute( + sa.text( + "SELECT id FROM location_nodes WHERE parent_id IS NULL ORDER BY title, id" + ) + ).fetchall() + return rows[0][0] if rows else None + + +def upgrade() -> None: + conn = op.get_bind() + root_id = _root_location_id(conn) + + with op.batch_alter_table("property_definitions") as batch_op: + batch_op.add_column( + sa.Column( + "visibility", + sa.String(length=16), + nullable=False, + server_default="private", + ) + ) + batch_op.add_column(sa.Column("owner_user_id", sa.String(), nullable=True)) + batch_op.create_foreign_key( + "fk_property_definitions_owner_user_id", + "users", + ["owner_user_id"], + ["id"], + ) + conn.execute(sa.text("UPDATE property_definitions SET visibility = 'public'")) + if root_id: + conn.execute( + sa.text( + "UPDATE property_definitions SET location_id = :root_id " + "WHERE location_id IS NULL" + ), + {"root_id": root_id}, + ) + + conn.execute( + sa.text("UPDATE saved_views SET visibility = 'private', location_id = NULL") + ) + + with op.batch_alter_table("task_presets") as batch_op: + batch_op.add_column( + sa.Column( + "visibility", + sa.String(length=16), + nullable=False, + server_default="private", + ) + ) + batch_op.add_column(sa.Column("location_id", sa.String(), nullable=True)) + batch_op.create_foreign_key( + "fk_task_presets_location_id", + "location_nodes", + ["location_id"], + ["id"], + ) + if root_id: + conn.execute( + sa.text( + "UPDATE task_presets SET visibility = 'public', location_id = :root_id " + "WHERE owner_user_id IS NULL" + ), + {"root_id": root_id}, + ) + with op.batch_alter_table("task_presets") as batch_op: + batch_op.drop_column("scope") + + +def downgrade() -> None: + conn = op.get_bind() + + with op.batch_alter_table("task_presets") as batch_op: + batch_op.add_column( + sa.Column( + "scope", + sa.String(length=32), + nullable=False, + server_default="PERSONAL", + ) + ) + conn.execute( + sa.text("UPDATE task_presets SET scope = 'GLOBAL' WHERE visibility = 'public'") + ) + with op.batch_alter_table("task_presets") as batch_op: + batch_op.drop_constraint("fk_task_presets_location_id", type_="foreignkey") + batch_op.drop_column("location_id") + batch_op.drop_column("visibility") + + with op.batch_alter_table("property_definitions") as batch_op: + batch_op.drop_constraint( + "fk_property_definitions_owner_user_id", type_="foreignkey" + ) + batch_op.drop_column("owner_user_id") + batch_op.drop_column("visibility") diff --git a/backend/database/models/__init__.py b/backend/database/models/__init__.py index 9fee6038..f288cb3b 100644 --- a/backend/database/models/__init__.py +++ b/backend/database/models/__init__.py @@ -5,4 +5,4 @@ from .property import PropertyDefinition, PropertyValue # noqa: F401 from .scaffold import ScaffoldImportState # noqa: F401 from .saved_view import SavedView # noqa: F401 -from .task_preset import TaskPreset, TaskPresetScope # noqa: F401 +from .task_preset import TaskPreset # noqa: F401 diff --git a/backend/database/models/property.py b/backend/database/models/property.py index d8d8a25f..b0eba6c7 100644 --- a/backend/database/models/property.py +++ b/backend/database/models/property.py @@ -4,10 +4,11 @@ from datetime import date, datetime from typing import TYPE_CHECKING -from database.models.base import Base from sqlalchemy import Boolean, Float, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship +from database.models.base import Base + if TYPE_CHECKING: from .patient import Patient from .task import Task @@ -27,6 +28,13 @@ class PropertyDefinition(Base): options: Mapped[str | None] = mapped_column(String, nullable=True) is_active: Mapped[bool] = mapped_column(Boolean, default=True) allowed_entities: Mapped[str] = mapped_column(String, default="PATIENT") + visibility: Mapped[str] = mapped_column( + String(16), nullable=False, default="private" + ) + owner_user_id: Mapped[str | None] = mapped_column( + ForeignKey("users.id"), + nullable=True, + ) location_id: Mapped[str | None] = mapped_column( ForeignKey("location_nodes.id"), nullable=True, diff --git a/backend/database/models/saved_view.py b/backend/database/models/saved_view.py index 345fc3f5..d8fb83a1 100644 --- a/backend/database/models/saved_view.py +++ b/backend/database/models/saved_view.py @@ -4,10 +4,11 @@ from datetime import datetime from typing import TYPE_CHECKING -from database.models.base import Base from sqlalchemy import DateTime, ForeignKey, String, Text, func from sqlalchemy.orm import Mapped, mapped_column, relationship +from database.models.base import Base + if TYPE_CHECKING: from .user import User @@ -39,7 +40,9 @@ class SavedView(Base): location_id: Mapped[str | None] = mapped_column( String, ForeignKey("location_nodes.id"), nullable=True ) - visibility: Mapped[str] = mapped_column(String, nullable=False, default="private") + visibility: Mapped[str] = mapped_column( + String(16), nullable=False, default="private" + ) created_at: Mapped[datetime] = mapped_column( DateTime(timezone=True), server_default=func.now() ) diff --git a/backend/database/models/task_preset.py b/backend/database/models/task_preset.py index a0e0e699..73c4b058 100644 --- a/backend/database/models/task_preset.py +++ b/backend/database/models/task_preset.py @@ -1,25 +1,20 @@ from __future__ import annotations -import enum import uuid from datetime import datetime from typing import TYPE_CHECKING, Any -from database.models.base import Base from sqlalchemy import ForeignKey, String from sqlalchemy.dialects.postgresql import JSON from sqlalchemy.orm import Mapped, mapped_column, relationship +from database.models.base import Base + if TYPE_CHECKING: from database.models.task import Task from database.models.user import User -class TaskPresetScope(str, enum.Enum): - PERSONAL = "PERSONAL" - GLOBAL = "GLOBAL" - - class TaskPreset(Base): __tablename__ = "task_presets" @@ -30,11 +25,17 @@ class TaskPreset(Base): ) name: Mapped[str] = mapped_column(String) key: Mapped[str] = mapped_column(String, unique=True, index=True) - scope: Mapped[str] = mapped_column(String(32)) + visibility: Mapped[str] = mapped_column( + String(16), nullable=False, default="private" + ) owner_user_id: Mapped[str | None] = mapped_column( ForeignKey("users.id"), nullable=True, ) + location_id: Mapped[str | None] = mapped_column( + ForeignKey("location_nodes.id"), + nullable=True, + ) graph_json: Mapped[dict[str, Any]] = mapped_column(JSON) creation_date: Mapped[datetime] = mapped_column(default=datetime.now) update_date: Mapped[datetime | None] = mapped_column( diff --git a/backend/schema.graphql b/backend/schema.graphql index be86ccb3..9ebd9d03 100644 --- a/backend/schema.graphql +++ b/backend/schema.graphql @@ -42,6 +42,7 @@ input CreatePropertyDefinitionInput { description: String = null options: [String!] = null isActive: Boolean! = true + visibility: ScopeVisibility! = PRIVATE locationId: ID = null } @@ -54,7 +55,7 @@ input CreateSavedViewInput { relatedFilterDefinition: String! = "{}" relatedSortDefinition: String! = "{}" relatedParameters: String! = "{}" - visibility: SavedViewVisibility! = LINK_SHARED + visibility: ScopeVisibility! = PRIVATE locationId: ID = null } @@ -73,9 +74,10 @@ input CreateTaskInput { input CreateTaskPresetInput { name: String! - key: String = null - scope: TaskPresetScope! graph: TaskGraphInput! + key: String = null + visibility: ScopeVisibility! = PRIVATE + locationId: ID = null } """Date (isoformat)""" @@ -199,7 +201,11 @@ type PropertyDefinitionType { description: String fieldType: FieldType! isActive: Boolean! + visibility: ScopeVisibility! + ownerUserId: ID locationId: ID + location: LocationNodeType + canEdit: Boolean! options: [String!]! allowedEntities: [PropertyEntity!]! } @@ -248,20 +254,20 @@ type Query { tasksTotal(patientId: ID = null, assigneeId: ID = null, assigneeTeamId: ID = null, rootLocationIds: [ID!] = null, filters: [QueryFilterClauseInput!] = null, sorts: [QuerySortClauseInput!] = null, search: QuerySearchInput = null): Int! recentTasks(rootLocationIds: [ID!] = null, filters: [QueryFilterClauseInput!] = null, sorts: [QuerySortClauseInput!] = null, pagination: PaginationInput = null, search: QuerySearchInput = null): [TaskType!]! recentTasksTotal(rootLocationIds: [ID!] = null, filters: [QueryFilterClauseInput!] = null, sorts: [QuerySortClauseInput!] = null, search: QuerySearchInput = null): Int! - taskPresets: [TaskPresetType!]! + taskPresets(rootLocationIds: [ID!] = null): [TaskPresetType!]! taskPreset(id: ID!): TaskPresetType taskPresetByKey(key: String!): TaskPresetType locationRoots: [LocationNodeType!]! locationNode(id: ID!): LocationNodeType locationNodes(kind: LocationType = null, search: String = null, parentId: ID = null, recursive: Boolean! = false, orderByName: Boolean! = false, limit: Int = null, offset: Int = null): [LocationNodeType!]! - propertyDefinitions: [PropertyDefinitionType!]! + propertyDefinitions(rootLocationIds: [ID!] = null): [PropertyDefinitionType!]! user(id: ID!): UserType users(filters: [QueryFilterClauseInput!] = null, sorts: [QuerySortClauseInput!] = null, pagination: PaginationInput = null, search: QuerySearchInput = null): [UserType!]! me: UserType auditLogs(caseId: ID!, limit: Int = null, offset: Int = null): [AuditLogType!]! queryableFields(entity: String!): [QueryableField!]! savedView(id: ID!): SavedView - mySavedViews: [SavedView!]! + mySavedViews(rootLocationIds: [ID!] = null): [SavedView!]! } input QueryFilterClauseInput { @@ -383,10 +389,11 @@ type SavedView { relatedParameters: String! ownerUserId: ID! locationId: ID - visibility: SavedViewVisibility! + visibility: ScopeVisibility! createdAt: String! updatedAt: String! isOwner: Boolean! + location: LocationNodeType } enum SavedViewEntityType { @@ -394,9 +401,9 @@ enum SavedViewEntityType { PATIENT } -enum SavedViewVisibility { +enum ScopeVisibility { PRIVATE - LINK_SHARED + PUBLIC } type ScopedPatientCountsType { @@ -467,18 +474,16 @@ type TaskGraphType { edges: [TaskGraphEdgeType!]! } -enum TaskPresetScope { - PERSONAL - GLOBAL -} - type TaskPresetType { id: ID! name: String! key: String! - scope: String! + visibility: ScopeVisibility! ownerUserId: ID + locationId: ID + isOwner: Boolean! graph: TaskGraphType! + location: LocationNodeType } enum TaskPriority { @@ -539,6 +544,8 @@ input UpdatePropertyDefinitionInput { options: [String!] = null isActive: Boolean = null allowedEntities: [PropertyEntity!] = null + visibility: ScopeVisibility = null + locationId: ID = null } input UpdateSavedViewInput { @@ -549,7 +556,8 @@ input UpdateSavedViewInput { relatedFilterDefinition: String = null relatedSortDefinition: String = null relatedParameters: String = null - visibility: SavedViewVisibility = null + visibility: ScopeVisibility = null + locationId: ID = null } input UpdateTaskInput { @@ -571,6 +579,8 @@ input UpdateTaskPresetInput { name: String = null key: String = null graph: TaskGraphInput = null + visibility: ScopeVisibility = null + locationId: ID = null } type UserType { diff --git a/backend/tests/integration/test_authorization_scoping.py b/backend/tests/integration/test_authorization_scoping.py index 8566344f..3f9a4a83 100644 --- a/backend/tests/integration/test_authorization_scoping.py +++ b/backend/tests/integration/test_authorization_scoping.py @@ -13,7 +13,7 @@ PatientState, PropertyEntity, SavedViewEntityType, - SavedViewVisibility, + ScopeVisibility, Sex, UpdatePropertyDefinitionInput, ) @@ -24,8 +24,19 @@ PropertyDefinitionQuery, validate_property_value_inputs, ) -from api.resolvers.saved_view import SavedViewQuery -from api.resolvers.task_preset import _can_edit_preset +from api.resolvers.saved_view import SavedViewMutation, SavedViewQuery +from api.resolvers.task_preset import ( + TaskPresetMutation, + TaskPresetQuery, + _can_edit_preset, +) +from api.inputs import ( + CreateTaskPresetInput, + TaskGraphInput, + TaskGraphNodeInput, + UpdateSavedViewInput, + UpdateTaskPresetInput, +) from api.services.subscription import effective_root_location_ids from database import models from database.models.user import user_root_locations @@ -76,19 +87,29 @@ async def _mk_location(db, lid, title, kind="CLINIC", parent_id=None): async def two_tenants(db_session): user1 = await _mk_user(db_session, "user-1") user2 = await _mk_user(db_session, "user-2") + user3 = await _mk_user(db_session, "user-3") + user4 = await _mk_user(db_session, "user-4") loc_a = await _mk_location(db_session, "loc-a", "Tenant A") loc_b = await _mk_location(db_session, "loc-b", "Tenant B") child_a = await _mk_location( db_session, "loc-a-child", "Ward A1", kind="WARD", parent_id="loc-a" ) + child_a2 = await _mk_location( + db_session, "loc-a-child-2", "Ward A2", kind="WARD", parent_id="loc-a" + ) await _add_root(db_session, user1, loc_a) await _add_root(db_session, user2, loc_b) + await _add_root(db_session, user3, child_a) + await _add_root(db_session, user4, loc_a) return { "user1": user1, "user2": user2, + "user3": user3, + "user4": user4, "loc_a": loc_a, "loc_b": loc_b, "child_a": child_a, + "child_a2": child_a2, } @@ -103,6 +124,7 @@ async def test_property_definition_is_scoped_to_its_location(two_tenants, db_ses name="Blood type", field_type=FieldType.FIELD_TYPE_TEXT, allowed_entities=[PropertyEntity.PATIENT], + visibility=ScopeVisibility.PUBLIC, location_id="loc-a", ), ) @@ -125,6 +147,7 @@ async def test_foreign_user_cannot_modify_definition(two_tenants, db_session): name="Scoped", field_type=FieldType.FIELD_TYPE_TEXT, allowed_entities=[PropertyEntity.PATIENT], + visibility=ScopeVisibility.PUBLIC, location_id="loc-a", ), ) @@ -137,7 +160,7 @@ async def test_foreign_user_cannot_modify_definition(two_tenants, db_session): @pytest.mark.asyncio -async def test_create_definition_without_location_defaults_into_scope( +async def test_create_public_definition_without_location_defaults_into_scope( two_tenants, db_session ): info1 = MockInfo(db_session, two_tenants["user1"]) @@ -147,9 +170,151 @@ async def test_create_definition_without_location_defaults_into_scope( name="Defaulted", field_type=FieldType.FIELD_TYPE_TEXT, allowed_entities=[PropertyEntity.PATIENT], + visibility=ScopeVisibility.PUBLIC, ), ) assert created.location_id == "loc-a" + assert created.visibility == "public" + + +@pytest.mark.asyncio +async def test_private_definition_is_only_visible_to_owner(two_tenants, db_session): + info1 = MockInfo(db_session, two_tenants["user1"]) + info3 = MockInfo(db_session, two_tenants["user3"]) + created = await PropertyDefinitionMutation().create_property_definition( + info1, + CreatePropertyDefinitionInput( + name="Mine", + field_type=FieldType.FIELD_TYPE_TEXT, + allowed_entities=[PropertyEntity.PATIENT], + location_id="loc-a", + ), + ) + assert created.visibility == "private" + assert created.location_id is None + assert created.owner_user_id == "user-1" + + assert created.id in [ + d.id for d in await PropertyDefinitionQuery().property_definitions(info1) + ] + assert created.id not in [ + d.id for d in await PropertyDefinitionQuery().property_definitions(info3) + ] + with pytest.raises(GraphQLError): + await PropertyDefinitionMutation().update_property_definition( + info3, created.id, UpdatePropertyDefinitionInput(name="x") + ) + + +@pytest.mark.asyncio +async def test_public_definition_is_visible_along_the_location_path( + two_tenants, db_session +): + info1 = MockInfo(db_session, two_tenants["user1"]) + info3 = MockInfo(db_session, two_tenants["user3"]) + info4 = MockInfo(db_session, two_tenants["user4"]) + on_parent = await PropertyDefinitionMutation().create_property_definition( + info1, + CreatePropertyDefinitionInput( + name="Parent", + field_type=FieldType.FIELD_TYPE_TEXT, + allowed_entities=[PropertyEntity.PATIENT], + visibility=ScopeVisibility.PUBLIC, + location_id="loc-a", + ), + ) + on_child = await PropertyDefinitionMutation().create_property_definition( + info1, + CreatePropertyDefinitionInput( + name="Child", + field_type=FieldType.FIELD_TYPE_TEXT, + allowed_entities=[PropertyEntity.PATIENT], + visibility=ScopeVisibility.PUBLIC, + location_id="loc-a-child", + ), + ) + on_sibling = await PropertyDefinitionMutation().create_property_definition( + info1, + CreatePropertyDefinitionInput( + name="Sibling", + field_type=FieldType.FIELD_TYPE_TEXT, + allowed_entities=[PropertyEntity.PATIENT], + visibility=ScopeVisibility.PUBLIC, + location_id="loc-a-child-2", + ), + ) + + parent_root_ids = { + d.id for d in await PropertyDefinitionQuery().property_definitions(info1) + } + assert {on_parent.id, on_child.id, on_sibling.id} <= parent_root_ids + + child_root_ids = { + d.id for d in await PropertyDefinitionQuery().property_definitions(info3) + } + assert on_parent.id in child_root_ids + assert on_child.id in child_root_ids + assert on_sibling.id not in child_root_ids + + unselected_ids = { + d.id for d in await PropertyDefinitionQuery().property_definitions(info4) + } + assert {on_parent.id, on_child.id, on_sibling.id} <= unselected_ids + selected_ids = { + d.id + for d in await PropertyDefinitionQuery().property_definitions( + info4, root_location_ids=["loc-a-child"] + ) + } + assert on_parent.id in selected_ids + assert on_child.id in selected_ids + assert on_sibling.id not in selected_ids + owner_selected_ids = { + d.id + for d in await PropertyDefinitionQuery().property_definitions( + info1, root_location_ids=["loc-a-child"] + ) + } + assert on_sibling.id in owner_selected_ids + + with pytest.raises(GraphQLError): + await PropertyDefinitionMutation().update_property_definition( + info3, on_parent.id, UpdatePropertyDefinitionInput(name="x") + ) + updated = await PropertyDefinitionMutation().update_property_definition( + info3, on_child.id, UpdatePropertyDefinitionInput(name="renamed") + ) + assert updated.name == "renamed" + + +@pytest.mark.asyncio +async def test_public_definition_can_be_made_private(two_tenants, db_session): + info1 = MockInfo(db_session, two_tenants["user1"]) + created = await PropertyDefinitionMutation().create_property_definition( + info1, + CreatePropertyDefinitionInput( + name="Toggle", + field_type=FieldType.FIELD_TYPE_TEXT, + allowed_entities=[PropertyEntity.PATIENT], + visibility=ScopeVisibility.PUBLIC, + location_id="loc-a", + ), + ) + updated = await PropertyDefinitionMutation().update_property_definition( + info1, + created.id, + UpdatePropertyDefinitionInput(visibility=ScopeVisibility.PRIVATE), + ) + assert updated.visibility == "private" + assert updated.location_id is None + with pytest.raises(GraphQLError): + await PropertyDefinitionMutation().update_property_definition( + info1, + created.id, + UpdatePropertyDefinitionInput( + visibility=ScopeVisibility.PUBLIC, location_id="loc-b" + ), + ) @pytest.mark.asyncio @@ -160,6 +325,7 @@ async def test_global_definition_is_immutable(two_tenants, db_session): name="Legacy", field_type="FIELD_TYPE_TEXT", allowed_entities="PATIENT", + visibility="public", location_id=None, ) db_session.add(legacy) @@ -180,6 +346,7 @@ async def test_cannot_use_property_definition_out_of_scope(two_tenants, db_sessi name="Only A", field_type=FieldType.FIELD_TYPE_TEXT, allowed_entities=[PropertyEntity.PATIENT], + visibility=ScopeVisibility.PUBLIC, location_id="loc-a", ), ) @@ -192,10 +359,10 @@ async def test_cannot_use_property_definition_out_of_scope(two_tenants, db_sessi @pytest.mark.asyncio -async def test_link_shared_view_denied_across_scope(two_tenants, db_session): +async def test_public_view_denied_across_scope(two_tenants, db_session): info1 = MockInfo(db_session, two_tenants["user1"]) info2 = MockInfo(db_session, two_tenants["user2"]) - from api.resolvers.saved_view import SavedViewMutation + info3 = MockInfo(db_session, two_tenants["user3"]) view = await SavedViewMutation().create_saved_view( info1, @@ -205,16 +372,124 @@ async def test_link_shared_view_denied_across_scope(two_tenants, db_session): filter_definition="{}", sort_definition="{}", parameters="{}", - visibility=SavedViewVisibility.LINK_SHARED, + visibility=ScopeVisibility.PUBLIC, location_id="loc-a", ), ) assert view.location_id == "loc-a" assert (await SavedViewQuery().saved_view(info1, view.id)) is not None + assert (await SavedViewQuery().saved_view(info3, view.id)) is not None + assert view.id in [v.id for v in await SavedViewQuery().my_saved_views(info3)] with pytest.raises(GraphQLError): await SavedViewQuery().saved_view(info2, view.id) +@pytest.mark.asyncio +async def test_private_view_is_owner_only_and_needs_no_location( + two_tenants, db_session +): + info1 = MockInfo(db_session, two_tenants["user1"]) + info3 = MockInfo(db_session, two_tenants["user3"]) + + view = await SavedViewMutation().create_saved_view( + info1, + CreateSavedViewInput( + name="Private", + base_entity_type=SavedViewEntityType.TASK, + filter_definition="{}", + sort_definition="{}", + parameters="{}", + location_id="loc-a", + ), + ) + assert view.visibility == ScopeVisibility.PRIVATE + assert view.location_id is None + assert view.id in [v.id for v in await SavedViewQuery().my_saved_views(info1)] + assert view.id not in [v.id for v in await SavedViewQuery().my_saved_views(info3)] + with pytest.raises(GraphQLError): + await SavedViewQuery().saved_view(info3, view.id) + + published = await SavedViewMutation().update_saved_view( + info1, + view.id, + UpdateSavedViewInput(visibility=ScopeVisibility.PUBLIC, location_id="loc-a-child"), + ) + assert published.visibility == ScopeVisibility.PUBLIC + assert published.location_id == "loc-a-child" + assert (await SavedViewQuery().saved_view(info3, view.id)) is not None + with pytest.raises(GraphQLError): + await SavedViewMutation().update_saved_view( + info3, view.id, UpdateSavedViewInput(name="hijacked") + ) + + +def _preset_input(name: str, **kwargs) -> CreateTaskPresetInput: + return CreateTaskPresetInput( + name=name, + graph=TaskGraphInput( + nodes=[TaskGraphNodeInput(node_id="n1", title="Step")], + edges=[], + ), + **kwargs, + ) + + +@pytest.mark.asyncio +async def test_task_presets_are_scoped_by_visibility(two_tenants, db_session): + info1 = MockInfo(db_session, two_tenants["user1"]) + info2 = MockInfo(db_session, two_tenants["user2"]) + info3 = MockInfo(db_session, two_tenants["user3"]) + + private = await TaskPresetMutation().create_task_preset( + info1, _preset_input("Private") + ) + assert private.visibility == ScopeVisibility.PRIVATE + assert private.location_id is None + assert private.is_owner is True + + public = await TaskPresetMutation().create_task_preset( + info1, + _preset_input( + "Public", visibility=ScopeVisibility.PUBLIC, location_id="loc-a" + ), + ) + assert public.location_id == "loc-a" + + ids_for_owner = {p.id for p in await TaskPresetQuery().task_presets(info1)} + assert {private.id, public.id} <= ids_for_owner + + ids_for_child_root = {p.id for p in await TaskPresetQuery().task_presets(info3)} + assert public.id in ids_for_child_root + assert private.id not in ids_for_child_root + visible = await TaskPresetQuery().task_preset(info3, public.id) + assert visible is not None and visible.is_owner is False + + assert (await TaskPresetQuery().task_presets(info2)) == [] + with pytest.raises(GraphQLError): + await TaskPresetQuery().task_preset(info2, public.id) + with pytest.raises(GraphQLError): + await TaskPresetQuery().task_preset(info3, private.id) + with pytest.raises(GraphQLError): + await TaskPresetMutation().update_task_preset( + info3, public.id, UpdateTaskPresetInput(name="hijacked") + ) + with pytest.raises(GraphQLError): + await TaskPresetMutation().create_task_preset( + info1, + _preset_input( + "Foreign", visibility=ScopeVisibility.PUBLIC, location_id="loc-b" + ), + ) + + unpublished = await TaskPresetMutation().update_task_preset( + info1, public.id, UpdateTaskPresetInput(visibility=ScopeVisibility.PRIVATE) + ) + assert unpublished.visibility == ScopeVisibility.PRIVATE + assert unpublished.location_id is None + with pytest.raises(GraphQLError): + await TaskPresetQuery().task_preset(info3, public.id) + + @pytest.mark.asyncio async def test_audit_rejects_invalid_case_id(two_tenants, db_session): info1 = MockInfo(db_session, two_tenants["user1"]) @@ -284,9 +559,9 @@ async def test_create_root_location_is_denied(two_tenants, db_session): ) -def test_global_preset_not_editable_by_non_owner(): +def test_public_preset_not_editable_by_non_owner(): class _Preset: - scope = "GLOBAL" + visibility = "public" owner_user_id = "creator" assert _can_edit_preset(_Preset(), "someone-else") is False diff --git a/docs/VIEWS_ARCHITECTURE.md b/docs/VIEWS_ARCHITECTURE.md index a21af7b8..4ac1de06 100644 --- a/docs/VIEWS_ARCHITECTURE.md +++ b/docs/VIEWS_ARCHITECTURE.md @@ -10,10 +10,22 @@ A **SavedView** stores a named configuration for list screens: | `sortDefinition` | JSON string: TanStack `SortingState` array. | | `parameters` | JSON string: **scope** and cross-entity context — `rootLocationIds`, `locationId`, `searchQuery` (patient), `assigneeId` (task / my tasks). | | `baseEntityType` | `PATIENT` or `TASK` — primary tab when opening `/view/:uid`. | -| `visibility` | `PRIVATE` or `LINK_SHARED` (share by link / UID). | +| `visibility` | `PRIVATE` (owner only, no location needed) or `PUBLIC` (stored at a scaffold node via `locationId`). | +| `locationId` | Scaffold node a `PUBLIC` view is stored at. Everyone who can reach that node sees the view: users whose selected root location lies on the node's path (ancestor or descendant). | Location is **not** a separate route anymore for saved views: it is encoded in `parameters` (`rootLocationIds`, `locationId`). +## Scoping to a scaffold node + +Saved views, task presets and property definitions share the same scoping model (`ScopeVisibility`): + +- **Private** (default): only the owner sees the entry. No scaffold node is required. +- **Public**: the entry is stored at a scaffold node (`locationId`). It is visible to everyone who can access that node and whose selected root location lies on the node's path, i.e. the node itself, its subtree and its ancestors. Storing an entry at the root makes it visible to everyone. + +List queries (`mySavedViews`, `taskPresets`, `propertyDefinitions`) accept `rootLocationIds`; the web client passes the currently selected root locations so lists follow the app node selection. Editing stays with the owner (views, presets) or with users who can access the node (property definitions). + +Migration `add_scope_visibility` makes existing property definitions public on the root node and turns existing saved views and presets private. + ## Cross-entity model - **Patient view** @@ -47,7 +59,8 @@ mutation { filterDefinition: "[]" sortDefinition: "[]" parameters: "{\"rootLocationIds\":[\"…\"],\"locationId\":null,\"searchQuery\":\"\"}" - visibility: PRIVATE + visibility: PUBLIC + locationId: "…" }) { id } } ``` @@ -75,5 +88,4 @@ Apply Alembic migration `add_saved_views_table` (or your project’s revision ch ## Follow-ups - **Update view** from UI (owner edits in place → `updateSavedView`) instead of only “save as new”. -- **Share visibility** UI (`LINK_SHARED`) and server checks are already modeled; expose in settings. - **Redirect** `/location/[id]` → a default view or keep both during transition. diff --git a/web/api/gql/generated.ts b/web/api/gql/generated.ts index 0dee2f40..64076a4d 100644 --- a/web/api/gql/generated.ts +++ b/web/api/gql/generated.ts @@ -1,1432 +1,447 @@ -import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; -export type Maybe = T | null; -export type InputMaybe = Maybe; -export type Exact = { [K in keyof T]: T[K] }; -export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; -export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; -export type MakeEmpty = { [_ in K]?: never }; +/** Internal type. DO NOT USE DIRECTLY. */ +type Exact = { [K in keyof T]: T[K] }; +/** Internal type. DO NOT USE DIRECTLY. */ export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; -/** All built-in and custom scalars, mapped to their actual values */ -export type Scalars = { - ID: { input: string; output: string; } - String: { input: string; output: string; } - Boolean: { input: boolean; output: boolean; } - Int: { input: number; output: number; } - Float: { input: number; output: number; } - /** Date (isoformat) */ - Date: { input: any; output: any; } - /** Date with time (isoformat) */ - DateTime: { input: any; output: any; } -}; - -export type ApplyTaskGraphInput = { - assignToCurrentUser?: Scalars['Boolean']['input']; - graph?: InputMaybe; - patientId: Scalars['ID']['input']; - presetId?: InputMaybe; - sourcePresetId?: InputMaybe; -}; - -export type AuditLogType = { - __typename?: 'AuditLogType'; - activity: Scalars['String']['output']; - caseId: Scalars['String']['output']; - context?: Maybe; - timestamp: Scalars['DateTime']['output']; - userId?: Maybe; -}; - -export type CreateLocationNodeInput = { - kind: LocationType; - parentId?: InputMaybe; - title: Scalars['String']['input']; -}; - -export type CreatePatientInput = { - assignedLocationId?: InputMaybe; - assignedLocationIds?: InputMaybe>; - birthdate: Scalars['Date']['input']; - clinicId: Scalars['ID']['input']; - description?: InputMaybe; - firstname: Scalars['String']['input']; - lastname: Scalars['String']['input']; - positionId?: InputMaybe; - properties?: InputMaybe>; - sex: Sex; - state?: InputMaybe; - teamIds?: InputMaybe>; -}; - -export type CreatePropertyDefinitionInput = { - allowedEntities: Array; - description?: InputMaybe; - fieldType: FieldType; - isActive?: Scalars['Boolean']['input']; - name: Scalars['String']['input']; - options?: InputMaybe>; -}; - -export type CreateSavedViewInput = { - baseEntityType: SavedViewEntityType; - filterDefinition: Scalars['String']['input']; - name: Scalars['String']['input']; - parameters: Scalars['String']['input']; - relatedFilterDefinition?: Scalars['String']['input']; - relatedParameters?: Scalars['String']['input']; - relatedSortDefinition?: Scalars['String']['input']; - sortDefinition: Scalars['String']['input']; - visibility?: SavedViewVisibility; -}; - -export type CreateTaskInput = { - assigneeIds?: InputMaybe>; - assigneeTeamId?: InputMaybe; - description?: InputMaybe; - dueDate?: InputMaybe; - estimatedTime?: InputMaybe; - patientId?: InputMaybe; - previousTaskIds?: InputMaybe>; - priority?: InputMaybe; - properties?: InputMaybe>; - title: Scalars['String']['input']; -}; - -export type CreateTaskPresetInput = { - graph: TaskGraphInput; - key?: InputMaybe; - name: Scalars['String']['input']; - scope: TaskPresetScope; -}; - -export enum FieldType { - FieldTypeCheckbox = 'FIELD_TYPE_CHECKBOX', - FieldTypeDate = 'FIELD_TYPE_DATE', - FieldTypeDateTime = 'FIELD_TYPE_DATE_TIME', - FieldTypeMultiSelect = 'FIELD_TYPE_MULTI_SELECT', - FieldTypeNumber = 'FIELD_TYPE_NUMBER', - FieldTypeSelect = 'FIELD_TYPE_SELECT', - FieldTypeText = 'FIELD_TYPE_TEXT', - FieldTypeUnspecified = 'FIELD_TYPE_UNSPECIFIED', - FieldTypeUser = 'FIELD_TYPE_USER' -} - -export type LocationNodeType = { - __typename?: 'LocationNodeType'; - children: Array; - id: Scalars['ID']['output']; - kind: LocationType; - organizationIds: Array; - parent?: Maybe; - parentId?: Maybe; - patients: Array; - title: Scalars['String']['output']; -}; - -export enum LocationType { - Bed = 'BED', - Clinic = 'CLINIC', - Hospital = 'HOSPITAL', - Other = 'OTHER', - Practice = 'PRACTICE', - Room = 'ROOM', - Team = 'TEAM', - Ward = 'WARD' -} - -export type Mutation = { - __typename?: 'Mutation'; - addTaskAssignee: TaskType; - admitPatient: PatientType; - applyTaskGraph: Array; - assignTaskToTeam: TaskType; - clearPatientProperty: Scalars['Int']['output']; - clearTaskProperty: Scalars['Int']['output']; - completeTask: TaskType; - createLocationNode: LocationNodeType; - createPatient: PatientType; - createPropertyDefinition: PropertyDefinitionType; - createSavedView: SavedView; - createTask: TaskType; - createTaskPreset: TaskPresetType; - deleteLocationNode: Scalars['Boolean']['output']; - deletePatient: Scalars['Boolean']['output']; - deletePropertyDefinition: Scalars['Boolean']['output']; - deleteSavedView: Scalars['Boolean']['output']; - deleteTask: Scalars['Boolean']['output']; - deleteTaskPreset: Scalars['Boolean']['output']; - dischargePatient: PatientType; - duplicateSavedView: SavedView; - markPatientDead: PatientType; - removeTaskAssignee: TaskType; - reopenTask: TaskType; - unassignTaskFromTeam: TaskType; - updateLocationNode: LocationNodeType; - updatePatient: PatientType; - updateProfilePicture: UserType; - updatePropertyDefinition: PropertyDefinitionType; - updateSavedView: SavedView; - updateTask: TaskType; - updateTaskPreset: TaskPresetType; - waitPatient: PatientType; -}; - - -export type MutationAddTaskAssigneeArgs = { - id: Scalars['ID']['input']; - userId: Scalars['ID']['input']; -}; - - -export type MutationAdmitPatientArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationApplyTaskGraphArgs = { - data: ApplyTaskGraphInput; -}; - - -export type MutationAssignTaskToTeamArgs = { - id: Scalars['ID']['input']; - teamId: Scalars['ID']['input']; -}; - - -export type MutationClearPatientPropertyArgs = { - patientIds: Array; - propertyDefinitionId: Scalars['ID']['input']; -}; - - -export type MutationClearTaskPropertyArgs = { - propertyDefinitionId: Scalars['ID']['input']; - taskIds: Array; -}; - - -export type MutationCompleteTaskArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationCreateLocationNodeArgs = { - data: CreateLocationNodeInput; -}; - - -export type MutationCreatePatientArgs = { - data: CreatePatientInput; -}; - - -export type MutationCreatePropertyDefinitionArgs = { - data: CreatePropertyDefinitionInput; -}; - - -export type MutationCreateSavedViewArgs = { - data: CreateSavedViewInput; -}; - - -export type MutationCreateTaskArgs = { - data: CreateTaskInput; -}; - - -export type MutationCreateTaskPresetArgs = { - data: CreateTaskPresetInput; -}; - - -export type MutationDeleteLocationNodeArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationDeletePatientArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationDeletePropertyDefinitionArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationDeleteSavedViewArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationDeleteTaskArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationDeleteTaskPresetArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationDischargePatientArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationDuplicateSavedViewArgs = { - id: Scalars['ID']['input']; - name: Scalars['String']['input']; -}; - - -export type MutationMarkPatientDeadArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationRemoveTaskAssigneeArgs = { - id: Scalars['ID']['input']; - userId: Scalars['ID']['input']; -}; - - -export type MutationReopenTaskArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationUnassignTaskFromTeamArgs = { - id: Scalars['ID']['input']; -}; - - -export type MutationUpdateLocationNodeArgs = { - data: UpdateLocationNodeInput; - id: Scalars['ID']['input']; -}; - - -export type MutationUpdatePatientArgs = { - data: UpdatePatientInput; - id: Scalars['ID']['input']; -}; - - -export type MutationUpdateProfilePictureArgs = { - data: UpdateProfilePictureInput; -}; - - -export type MutationUpdatePropertyDefinitionArgs = { - data: UpdatePropertyDefinitionInput; - id: Scalars['ID']['input']; -}; - - -export type MutationUpdateSavedViewArgs = { - data: UpdateSavedViewInput; - id: Scalars['ID']['input']; -}; - - -export type MutationUpdateTaskArgs = { - data: UpdateTaskInput; - id: Scalars['ID']['input']; -}; - - -export type MutationUpdateTaskPresetArgs = { - data: UpdateTaskPresetInput; - id: Scalars['ID']['input']; -}; - - -export type MutationWaitPatientArgs = { - id: Scalars['ID']['input']; -}; - -export type PaginationInput = { - pageIndex?: Scalars['Int']['input']; - pageSize?: InputMaybe; -}; - -export enum PatientState { - Admitted = 'ADMITTED', - Dead = 'DEAD', - Discharged = 'DISCHARGED', - Wait = 'WAIT' -} - -export type PatientType = { - __typename?: 'PatientType'; - age: Scalars['Int']['output']; - assignedLocation?: Maybe; - assignedLocationId?: Maybe; - assignedLocations: Array; - birthdate: Scalars['Date']['output']; - checksum: Scalars['String']['output']; - clinic: LocationNodeType; - clinicId: Scalars['ID']['output']; - clinicUpdateDate?: Maybe; - description?: Maybe; - firstname: Scalars['String']['output']; - id: Scalars['ID']['output']; - lastname: Scalars['String']['output']; - name: Scalars['String']['output']; - position?: Maybe; - positionId?: Maybe; - positionUpdateDate?: Maybe; - properties: Array; - sex: Sex; - state: PatientState; - stateUpdateDate?: Maybe; - tasks: Array; - teams: Array; - updateDate?: Maybe; -}; - - -export type PatientTypeTasksArgs = { - done?: InputMaybe; -}; - -export type PropertyDefinitionType = { - __typename?: 'PropertyDefinitionType'; - allowedEntities: Array; - description?: Maybe; - fieldType: FieldType; - id: Scalars['ID']['output']; - isActive: Scalars['Boolean']['output']; - name: Scalars['String']['output']; - options: Array; -}; - -export enum PropertyEntity { - Patient = 'PATIENT', - Task = 'TASK' -} - -export type PropertyValueInput = { - booleanValue?: InputMaybe; - dateTimeValue?: InputMaybe; - dateValue?: InputMaybe; - definitionId: Scalars['ID']['input']; - multiSelectValues?: InputMaybe>; - numberValue?: InputMaybe; - selectValue?: InputMaybe; - textValue?: InputMaybe; - userValue?: InputMaybe; -}; - -export type PropertyValueType = { - __typename?: 'PropertyValueType'; - booleanValue?: Maybe; - dateTimeValue?: Maybe; - dateValue?: Maybe; - definition: PropertyDefinitionType; - id: Scalars['ID']['output']; - multiSelectValues?: Maybe>; - numberValue?: Maybe; - selectValue?: Maybe; - team?: Maybe; - textValue?: Maybe; - user?: Maybe; - userValue?: Maybe; -}; - -export type Query = { - __typename?: 'Query'; - auditLogs: Array; - locationNode?: Maybe; - locationNodes: Array; - locationRoots: Array; - me?: Maybe; - mySavedViews: Array; - patient?: Maybe; - patients: Array; - patientsTotal: Scalars['Int']['output']; - propertyDefinitions: Array; - queryableFields: Array; - recentPatients: Array; - recentPatientsTotal: Scalars['Int']['output']; - recentTasks: Array; - recentTasksTotal: Scalars['Int']['output']; - savedView?: Maybe; - scopedPatientCounts: ScopedPatientCounts; - task?: Maybe; - taskPreset?: Maybe; - taskPresetByKey?: Maybe; - taskPresets: Array; - tasks: Array; - tasksTotal: Scalars['Int']['output']; - user?: Maybe; - users: Array; -}; - - -export type QueryAuditLogsArgs = { - caseId: Scalars['ID']['input']; - limit?: InputMaybe; - offset?: InputMaybe; -}; - - -export type QueryLocationNodeArgs = { - id: Scalars['ID']['input']; -}; - - -export type QueryLocationNodesArgs = { - kind?: InputMaybe; - limit?: InputMaybe; - offset?: InputMaybe; - orderByName?: Scalars['Boolean']['input']; - parentId?: InputMaybe; - recursive?: Scalars['Boolean']['input']; - search?: InputMaybe; -}; - - -export type QueryPatientArgs = { - id: Scalars['ID']['input']; -}; - - -export type QueryPatientsArgs = { - filters?: InputMaybe>; - locationNodeId?: InputMaybe; - pagination?: InputMaybe; - rootLocationIds?: InputMaybe>; - search?: InputMaybe; - sorts?: InputMaybe>; - states?: InputMaybe>; -}; - - -export type QueryPatientsTotalArgs = { - filters?: InputMaybe>; - locationNodeId?: InputMaybe; - rootLocationIds?: InputMaybe>; - search?: InputMaybe; - sorts?: InputMaybe>; - states?: InputMaybe>; -}; - - -export type QueryQueryableFieldsArgs = { - entity: Scalars['String']['input']; -}; - - -export type QueryRecentPatientsArgs = { - filters?: InputMaybe>; - pagination?: InputMaybe; - rootLocationIds?: InputMaybe>; - search?: InputMaybe; - sorts?: InputMaybe>; -}; - - -export type QueryRecentPatientsTotalArgs = { - filters?: InputMaybe>; - rootLocationIds?: InputMaybe>; - search?: InputMaybe; - sorts?: InputMaybe>; -}; - - -export type QueryRecentTasksArgs = { - filters?: InputMaybe>; - pagination?: InputMaybe; - rootLocationIds?: InputMaybe>; - search?: InputMaybe; - sorts?: InputMaybe>; -}; - - -export type QueryRecentTasksTotalArgs = { - filters?: InputMaybe>; - rootLocationIds?: InputMaybe>; - search?: InputMaybe; - sorts?: InputMaybe>; -}; - - -export type QuerySavedViewArgs = { - id: Scalars['ID']['input']; -}; - - -export type QueryScopedPatientCountsArgs = { - rootLocationIds?: InputMaybe>; -}; - - -export type QueryTaskArgs = { - id: Scalars['ID']['input']; -}; - - -export type QueryTaskPresetArgs = { - id: Scalars['ID']['input']; -}; - - -export type QueryTaskPresetByKeyArgs = { - key: Scalars['String']['input']; -}; - - -export type QueryTasksArgs = { - assigneeId?: InputMaybe; - assigneeTeamId?: InputMaybe; - filters?: InputMaybe>; - pagination?: InputMaybe; - patientId?: InputMaybe; - rootLocationIds?: InputMaybe>; - search?: InputMaybe; - sorts?: InputMaybe>; -}; - - -export type QueryTasksTotalArgs = { - assigneeId?: InputMaybe; - assigneeTeamId?: InputMaybe; - filters?: InputMaybe>; - patientId?: InputMaybe; - rootLocationIds?: InputMaybe>; - search?: InputMaybe; - sorts?: InputMaybe>; -}; - - -export type QueryUserArgs = { - id: Scalars['ID']['input']; -}; - - -export type QueryUsersArgs = { - filters?: InputMaybe>; - pagination?: InputMaybe; - search?: InputMaybe; - sorts?: InputMaybe>; -}; - -export type QueryFilterClauseInput = { - fieldKey: Scalars['String']['input']; - operator: QueryOperator; - value?: InputMaybe; -}; - -export type QueryFilterValueInput = { - boolValue?: InputMaybe; - dateMax?: InputMaybe; - dateMin?: InputMaybe; - dateValue?: InputMaybe; - floatMax?: InputMaybe; - floatMin?: InputMaybe; - floatValue?: InputMaybe; - stringValue?: InputMaybe; - stringValues?: InputMaybe>; - uuidValue?: InputMaybe; - uuidValues?: InputMaybe>; -}; - -export enum QueryOperator { - AllIn = 'ALL_IN', - AnyEq = 'ANY_EQ', - AnyIn = 'ANY_IN', - Between = 'BETWEEN', - Contains = 'CONTAINS', - NotBetween = 'NOT_BETWEEN', - NotContains = 'NOT_CONTAINS', - EndsWith = 'ENDS_WITH', - Eq = 'EQ', - Gt = 'GT', - Gte = 'GTE', - In = 'IN', - IsEmpty = 'IS_EMPTY', - IsNotEmpty = 'IS_NOT_EMPTY', - IsNotNull = 'IS_NOT_NULL', - IsNull = 'IS_NULL', - Lt = 'LT', - Lte = 'LTE', - Neq = 'NEQ', - NoneIn = 'NONE_IN', - NotIn = 'NOT_IN', - StartsWith = 'STARTS_WITH' -} - -export type QuerySearchInput = { - includeProperties?: Scalars['Boolean']['input']; - searchText?: InputMaybe; -}; - -export type QuerySortClauseInput = { - direction: SortDirection; - fieldKey: Scalars['String']['input']; -}; - -export type QueryableChoiceMeta = { - __typename?: 'QueryableChoiceMeta'; - optionKeys: Array; - optionLabels: Array; -}; - -export type QueryableField = { - __typename?: 'QueryableField'; - allowedOperators: Array; - choice?: Maybe; - filterable: Scalars['Boolean']['output']; - key: Scalars['String']['output']; - kind: QueryableFieldKind; - label: Scalars['String']['output']; - propertyDefinitionId?: Maybe; - relation?: Maybe; - searchable: Scalars['Boolean']['output']; - sortDirections: Array; - sortable: Scalars['Boolean']['output']; - valueType: QueryableValueType; -}; - -export enum QueryableFieldKind { - Choice = 'CHOICE', - ChoiceList = 'CHOICE_LIST', - Property = 'PROPERTY', - Reference = 'REFERENCE', - ReferenceList = 'REFERENCE_LIST', - Scalar = 'SCALAR' -} - -export type QueryableRelationMeta = { - __typename?: 'QueryableRelationMeta'; - allowedFilterModes: Array; - idFieldKey: Scalars['String']['output']; - labelFieldKey: Scalars['String']['output']; - targetEntity: Scalars['String']['output']; -}; - -export enum QueryableValueType { - Boolean = 'BOOLEAN', - Date = 'DATE', - Datetime = 'DATETIME', - Number = 'NUMBER', - String = 'STRING', - StringList = 'STRING_LIST', - Uuid = 'UUID', - UuidList = 'UUID_LIST' -} - -export enum ReferenceFilterMode { - Id = 'ID', - Label = 'LABEL' -} - -export type SavedView = { - __typename?: 'SavedView'; - baseEntityType: SavedViewEntityType; - createdAt: Scalars['String']['output']; - filterDefinition: Scalars['String']['output']; - id: Scalars['ID']['output']; - isOwner: Scalars['Boolean']['output']; - name: Scalars['String']['output']; - ownerUserId: Scalars['ID']['output']; - parameters: Scalars['String']['output']; - relatedFilterDefinition: Scalars['String']['output']; - relatedParameters: Scalars['String']['output']; - relatedSortDefinition: Scalars['String']['output']; - sortDefinition: Scalars['String']['output']; - updatedAt: Scalars['String']['output']; - visibility: SavedViewVisibility; -}; - -export enum SavedViewEntityType { - Patient = 'PATIENT', - Task = 'TASK' -} - -export enum SavedViewVisibility { - LinkShared = 'LINK_SHARED', - Private = 'PRIVATE' -} - -export type ScopedPatientCounts = { - __typename?: 'ScopedPatientCounts'; - scopedPatientsAdmitted: Scalars['Int']['output']; - scopedPatientsDeceased: Scalars['Int']['output']; - scopedPatientsDischarged: Scalars['Int']['output']; - scopedPatientsTotal: Scalars['Int']['output']; - scopedPatientsWaiting: Scalars['Int']['output']; -}; - -export enum Sex { - Female = 'FEMALE', - Male = 'MALE', - Unknown = 'UNKNOWN' -} - -export enum SortDirection { - Asc = 'ASC', - Desc = 'DESC' -} - -export type Subscription = { - __typename?: 'Subscription'; - locationNodeCreated: Scalars['ID']['output']; - locationNodeDeleted: Scalars['ID']['output']; - locationNodeUpdated: Scalars['ID']['output']; - patientCreated: Scalars['ID']['output']; - patientDeleted: Scalars['ID']['output']; - patientStateChanged: Scalars['ID']['output']; - patientUpdated: Scalars['ID']['output']; - taskCreated: Scalars['ID']['output']; - taskDeleted: Scalars['ID']['output']; - taskUpdated: Scalars['ID']['output']; -}; - - -export type SubscriptionLocationNodeUpdatedArgs = { - locationId?: InputMaybe; -}; - - -export type SubscriptionPatientCreatedArgs = { - rootLocationIds?: InputMaybe>; -}; - - -export type SubscriptionPatientDeletedArgs = { - rootLocationIds?: InputMaybe>; -}; - - -export type SubscriptionPatientStateChangedArgs = { - patientId?: InputMaybe; - rootLocationIds?: InputMaybe>; -}; - - -export type SubscriptionPatientUpdatedArgs = { - patientId?: InputMaybe; - rootLocationIds?: InputMaybe>; -}; - - -export type SubscriptionTaskCreatedArgs = { - rootLocationIds?: InputMaybe>; -}; - - -export type SubscriptionTaskDeletedArgs = { - rootLocationIds?: InputMaybe>; -}; - - -export type SubscriptionTaskUpdatedArgs = { - rootLocationIds?: InputMaybe>; - taskId?: InputMaybe; -}; - -export type TaskGraphEdgeInput = { - fromNodeId: Scalars['String']['input']; - toNodeId: Scalars['String']['input']; -}; - -export type TaskGraphEdgeType = { - __typename?: 'TaskGraphEdgeType'; - fromId: Scalars['String']['output']; - toId: Scalars['String']['output']; -}; - -export type TaskGraphInput = { - edges: Array; - nodes: Array; -}; - -export type TaskGraphNodeInput = { - description?: InputMaybe; - estimatedTime?: InputMaybe; - nodeId: Scalars['String']['input']; - priority?: InputMaybe; - title: Scalars['String']['input']; -}; - -export type TaskGraphNodeType = { - __typename?: 'TaskGraphNodeType'; - description?: Maybe; - estimatedTime?: Maybe; - id: Scalars['String']['output']; - priority?: Maybe; - title: Scalars['String']['output']; -}; - -export type TaskGraphType = { - __typename?: 'TaskGraphType'; - edges: Array; - nodes: Array; -}; - -export enum TaskPresetScope { - Global = 'GLOBAL', - Personal = 'PERSONAL' -} - -export type TaskPresetType = { - __typename?: 'TaskPresetType'; - graph: TaskGraphType; - id: Scalars['ID']['output']; - key: Scalars['String']['output']; - name: Scalars['String']['output']; - ownerUserId?: Maybe; - scope: Scalars['String']['output']; -}; - -export enum TaskPriority { - P1 = 'P1', - P2 = 'P2', - P3 = 'P3', - P4 = 'P4' -} - -export type TaskType = { - __typename?: 'TaskType'; - assigneeTeam?: Maybe; - assigneeTeamId?: Maybe; - assignees: Array; - checksum: Scalars['String']['output']; - creationDate: Scalars['DateTime']['output']; - description?: Maybe; - done: Scalars['Boolean']['output']; - dueDate?: Maybe; - estimatedTime?: Maybe; - id: Scalars['ID']['output']; - patient?: Maybe; - patientId?: Maybe; - priority?: Maybe; - properties: Array; - sourceTaskPresetId?: Maybe; - title: Scalars['String']['output']; - updateDate?: Maybe; -}; - -export type UpdateLocationNodeInput = { - kind?: InputMaybe; - parentId?: InputMaybe; - title?: InputMaybe; -}; - -export type UpdatePatientInput = { - assignedLocationId?: InputMaybe; - assignedLocationIds?: InputMaybe>; - birthdate?: InputMaybe; - checksum?: InputMaybe; - clinicId?: InputMaybe; - description?: InputMaybe; - firstname?: InputMaybe; - lastname?: InputMaybe; - positionId?: InputMaybe; - properties?: InputMaybe>; - sex?: InputMaybe; - teamIds?: InputMaybe>; -}; - -export type UpdateProfilePictureInput = { - avatarUrl: Scalars['String']['input']; -}; - -export type UpdatePropertyDefinitionInput = { - allowedEntities?: InputMaybe>; - description?: InputMaybe; - isActive?: InputMaybe; - name?: InputMaybe; - options?: InputMaybe>; -}; - -export type UpdateSavedViewInput = { - filterDefinition?: InputMaybe; - name?: InputMaybe; - parameters?: InputMaybe; - relatedFilterDefinition?: InputMaybe; - relatedParameters?: InputMaybe; - relatedSortDefinition?: InputMaybe; - sortDefinition?: InputMaybe; - visibility?: InputMaybe; -}; - -export type UpdateTaskInput = { - assigneeIds?: InputMaybe>; - assigneeTeamId?: InputMaybe; - checksum?: InputMaybe; - description?: InputMaybe; - done?: InputMaybe; - dueDate?: InputMaybe; - estimatedTime?: InputMaybe; - patientId?: InputMaybe; - previousTaskIds?: InputMaybe>; - priority?: InputMaybe; - properties?: InputMaybe>; - title?: InputMaybe; -}; - -export type UpdateTaskPresetInput = { - graph?: InputMaybe; - key?: InputMaybe; - name?: InputMaybe; -}; - -export type UserType = { - __typename?: 'UserType'; - avatarUrl?: Maybe; - email?: Maybe; - firstname?: Maybe; - id: Scalars['ID']['output']; - isOnline: Scalars['Boolean']['output']; - lastOnline?: Maybe; - lastname?: Maybe; - name: Scalars['String']['output']; - organizations?: Maybe; - rootLocations: Array; - tasks: Array; - title?: Maybe; - username: Scalars['String']['output']; -}; - - -export type UserTypeTasksArgs = { - rootLocationIds?: InputMaybe>; -}; +import type * as Types from './types'; +import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; +export * from './types' export type GetAuditLogsQueryVariables = Exact<{ - caseId: Scalars['ID']['input']; - limit?: InputMaybe; - offset?: InputMaybe; + caseId: string; + limit?: number | null | undefined; + offset?: number | null | undefined; }>; -export type GetAuditLogsQuery = { __typename?: 'Query', auditLogs: Array<{ __typename?: 'AuditLogType', caseId: string, activity: string, userId?: string | null, timestamp: any, context?: string | null }> }; +export type GetAuditLogsQuery = { auditLogs: Array<{ caseId: string, activity: string, userId: string | null, timestamp: any, context: string | null }> }; export type GetLocationNodeQueryVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type GetLocationNodeQuery = { __typename?: 'Query', locationNode?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parentId?: string | null, parent?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parentId?: string | null, parent?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parentId?: string | null, parent?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parentId?: string | null, parent?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parentId?: string | null } | null } | null } | null } | null } | null }; +export type GetLocationNodeQuery = { locationNode: { id: string, title: string, kind: Types.LocationType, parentId: string | null, parent: { id: string, title: string, kind: Types.LocationType, parentId: string | null, parent: { id: string, title: string, kind: Types.LocationType, parentId: string | null, parent: { id: string, title: string, kind: Types.LocationType, parentId: string | null, parent: { id: string, title: string, kind: Types.LocationType, parentId: string | null } | null } | null } | null } | null } | null }; export type GetLocationsQueryVariables = Exact<{ - limit?: InputMaybe; - offset?: InputMaybe; + limit?: number | null | undefined; + offset?: number | null | undefined; }>; -export type GetLocationsQuery = { __typename?: 'Query', locationNodes: Array<{ __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parentId?: string | null }> }; +export type GetLocationsQuery = { locationNodes: Array<{ id: string, title: string, kind: Types.LocationType, parentId: string | null }> }; export type GetMyTasksQueryVariables = Exact<{ [key: string]: never; }>; -export type GetMyTasksQuery = { __typename?: 'Query', me?: { __typename?: 'UserType', id: string, tasks: Array<{ __typename?: 'TaskType', id: string, title: string, description?: string | null, done: boolean, dueDate?: any | null, priority?: string | null, estimatedTime?: number | null, creationDate: any, updateDate?: any | null, patient?: { __typename?: 'PatientType', id: string, name: string, assignedLocation?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null, assignedLocations: Array<{ __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null }> } | null, assignees: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }> }> } | null }; +export type GetMyTasksQuery = { me: { id: string, tasks: Array<{ id: string, title: string, description: string | null, done: boolean, dueDate: any, priority: string | null, estimatedTime: number | null, creationDate: any, updateDate: any, patient: { id: string, name: string, assignedLocation: { id: string, title: string, parent: { id: string, title: string } | null } | null, assignedLocations: Array<{ id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, parent: { id: string, title: string } | null } | null }> } | null, assignees: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }> }> } | null }; export type GetOverviewDataQueryVariables = Exact<{ - rootLocationIds?: InputMaybe | Scalars['ID']['input']>; - recentPatientsFilters?: InputMaybe | QueryFilterClauseInput>; - recentPatientsSorts?: InputMaybe | QuerySortClauseInput>; - recentPatientsPagination?: InputMaybe; - recentPatientsSearch?: InputMaybe; - recentTasksFilters?: InputMaybe | QueryFilterClauseInput>; - recentTasksSorts?: InputMaybe | QuerySortClauseInput>; - recentTasksPagination?: InputMaybe; - recentTasksSearch?: InputMaybe; + rootLocationIds?: Array | string | null | undefined; + recentPatientsFilters?: Array | Types.QueryFilterClauseInput | null | undefined; + recentPatientsSorts?: Array | Types.QuerySortClauseInput | null | undefined; + recentPatientsPagination?: Types.PaginationInput | null | undefined; + recentPatientsSearch?: Types.QuerySearchInput | null | undefined; + recentTasksFilters?: Array | Types.QueryFilterClauseInput | null | undefined; + recentTasksSorts?: Array | Types.QuerySortClauseInput | null | undefined; + recentTasksPagination?: Types.PaginationInput | null | undefined; + recentTasksSearch?: Types.QuerySearchInput | null | undefined; }>; -export type GetOverviewDataQuery = { __typename?: 'Query', recentPatientsTotal: number, recentTasksTotal: number, recentPatients: Array<{ __typename?: 'PatientType', id: string, name: string, firstname: string, lastname: string, sex: Sex, birthdate: any, state: PatientState, updateDate?: any | null, position?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null, tasks: Array<{ __typename?: 'TaskType', id: string, done: boolean, updateDate?: any | null }>, properties: Array<{ __typename?: 'PropertyValueType', id: string, textValue?: string | null, numberValue?: number | null, booleanValue?: boolean | null, dateValue?: any | null, dateTimeValue?: any | null, selectValue?: string | null, multiSelectValues?: Array | null, userValue?: string | null, definition: { __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user?: { __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean } | null, team?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null }> }>, recentTasks: Array<{ __typename?: 'TaskType', id: string, title: string, description?: string | null, done: boolean, dueDate?: any | null, creationDate: any, updateDate?: any | null, priority?: string | null, estimatedTime?: number | null, sourceTaskPresetId?: string | null, assignees: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }>, assigneeTeam?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null, patient?: { __typename?: 'PatientType', id: string, name: string, position?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null } | null, properties: Array<{ __typename?: 'PropertyValueType', id: string, textValue?: string | null, numberValue?: number | null, booleanValue?: boolean | null, dateValue?: any | null, dateTimeValue?: any | null, selectValue?: string | null, multiSelectValues?: Array | null, userValue?: string | null, definition: { __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user?: { __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean } | null, team?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null }> }> }; +export type GetOverviewDataQuery = { recentPatientsTotal: number, recentTasksTotal: number, recentPatients: Array<{ id: string, name: string, firstname: string, lastname: string, sex: Types.Sex, birthdate: any, state: Types.PatientState, updateDate: any, position: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string } | null } | null, tasks: Array<{ id: string, done: boolean, updateDate: any }>, properties: Array<{ id: string, textValue: string | null, numberValue: number | null, booleanValue: boolean | null, dateValue: any, dateTimeValue: any, selectValue: string | null, multiSelectValues: Array | null, userValue: string | null, definition: { id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user: { id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean } | null, team: { id: string, title: string, kind: Types.LocationType } | null }> }>, recentTasks: Array<{ id: string, title: string, description: string | null, done: boolean, dueDate: any, creationDate: any, updateDate: any, priority: string | null, estimatedTime: number | null, sourceTaskPresetId: string | null, assignees: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }>, assigneeTeam: { id: string, title: string, kind: Types.LocationType } | null, patient: { id: string, name: string, position: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string } | null } | null } | null, properties: Array<{ id: string, textValue: string | null, numberValue: number | null, booleanValue: boolean | null, dateValue: any, dateTimeValue: any, selectValue: string | null, multiSelectValues: Array | null, userValue: string | null, definition: { id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user: { id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean } | null, team: { id: string, title: string, kind: Types.LocationType } | null }> }> }; export type GetPatientQueryVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type GetPatientQuery = { __typename?: 'Query', patient?: { __typename?: 'PatientType', id: string, name: string, firstname: string, lastname: string, birthdate: any, sex: Sex, state: PatientState, description?: string | null, updateDate?: any | null, checksum: string, assignedLocation?: { __typename?: 'LocationNodeType', id: string, title: string } | null, assignedLocations: Array<{ __typename?: 'LocationNodeType', id: string, title: string }>, clinic: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null } | null } | null }, position?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null } | null } | null } | null, teams: Array<{ __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null } | null } | null }>, tasks: Array<{ __typename?: 'TaskType', id: string, title: string, description?: string | null, done: boolean, dueDate?: any | null, priority?: string | null, estimatedTime?: number | null, updateDate?: any | null, sourceTaskPresetId?: string | null, assignees: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }>, assigneeTeam?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null }>, properties: Array<{ __typename?: 'PropertyValueType', id: string, textValue?: string | null, numberValue?: number | null, booleanValue?: boolean | null, dateValue?: any | null, dateTimeValue?: any | null, selectValue?: string | null, multiSelectValues?: Array | null, userValue?: string | null, definition: { __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user?: { __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean } | null, team?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null }> } | null }; +export type GetPatientQuery = { patient: { id: string, name: string, firstname: string, lastname: string, birthdate: any, sex: Types.Sex, state: Types.PatientState, description: string | null, updateDate: any, checksum: string, assignedLocation: { id: string, title: string } | null, assignedLocations: Array<{ id: string, title: string }>, clinic: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string } | null } | null } | null } | null }, position: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string } | null } | null } | null } | null } | null, teams: Array<{ id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string } | null } | null } | null } | null }>, tasks: Array<{ id: string, title: string, description: string | null, done: boolean, dueDate: any, priority: string | null, estimatedTime: number | null, updateDate: any, sourceTaskPresetId: string | null, assignees: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }>, assigneeTeam: { id: string, title: string, kind: Types.LocationType } | null }>, properties: Array<{ id: string, textValue: string | null, numberValue: number | null, booleanValue: boolean | null, dateValue: any, dateTimeValue: any, selectValue: string | null, multiSelectValues: Array | null, userValue: string | null, definition: { id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user: { id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean } | null, team: { id: string, title: string, kind: Types.LocationType } | null }> } | null }; export type GetPatientsQueryVariables = Exact<{ - locationId?: InputMaybe; - rootLocationIds?: InputMaybe | Scalars['ID']['input']>; - states?: InputMaybe | PatientState>; - filters?: InputMaybe | QueryFilterClauseInput>; - sorts?: InputMaybe | QuerySortClauseInput>; - pagination?: InputMaybe; - search?: InputMaybe; + locationId?: string | null | undefined; + rootLocationIds?: Array | string | null | undefined; + states?: Array | Types.PatientState | null | undefined; + filters?: Array | Types.QueryFilterClauseInput | null | undefined; + sorts?: Array | Types.QuerySortClauseInput | null | undefined; + pagination?: Types.PaginationInput | null | undefined; + search?: Types.QuerySearchInput | null | undefined; }>; -export type GetPatientsQuery = { __typename?: 'Query', patientsTotal: number, patients: Array<{ __typename?: 'PatientType', id: string, name: string, firstname: string, lastname: string, birthdate: any, sex: Sex, state: PatientState, updateDate?: any | null, stateUpdateDate?: any | null, clinicUpdateDate?: any | null, positionUpdateDate?: any | null, assignedLocation?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null, assignedLocations: Array<{ __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null } | null }>, clinic: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null } | null } | null }, position?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null } | null } | null } | null } | null, teams: Array<{ __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null } | null } | null }>, tasks: Array<{ __typename?: 'TaskType', id: string, title: string, description?: string | null, done: boolean, dueDate?: any | null, priority?: string | null, estimatedTime?: number | null, creationDate: any, updateDate?: any | null, sourceTaskPresetId?: string | null, assignees: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }>, assigneeTeam?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null }>, properties: Array<{ __typename?: 'PropertyValueType', id: string, textValue?: string | null, numberValue?: number | null, booleanValue?: boolean | null, dateValue?: any | null, dateTimeValue?: any | null, selectValue?: string | null, multiSelectValues?: Array | null, userValue?: string | null, definition: { __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user?: { __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean } | null, team?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null }> }> }; +export type GetPatientsQuery = { patientsTotal: number, patients: Array<{ id: string, name: string, firstname: string, lastname: string, birthdate: any, sex: Types.Sex, state: Types.PatientState, updateDate: any, stateUpdateDate: any, clinicUpdateDate: any, positionUpdateDate: any, assignedLocation: { id: string, title: string, parent: { id: string, title: string } | null } | null, assignedLocations: Array<{ id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string } | null } | null } | null }>, clinic: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string } | null } | null } | null } | null }, position: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null } | null } | null, teams: Array<{ id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string } | null } | null } | null } | null }>, tasks: Array<{ id: string, title: string, description: string | null, done: boolean, dueDate: any, priority: string | null, estimatedTime: number | null, creationDate: any, updateDate: any, sourceTaskPresetId: string | null, assignees: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }>, assigneeTeam: { id: string, title: string, kind: Types.LocationType } | null }>, properties: Array<{ id: string, textValue: string | null, numberValue: number | null, booleanValue: boolean | null, dateValue: any, dateTimeValue: any, selectValue: string | null, multiSelectValues: Array | null, userValue: string | null, definition: { id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user: { id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean } | null, team: { id: string, title: string, kind: Types.LocationType } | null }> }> }; export type GetTaskQueryVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type GetTaskQuery = { __typename?: 'Query', task?: { __typename?: 'TaskType', id: string, title: string, description?: string | null, done: boolean, dueDate?: any | null, priority?: string | null, estimatedTime?: number | null, checksum: string, updateDate?: any | null, sourceTaskPresetId?: string | null, patient?: { __typename?: 'PatientType', id: string, name: string } | null, assignees: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }>, assigneeTeam?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null, properties: Array<{ __typename?: 'PropertyValueType', id: string, textValue?: string | null, numberValue?: number | null, booleanValue?: boolean | null, dateValue?: any | null, dateTimeValue?: any | null, selectValue?: string | null, multiSelectValues?: Array | null, userValue?: string | null, definition: { __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user?: { __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean } | null, team?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null }> } | null }; +export type GetTaskQuery = { task: { id: string, title: string, description: string | null, done: boolean, dueDate: any, priority: string | null, estimatedTime: number | null, checksum: string, updateDate: any, sourceTaskPresetId: string | null, patient: { id: string, name: string } | null, assignees: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }>, assigneeTeam: { id: string, title: string, kind: Types.LocationType } | null, properties: Array<{ id: string, textValue: string | null, numberValue: number | null, booleanValue: boolean | null, dateValue: any, dateTimeValue: any, selectValue: string | null, multiSelectValues: Array | null, userValue: string | null, definition: { id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user: { id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean } | null, team: { id: string, title: string, kind: Types.LocationType } | null }> } | null }; export type GetTasksQueryVariables = Exact<{ - rootLocationIds?: InputMaybe | Scalars['ID']['input']>; - assigneeId?: InputMaybe; - assigneeTeamId?: InputMaybe; - filters?: InputMaybe | QueryFilterClauseInput>; - sorts?: InputMaybe | QuerySortClauseInput>; - pagination?: InputMaybe; - search?: InputMaybe; + rootLocationIds?: Array | string | null | undefined; + assigneeId?: string | null | undefined; + assigneeTeamId?: string | null | undefined; + filters?: Array | Types.QueryFilterClauseInput | null | undefined; + sorts?: Array | Types.QuerySortClauseInput | null | undefined; + pagination?: Types.PaginationInput | null | undefined; + search?: Types.QuerySearchInput | null | undefined; }>; -export type GetTasksQuery = { __typename?: 'Query', tasksTotal: number, tasks: Array<{ __typename?: 'TaskType', id: string, title: string, description?: string | null, done: boolean, dueDate?: any | null, priority?: string | null, estimatedTime?: number | null, creationDate: any, updateDate?: any | null, sourceTaskPresetId?: string | null, patient?: { __typename?: 'PatientType', id: string, name: string, firstname: string, lastname: string, birthdate: any, sex: Sex, state: PatientState, assignedLocation?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null, assignedLocations: Array<{ __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null } | null }>, clinic: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null } | null } | null }, position?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null } | null } | null } | null, teams: Array<{ __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string, parent?: { __typename?: 'LocationNodeType', id: string, title: string } | null } | null } | null } | null }>, properties: Array<{ __typename?: 'PropertyValueType', id: string, textValue?: string | null, numberValue?: number | null, booleanValue?: boolean | null, dateValue?: any | null, dateTimeValue?: any | null, selectValue?: string | null, multiSelectValues?: Array | null, userValue?: string | null, definition: { __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user?: { __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean } | null, team?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null }> } | null, assignees: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }>, assigneeTeam?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null, properties: Array<{ __typename?: 'PropertyValueType', id: string, textValue?: string | null, numberValue?: number | null, booleanValue?: boolean | null, dateValue?: any | null, dateTimeValue?: any | null, selectValue?: string | null, multiSelectValues?: Array | null, userValue?: string | null, definition: { __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user?: { __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean } | null, team?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null }> }> }; +export type GetTasksQuery = { tasksTotal: number, tasks: Array<{ id: string, title: string, description: string | null, done: boolean, dueDate: any, priority: string | null, estimatedTime: number | null, creationDate: any, updateDate: any, sourceTaskPresetId: string | null, patient: { id: string, name: string, firstname: string, lastname: string, birthdate: any, sex: Types.Sex, state: Types.PatientState, assignedLocation: { id: string, title: string, parent: { id: string, title: string } | null } | null, assignedLocations: Array<{ id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string } | null } | null } | null }>, clinic: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string } | null } | null } | null } | null }, position: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null } | null, teams: Array<{ id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string, parent: { id: string, title: string } | null } | null } | null } | null }>, properties: Array<{ id: string, textValue: string | null, numberValue: number | null, booleanValue: boolean | null, dateValue: any, dateTimeValue: any, selectValue: string | null, multiSelectValues: Array | null, userValue: string | null, definition: { id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user: { id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean } | null, team: { id: string, title: string, kind: Types.LocationType } | null }> } | null, assignees: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }>, assigneeTeam: { id: string, title: string, kind: Types.LocationType } | null, properties: Array<{ id: string, textValue: string | null, numberValue: number | null, booleanValue: boolean | null, dateValue: any, dateTimeValue: any, selectValue: string | null, multiSelectValues: Array | null, userValue: string | null, definition: { id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user: { id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean } | null, team: { id: string, title: string, kind: Types.LocationType } | null }> }> }; export type GetUserQueryVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type GetUserQuery = { __typename?: 'Query', user?: { __typename?: 'UserType', id: string, username: string, name: string, email?: string | null, firstname?: string | null, lastname?: string | null, title?: string | null, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean } | null }; +export type GetUserQuery = { user: { id: string, username: string, name: string, email: string | null, firstname: string | null, lastname: string | null, title: string | null, avatarUrl: string | null, lastOnline: any, isOnline: boolean } | null }; export type GetUsersQueryVariables = Exact<{ [key: string]: never; }>; -export type GetUsersQuery = { __typename?: 'Query', users: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }> }; +export type GetUsersQuery = { users: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }> }; export type GetGlobalDataQueryVariables = Exact<{ - rootLocationIds?: InputMaybe | Scalars['ID']['input']>; + rootLocationIds?: Array | string | null | undefined; }>; -export type GetGlobalDataQuery = { __typename?: 'Query', me?: { __typename?: 'UserType', id: string, username: string, name: string, firstname?: string | null, lastname?: string | null, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean, organizations?: string | null, rootLocations: Array<{ __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType }>, tasks: Array<{ __typename?: 'TaskType', id: string, done: boolean }> } | null, wards: Array<{ __typename?: 'LocationNodeType', id: string, title: string, parentId?: string | null }>, teams: Array<{ __typename?: 'LocationNodeType', id: string, title: string, parentId?: string | null }>, clinics: Array<{ __typename?: 'LocationNodeType', id: string, title: string, parentId?: string | null }>, scopedPatientCounts: { __typename?: 'ScopedPatientCounts', scopedPatientsTotal: number, scopedPatientsWaiting: number, scopedPatientsAdmitted: number, scopedPatientsDischarged: number, scopedPatientsDeceased: number } }; +export type GetGlobalDataQuery = { me: { id: string, username: string, name: string, firstname: string | null, lastname: string | null, avatarUrl: string | null, lastOnline: any, isOnline: boolean, organizations: string | null, rootLocations: Array<{ id: string, title: string, kind: Types.LocationType }>, tasks: Array<{ id: string, done: boolean }> } | null, wards: Array<{ id: string, title: string, parentId: string | null }>, teams: Array<{ id: string, title: string, parentId: string | null }>, clinics: Array<{ id: string, title: string, parentId: string | null }>, scopedPatientCounts: { scopedPatientsTotal: number, scopedPatientsWaiting: number, scopedPatientsAdmitted: number, scopedPatientsDischarged: number, scopedPatientsDeceased: number } }; export type CreatePatientMutationVariables = Exact<{ - data: CreatePatientInput; + data: Types.CreatePatientInput; }>; -export type CreatePatientMutation = { __typename?: 'Mutation', createPatient: { __typename?: 'PatientType', id: string, name: string, firstname: string, lastname: string, birthdate: any, sex: Sex, state: PatientState, assignedLocation?: { __typename?: 'LocationNodeType', id: string, title: string } | null, assignedLocations: Array<{ __typename?: 'LocationNodeType', id: string, title: string }>, clinic: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType }, position?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null, teams: Array<{ __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType }> } }; +export type CreatePatientMutation = { createPatient: { id: string, name: string, firstname: string, lastname: string, birthdate: any, sex: Types.Sex, state: Types.PatientState, assignedLocation: { id: string, title: string } | null, assignedLocations: Array<{ id: string, title: string }>, clinic: { id: string, title: string, kind: Types.LocationType }, position: { id: string, title: string, kind: Types.LocationType } | null, teams: Array<{ id: string, title: string, kind: Types.LocationType }> } }; export type UpdatePatientMutationVariables = Exact<{ - id: Scalars['ID']['input']; - data: UpdatePatientInput; + id: string; + data: Types.UpdatePatientInput; }>; -export type UpdatePatientMutation = { __typename?: 'Mutation', updatePatient: { __typename?: 'PatientType', id: string, name: string, firstname: string, lastname: string, birthdate: any, sex: Sex, state: PatientState, description?: string | null, checksum: string, assignedLocation?: { __typename?: 'LocationNodeType', id: string, title: string } | null, assignedLocations: Array<{ __typename?: 'LocationNodeType', id: string, title: string }>, clinic: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType }, position?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null, teams: Array<{ __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType }>, properties: Array<{ __typename?: 'PropertyValueType', id: string, textValue?: string | null, numberValue?: number | null, booleanValue?: boolean | null, dateValue?: any | null, dateTimeValue?: any | null, selectValue?: string | null, multiSelectValues?: Array | null, userValue?: string | null, definition: { __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user?: { __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean } | null, team?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null }> } }; +export type UpdatePatientMutation = { updatePatient: { id: string, name: string, firstname: string, lastname: string, birthdate: any, sex: Types.Sex, state: Types.PatientState, description: string | null, checksum: string, assignedLocation: { id: string, title: string } | null, assignedLocations: Array<{ id: string, title: string }>, clinic: { id: string, title: string, kind: Types.LocationType }, position: { id: string, title: string, kind: Types.LocationType } | null, teams: Array<{ id: string, title: string, kind: Types.LocationType }>, properties: Array<{ id: string, textValue: string | null, numberValue: number | null, booleanValue: boolean | null, dateValue: any, dateTimeValue: any, selectValue: string | null, multiSelectValues: Array | null, userValue: string | null, definition: { id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user: { id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean } | null, team: { id: string, title: string, kind: Types.LocationType } | null }> } }; export type ClearPatientPropertyMutationVariables = Exact<{ - propertyDefinitionId: Scalars['ID']['input']; - patientIds: Array | Scalars['ID']['input']; + propertyDefinitionId: string; + patientIds: Array | string; }>; -export type ClearPatientPropertyMutation = { __typename?: 'Mutation', clearPatientProperty: number }; +export type ClearPatientPropertyMutation = { clearPatientProperty: number }; export type AdmitPatientMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type AdmitPatientMutation = { __typename?: 'Mutation', admitPatient: { __typename?: 'PatientType', id: string, state: PatientState } }; +export type AdmitPatientMutation = { admitPatient: { id: string, state: Types.PatientState } }; export type DischargePatientMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type DischargePatientMutation = { __typename?: 'Mutation', dischargePatient: { __typename?: 'PatientType', id: string, state: PatientState } }; +export type DischargePatientMutation = { dischargePatient: { id: string, state: Types.PatientState } }; export type MarkPatientDeadMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type MarkPatientDeadMutation = { __typename?: 'Mutation', markPatientDead: { __typename?: 'PatientType', id: string, state: PatientState } }; +export type MarkPatientDeadMutation = { markPatientDead: { id: string, state: Types.PatientState } }; export type WaitPatientMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type WaitPatientMutation = { __typename?: 'Mutation', waitPatient: { __typename?: 'PatientType', id: string, state: PatientState } }; +export type WaitPatientMutation = { waitPatient: { id: string, state: Types.PatientState } }; export type DeletePatientMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type DeletePatientMutation = { __typename?: 'Mutation', deletePatient: boolean }; +export type DeletePatientMutation = { deletePatient: boolean }; export type CreatePropertyDefinitionMutationVariables = Exact<{ - data: CreatePropertyDefinitionInput; + data: Types.CreatePropertyDefinitionInput; }>; -export type CreatePropertyDefinitionMutation = { __typename?: 'Mutation', createPropertyDefinition: { __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array } }; +export type CreatePropertyDefinitionMutation = { createPropertyDefinition: { id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array, visibility: Types.ScopeVisibility, ownerUserId: string | null, canEdit: boolean, locationId: string | null, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null } }; export type UpdatePropertyDefinitionMutationVariables = Exact<{ - id: Scalars['ID']['input']; - data: UpdatePropertyDefinitionInput; + id: string; + data: Types.UpdatePropertyDefinitionInput; }>; -export type UpdatePropertyDefinitionMutation = { __typename?: 'Mutation', updatePropertyDefinition: { __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array } }; +export type UpdatePropertyDefinitionMutation = { updatePropertyDefinition: { id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array, visibility: Types.ScopeVisibility, ownerUserId: string | null, canEdit: boolean, locationId: string | null, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null } }; export type DeletePropertyDefinitionMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type DeletePropertyDefinitionMutation = { __typename?: 'Mutation', deletePropertyDefinition: boolean }; +export type DeletePropertyDefinitionMutation = { deletePropertyDefinition: boolean }; -export type GetPropertyDefinitionsQueryVariables = Exact<{ [key: string]: never; }>; +export type GetPropertyDefinitionsQueryVariables = Exact<{ + rootLocationIds?: Array | string | null | undefined; +}>; -export type GetPropertyDefinitionsQuery = { __typename?: 'Query', propertyDefinitions: Array<{ __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array }> }; +export type GetPropertyDefinitionsQuery = { propertyDefinitions: Array<{ id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array, visibility: Types.ScopeVisibility, ownerUserId: string | null, canEdit: boolean, locationId: string | null, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null }> }; export type GetPropertiesForSubjectQueryVariables = Exact<{ - subjectId: Scalars['ID']['input']; - subjectType: PropertyEntity; + subjectId: string; + subjectType: Types.PropertyEntity; + rootLocationIds?: Array | string | null | undefined; }>; -export type GetPropertiesForSubjectQuery = { __typename?: 'Query', propertyDefinitions: Array<{ __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array }> }; +export type GetPropertiesForSubjectQuery = { propertyDefinitions: Array<{ id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array, visibility: Types.ScopeVisibility, ownerUserId: string | null, canEdit: boolean, locationId: string | null, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null }> }; export type QueryableFieldsQueryVariables = Exact<{ - entity: Scalars['String']['input']; + entity: string; }>; -export type QueryableFieldsQuery = { __typename?: 'Query', queryableFields: Array<{ __typename?: 'QueryableField', key: string, label: string, kind: QueryableFieldKind, valueType: QueryableValueType, allowedOperators: Array, sortable: boolean, sortDirections: Array, searchable: boolean, filterable: boolean, propertyDefinitionId?: string | null, relation?: { __typename?: 'QueryableRelationMeta', targetEntity: string, idFieldKey: string, labelFieldKey: string, allowedFilterModes: Array } | null, choice?: { __typename?: 'QueryableChoiceMeta', optionKeys: Array, optionLabels: Array } | null }> }; +export type QueryableFieldsQuery = { queryableFields: Array<{ key: string, label: string, kind: Types.QueryableFieldKind, valueType: Types.QueryableValueType, allowedOperators: Array, sortable: boolean, sortDirections: Array, searchable: boolean, filterable: boolean, propertyDefinitionId: string | null, relation: { targetEntity: string, idFieldKey: string, labelFieldKey: string, allowedFilterModes: Array } | null, choice: { optionKeys: Array, optionLabels: Array } | null }> }; -export type MySavedViewsQueryVariables = Exact<{ [key: string]: never; }>; +export type MySavedViewsQueryVariables = Exact<{ + rootLocationIds?: Array | string | null | undefined; +}>; -export type MySavedViewsQuery = { __typename?: 'Query', mySavedViews: Array<{ __typename?: 'SavedView', id: string, name: string, baseEntityType: SavedViewEntityType, filterDefinition: string, sortDefinition: string, parameters: string, relatedFilterDefinition: string, relatedSortDefinition: string, relatedParameters: string, ownerUserId: string, visibility: SavedViewVisibility, createdAt: string, updatedAt: string, isOwner: boolean }> }; +export type MySavedViewsQuery = { mySavedViews: Array<{ id: string, name: string, baseEntityType: Types.SavedViewEntityType, filterDefinition: string, sortDefinition: string, parameters: string, relatedFilterDefinition: string, relatedSortDefinition: string, relatedParameters: string, ownerUserId: string, visibility: Types.ScopeVisibility, locationId: string | null, createdAt: string, updatedAt: string, isOwner: boolean, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null }> }; export type SavedViewQueryVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type SavedViewQuery = { __typename?: 'Query', savedView?: { __typename?: 'SavedView', id: string, name: string, baseEntityType: SavedViewEntityType, filterDefinition: string, sortDefinition: string, parameters: string, relatedFilterDefinition: string, relatedSortDefinition: string, relatedParameters: string, ownerUserId: string, visibility: SavedViewVisibility, createdAt: string, updatedAt: string, isOwner: boolean } | null }; +export type SavedViewQuery = { savedView: { id: string, name: string, baseEntityType: Types.SavedViewEntityType, filterDefinition: string, sortDefinition: string, parameters: string, relatedFilterDefinition: string, relatedSortDefinition: string, relatedParameters: string, ownerUserId: string, visibility: Types.ScopeVisibility, locationId: string | null, createdAt: string, updatedAt: string, isOwner: boolean, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null } | null }; export type CreateSavedViewMutationVariables = Exact<{ - data: CreateSavedViewInput; + data: Types.CreateSavedViewInput; }>; -export type CreateSavedViewMutation = { __typename?: 'Mutation', createSavedView: { __typename?: 'SavedView', id: string, name: string, baseEntityType: SavedViewEntityType, filterDefinition: string, sortDefinition: string, parameters: string, relatedFilterDefinition: string, relatedSortDefinition: string, relatedParameters: string, ownerUserId: string, visibility: SavedViewVisibility, createdAt: string, updatedAt: string, isOwner: boolean } }; +export type CreateSavedViewMutation = { createSavedView: { id: string, name: string, baseEntityType: Types.SavedViewEntityType, filterDefinition: string, sortDefinition: string, parameters: string, relatedFilterDefinition: string, relatedSortDefinition: string, relatedParameters: string, ownerUserId: string, visibility: Types.ScopeVisibility, locationId: string | null, createdAt: string, updatedAt: string, isOwner: boolean, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null } }; export type UpdateSavedViewMutationVariables = Exact<{ - id: Scalars['ID']['input']; - data: UpdateSavedViewInput; + id: string; + data: Types.UpdateSavedViewInput; }>; -export type UpdateSavedViewMutation = { __typename?: 'Mutation', updateSavedView: { __typename?: 'SavedView', id: string, name: string, baseEntityType: SavedViewEntityType, filterDefinition: string, sortDefinition: string, parameters: string, relatedFilterDefinition: string, relatedSortDefinition: string, relatedParameters: string, ownerUserId: string, visibility: SavedViewVisibility, createdAt: string, updatedAt: string, isOwner: boolean } }; +export type UpdateSavedViewMutation = { updateSavedView: { id: string, name: string, baseEntityType: Types.SavedViewEntityType, filterDefinition: string, sortDefinition: string, parameters: string, relatedFilterDefinition: string, relatedSortDefinition: string, relatedParameters: string, ownerUserId: string, visibility: Types.ScopeVisibility, locationId: string | null, createdAt: string, updatedAt: string, isOwner: boolean, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null } }; export type DeleteSavedViewMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type DeleteSavedViewMutation = { __typename?: 'Mutation', deleteSavedView: boolean }; +export type DeleteSavedViewMutation = { deleteSavedView: boolean }; export type DuplicateSavedViewMutationVariables = Exact<{ - id: Scalars['ID']['input']; - name: Scalars['String']['input']; + id: string; + name: string; }>; -export type DuplicateSavedViewMutation = { __typename?: 'Mutation', duplicateSavedView: { __typename?: 'SavedView', id: string, name: string, baseEntityType: SavedViewEntityType, filterDefinition: string, sortDefinition: string, parameters: string, relatedFilterDefinition: string, relatedSortDefinition: string, relatedParameters: string, ownerUserId: string, visibility: SavedViewVisibility, createdAt: string, updatedAt: string, isOwner: boolean } }; +export type DuplicateSavedViewMutation = { duplicateSavedView: { id: string, name: string, baseEntityType: Types.SavedViewEntityType, filterDefinition: string, sortDefinition: string, parameters: string, relatedFilterDefinition: string, relatedSortDefinition: string, relatedParameters: string, ownerUserId: string, visibility: Types.ScopeVisibility, locationId: string | null, createdAt: string, updatedAt: string, isOwner: boolean, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null } }; export type PatientCreatedSubscriptionVariables = Exact<{ - rootLocationIds?: InputMaybe | Scalars['ID']['input']>; + rootLocationIds?: Array | string | null | undefined; }>; -export type PatientCreatedSubscription = { __typename?: 'Subscription', patientCreated: string }; +export type PatientCreatedSubscription = { patientCreated: string }; export type PatientUpdatedSubscriptionVariables = Exact<{ - patientId?: InputMaybe; - rootLocationIds?: InputMaybe | Scalars['ID']['input']>; + patientId?: string | null | undefined; + rootLocationIds?: Array | string | null | undefined; }>; -export type PatientUpdatedSubscription = { __typename?: 'Subscription', patientUpdated: string }; +export type PatientUpdatedSubscription = { patientUpdated: string }; export type PatientStateChangedSubscriptionVariables = Exact<{ - patientId?: InputMaybe; - rootLocationIds?: InputMaybe | Scalars['ID']['input']>; + patientId?: string | null | undefined; + rootLocationIds?: Array | string | null | undefined; }>; -export type PatientStateChangedSubscription = { __typename?: 'Subscription', patientStateChanged: string }; +export type PatientStateChangedSubscription = { patientStateChanged: string }; export type TaskCreatedSubscriptionVariables = Exact<{ - rootLocationIds?: InputMaybe | Scalars['ID']['input']>; + rootLocationIds?: Array | string | null | undefined; }>; -export type TaskCreatedSubscription = { __typename?: 'Subscription', taskCreated: string }; +export type TaskCreatedSubscription = { taskCreated: string }; export type TaskUpdatedSubscriptionVariables = Exact<{ - taskId?: InputMaybe; - rootLocationIds?: InputMaybe | Scalars['ID']['input']>; + taskId?: string | null | undefined; + rootLocationIds?: Array | string | null | undefined; }>; -export type TaskUpdatedSubscription = { __typename?: 'Subscription', taskUpdated: string }; +export type TaskUpdatedSubscription = { taskUpdated: string }; export type TaskDeletedSubscriptionVariables = Exact<{ - rootLocationIds?: InputMaybe | Scalars['ID']['input']>; + rootLocationIds?: Array | string | null | undefined; }>; -export type TaskDeletedSubscription = { __typename?: 'Subscription', taskDeleted: string }; +export type TaskDeletedSubscription = { taskDeleted: string }; export type LocationNodeUpdatedSubscriptionVariables = Exact<{ - locationId?: InputMaybe; + locationId?: string | null | undefined; }>; -export type LocationNodeUpdatedSubscription = { __typename?: 'Subscription', locationNodeUpdated: string }; +export type LocationNodeUpdatedSubscription = { locationNodeUpdated: string }; export type LocationNodeCreatedSubscriptionVariables = Exact<{ [key: string]: never; }>; -export type LocationNodeCreatedSubscription = { __typename?: 'Subscription', locationNodeCreated: string }; +export type LocationNodeCreatedSubscription = { locationNodeCreated: string }; export type LocationNodeDeletedSubscriptionVariables = Exact<{ [key: string]: never; }>; -export type LocationNodeDeletedSubscription = { __typename?: 'Subscription', locationNodeDeleted: string }; +export type LocationNodeDeletedSubscription = { locationNodeDeleted: string }; export type CreateTaskMutationVariables = Exact<{ - data: CreateTaskInput; + data: Types.CreateTaskInput; }>; -export type CreateTaskMutation = { __typename?: 'Mutation', createTask: { __typename?: 'TaskType', id: string, title: string, description?: string | null, done: boolean, dueDate?: any | null, updateDate?: any | null, assignees: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }>, patient?: { __typename?: 'PatientType', id: string, name: string } | null } }; +export type CreateTaskMutation = { createTask: { id: string, title: string, description: string | null, done: boolean, dueDate: any, updateDate: any, assignees: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }>, patient: { id: string, name: string } | null } }; export type UpdateTaskMutationVariables = Exact<{ - id: Scalars['ID']['input']; - data: UpdateTaskInput; + id: string; + data: Types.UpdateTaskInput; }>; -export type UpdateTaskMutation = { __typename?: 'Mutation', updateTask: { __typename?: 'TaskType', id: string, title: string, description?: string | null, done: boolean, dueDate?: any | null, priority?: string | null, estimatedTime?: number | null, updateDate?: any | null, checksum: string, patient?: { __typename?: 'PatientType', id: string, name: string } | null, assignees: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }>, properties: Array<{ __typename?: 'PropertyValueType', id: string, textValue?: string | null, numberValue?: number | null, booleanValue?: boolean | null, dateValue?: any | null, dateTimeValue?: any | null, selectValue?: string | null, multiSelectValues?: Array | null, userValue?: string | null, definition: { __typename?: 'PropertyDefinitionType', id: string, name: string, description?: string | null, fieldType: FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user?: { __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean } | null, team?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null }> } }; +export type UpdateTaskMutation = { updateTask: { id: string, title: string, description: string | null, done: boolean, dueDate: any, priority: string | null, estimatedTime: number | null, updateDate: any, checksum: string, patient: { id: string, name: string } | null, assignees: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }>, properties: Array<{ id: string, textValue: string | null, numberValue: number | null, booleanValue: boolean | null, dateValue: any, dateTimeValue: any, selectValue: string | null, multiSelectValues: Array | null, userValue: string | null, definition: { id: string, name: string, description: string | null, fieldType: Types.FieldType, isActive: boolean, allowedEntities: Array, options: Array }, user: { id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean } | null, team: { id: string, title: string, kind: Types.LocationType } | null }> } }; export type ClearTaskPropertyMutationVariables = Exact<{ - propertyDefinitionId: Scalars['ID']['input']; - taskIds: Array | Scalars['ID']['input']; + propertyDefinitionId: string; + taskIds: Array | string; }>; -export type ClearTaskPropertyMutation = { __typename?: 'Mutation', clearTaskProperty: number }; +export type ClearTaskPropertyMutation = { clearTaskProperty: number }; export type AddTaskAssigneeMutationVariables = Exact<{ - id: Scalars['ID']['input']; - userId: Scalars['ID']['input']; + id: string; + userId: string; }>; -export type AddTaskAssigneeMutation = { __typename?: 'Mutation', addTaskAssignee: { __typename?: 'TaskType', id: string, assignees: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }> } }; +export type AddTaskAssigneeMutation = { addTaskAssignee: { id: string, assignees: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }> } }; export type RemoveTaskAssigneeMutationVariables = Exact<{ - id: Scalars['ID']['input']; - userId: Scalars['ID']['input']; + id: string; + userId: string; }>; -export type RemoveTaskAssigneeMutation = { __typename?: 'Mutation', removeTaskAssignee: { __typename?: 'TaskType', id: string, assignees: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }> } }; +export type RemoveTaskAssigneeMutation = { removeTaskAssignee: { id: string, assignees: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }> } }; export type DeleteTaskMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type DeleteTaskMutation = { __typename?: 'Mutation', deleteTask: boolean }; +export type DeleteTaskMutation = { deleteTask: boolean }; export type CompleteTaskMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type CompleteTaskMutation = { __typename?: 'Mutation', completeTask: { __typename?: 'TaskType', id: string, done: boolean, updateDate?: any | null } }; +export type CompleteTaskMutation = { completeTask: { id: string, done: boolean, updateDate: any } }; export type ReopenTaskMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type ReopenTaskMutation = { __typename?: 'Mutation', reopenTask: { __typename?: 'TaskType', id: string, done: boolean, updateDate?: any | null } }; +export type ReopenTaskMutation = { reopenTask: { id: string, done: boolean, updateDate: any } }; export type AssignTaskToTeamMutationVariables = Exact<{ - id: Scalars['ID']['input']; - teamId: Scalars['ID']['input']; + id: string; + teamId: string; }>; -export type AssignTaskToTeamMutation = { __typename?: 'Mutation', assignTaskToTeam: { __typename?: 'TaskType', id: string, assigneeTeam?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null } }; +export type AssignTaskToTeamMutation = { assignTaskToTeam: { id: string, assigneeTeam: { id: string, title: string, kind: Types.LocationType } | null } }; export type UnassignTaskFromTeamMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type UnassignTaskFromTeamMutation = { __typename?: 'Mutation', unassignTaskFromTeam: { __typename?: 'TaskType', id: string, assigneeTeam?: { __typename?: 'LocationNodeType', id: string, title: string, kind: LocationType } | null } }; +export type UnassignTaskFromTeamMutation = { unassignTaskFromTeam: { id: string, assigneeTeam: { id: string, title: string, kind: Types.LocationType } | null } }; export type ApplyTaskGraphMutationVariables = Exact<{ - data: ApplyTaskGraphInput; + data: Types.ApplyTaskGraphInput; }>; -export type ApplyTaskGraphMutation = { __typename?: 'Mutation', applyTaskGraph: Array<{ __typename?: 'TaskType', id: string, title: string, description?: string | null, done: boolean, dueDate?: any | null, updateDate?: any | null, sourceTaskPresetId?: string | null, assignees: Array<{ __typename?: 'UserType', id: string, name: string, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean }>, patient?: { __typename?: 'PatientType', id: string, name: string } | null }> }; +export type ApplyTaskGraphMutation = { applyTaskGraph: Array<{ id: string, title: string, description: string | null, done: boolean, dueDate: any, updateDate: any, sourceTaskPresetId: string | null, assignees: Array<{ id: string, name: string, avatarUrl: string | null, lastOnline: any, isOnline: boolean }>, patient: { id: string, name: string } | null }> }; export type CreateTaskPresetMutationVariables = Exact<{ - data: CreateTaskPresetInput; + data: Types.CreateTaskPresetInput; }>; -export type CreateTaskPresetMutation = { __typename?: 'Mutation', createTaskPreset: { __typename?: 'TaskPresetType', id: string, name: string, key: string, scope: string, ownerUserId?: string | null, graph: { __typename?: 'TaskGraphType', nodes: Array<{ __typename?: 'TaskGraphNodeType', id: string, title: string, description?: string | null, priority?: string | null, estimatedTime?: number | null }>, edges: Array<{ __typename?: 'TaskGraphEdgeType', fromId: string, toId: string }> } } }; +export type CreateTaskPresetMutation = { createTaskPreset: { id: string, name: string, key: string, visibility: Types.ScopeVisibility, ownerUserId: string | null, isOwner: boolean, locationId: string | null, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null, graph: { nodes: Array<{ id: string, title: string, description: string | null, priority: string | null, estimatedTime: number | null }>, edges: Array<{ fromId: string, toId: string }> } } }; export type UpdateTaskPresetMutationVariables = Exact<{ - id: Scalars['ID']['input']; - data: UpdateTaskPresetInput; + id: string; + data: Types.UpdateTaskPresetInput; }>; -export type UpdateTaskPresetMutation = { __typename?: 'Mutation', updateTaskPreset: { __typename?: 'TaskPresetType', id: string, name: string, key: string, scope: string, ownerUserId?: string | null, graph: { __typename?: 'TaskGraphType', nodes: Array<{ __typename?: 'TaskGraphNodeType', id: string, title: string, description?: string | null, priority?: string | null, estimatedTime?: number | null }>, edges: Array<{ __typename?: 'TaskGraphEdgeType', fromId: string, toId: string }> } } }; +export type UpdateTaskPresetMutation = { updateTaskPreset: { id: string, name: string, key: string, visibility: Types.ScopeVisibility, ownerUserId: string | null, isOwner: boolean, locationId: string | null, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null, graph: { nodes: Array<{ id: string, title: string, description: string | null, priority: string | null, estimatedTime: number | null }>, edges: Array<{ fromId: string, toId: string }> } } }; export type DeleteTaskPresetMutationVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type DeleteTaskPresetMutation = { __typename?: 'Mutation', deleteTaskPreset: boolean }; +export type DeleteTaskPresetMutation = { deleteTaskPreset: boolean }; -export type TaskPresetsQueryVariables = Exact<{ [key: string]: never; }>; +export type TaskPresetsQueryVariables = Exact<{ + rootLocationIds?: Array | string | null | undefined; +}>; -export type TaskPresetsQuery = { __typename?: 'Query', taskPresets: Array<{ __typename?: 'TaskPresetType', id: string, name: string, key: string, scope: string, ownerUserId?: string | null, graph: { __typename?: 'TaskGraphType', nodes: Array<{ __typename?: 'TaskGraphNodeType', id: string, title: string, description?: string | null, priority?: string | null, estimatedTime?: number | null }>, edges: Array<{ __typename?: 'TaskGraphEdgeType', fromId: string, toId: string }> } }> }; +export type TaskPresetsQuery = { taskPresets: Array<{ id: string, name: string, key: string, visibility: Types.ScopeVisibility, ownerUserId: string | null, isOwner: boolean, locationId: string | null, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null, graph: { nodes: Array<{ id: string, title: string, description: string | null, priority: string | null, estimatedTime: number | null }>, edges: Array<{ fromId: string, toId: string }> } }> }; export type TaskPresetQueryVariables = Exact<{ - id: Scalars['ID']['input']; + id: string; }>; -export type TaskPresetQuery = { __typename?: 'Query', taskPreset?: { __typename?: 'TaskPresetType', id: string, name: string, key: string, scope: string, ownerUserId?: string | null, graph: { __typename?: 'TaskGraphType', nodes: Array<{ __typename?: 'TaskGraphNodeType', id: string, title: string, description?: string | null, priority?: string | null, estimatedTime?: number | null }>, edges: Array<{ __typename?: 'TaskGraphEdgeType', fromId: string, toId: string }> } } | null }; +export type TaskPresetQuery = { taskPreset: { id: string, name: string, key: string, visibility: Types.ScopeVisibility, ownerUserId: string | null, isOwner: boolean, locationId: string | null, location: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType, parent: { id: string, title: string, kind: Types.LocationType } | null } | null } | null, graph: { nodes: Array<{ id: string, title: string, description: string | null, priority: string | null, estimatedTime: number | null }>, edges: Array<{ fromId: string, toId: string }> } } | null }; export type UpdateProfilePictureMutationVariables = Exact<{ - data: UpdateProfilePictureInput; + data: Types.UpdateProfilePictureInput; }>; -export type UpdateProfilePictureMutation = { __typename?: 'Mutation', updateProfilePicture: { __typename?: 'UserType', id: string, username: string, name: string, email?: string | null, firstname?: string | null, lastname?: string | null, title?: string | null, avatarUrl?: string | null, lastOnline?: any | null, isOnline: boolean } }; +export type UpdateProfilePictureMutation = { updateProfilePicture: { id: string, username: string, name: string, email: string | null, firstname: string | null, lastname: string | null, title: string | null, avatarUrl: string | null, lastOnline: any, isOnline: boolean } }; export const GetAuditLogsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAuditLogs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"caseId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"offset"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"auditLogs"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"caseId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"caseId"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"Variable","name":{"kind":"Name","value":"offset"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"caseId"}},{"kind":"Field","name":{"kind":"Name","value":"activity"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"timestamp"}},{"kind":"Field","name":{"kind":"Name","value":"context"}}]}}]}}]} as unknown as DocumentNode; @@ -1449,18 +464,18 @@ export const DischargePatientDocument = {"kind":"Document","definitions":[{"kind export const MarkPatientDeadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MarkPatientDead"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markPatientDead"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}}]}}]}}]} as unknown as DocumentNode; export const WaitPatientDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"WaitPatient"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"waitPatient"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}}]}}]}}]} as unknown as DocumentNode; export const DeletePatientDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeletePatient"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deletePatient"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}]}}]} as unknown as DocumentNode; -export const CreatePropertyDefinitionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreatePropertyDefinition"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreatePropertyDefinitionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createPropertyDefinition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"fieldType"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"allowedEntities"}},{"kind":"Field","name":{"kind":"Name","value":"options"}}]}}]}}]} as unknown as DocumentNode; -export const UpdatePropertyDefinitionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdatePropertyDefinition"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdatePropertyDefinitionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updatePropertyDefinition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"fieldType"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"allowedEntities"}},{"kind":"Field","name":{"kind":"Name","value":"options"}}]}}]}}]} as unknown as DocumentNode; +export const CreatePropertyDefinitionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreatePropertyDefinition"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreatePropertyDefinitionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createPropertyDefinition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"fieldType"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"allowedEntities"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"canEdit"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const UpdatePropertyDefinitionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdatePropertyDefinition"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdatePropertyDefinitionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updatePropertyDefinition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"fieldType"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"allowedEntities"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"canEdit"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const DeletePropertyDefinitionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeletePropertyDefinition"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deletePropertyDefinition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}]}}]} as unknown as DocumentNode; -export const GetPropertyDefinitionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPropertyDefinitions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"fieldType"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"allowedEntities"}},{"kind":"Field","name":{"kind":"Name","value":"options"}}]}}]}}]} as unknown as DocumentNode; -export const GetPropertiesForSubjectDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPropertiesForSubject"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"subjectId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"subjectType"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"PropertyEntity"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"fieldType"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"allowedEntities"}},{"kind":"Field","name":{"kind":"Name","value":"options"}}]}}]}}]} as unknown as DocumentNode; +export const GetPropertyDefinitionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPropertyDefinitions"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitions"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"rootLocationIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"fieldType"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"allowedEntities"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"canEdit"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetPropertiesForSubjectDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPropertiesForSubject"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"subjectId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"subjectType"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"PropertyEntity"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitions"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"rootLocationIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"fieldType"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"allowedEntities"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"canEdit"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const QueryableFieldsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"QueryableFields"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"entity"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"queryableFields"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"entity"},"value":{"kind":"Variable","name":{"kind":"Name","value":"entity"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"valueType"}},{"kind":"Field","name":{"kind":"Name","value":"allowedOperators"}},{"kind":"Field","name":{"kind":"Name","value":"sortable"}},{"kind":"Field","name":{"kind":"Name","value":"sortDirections"}},{"kind":"Field","name":{"kind":"Name","value":"searchable"}},{"kind":"Field","name":{"kind":"Name","value":"filterable"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"relation"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"targetEntity"}},{"kind":"Field","name":{"kind":"Name","value":"idFieldKey"}},{"kind":"Field","name":{"kind":"Name","value":"labelFieldKey"}},{"kind":"Field","name":{"kind":"Name","value":"allowedFilterModes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"choice"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionKeys"}},{"kind":"Field","name":{"kind":"Name","value":"optionLabels"}}]}}]}}]}}]} as unknown as DocumentNode; -export const MySavedViewsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MySavedViews"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"mySavedViews"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"baseEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"filterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"sortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"parameters"}},{"kind":"Field","name":{"kind":"Name","value":"relatedFilterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedSortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedParameters"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}}]}}]}}]} as unknown as DocumentNode; -export const SavedViewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SavedView"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"savedView"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"baseEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"filterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"sortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"parameters"}},{"kind":"Field","name":{"kind":"Name","value":"relatedFilterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedSortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedParameters"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}}]}}]}}]} as unknown as DocumentNode; -export const CreateSavedViewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateSavedView"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateSavedViewInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createSavedView"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"baseEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"filterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"sortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"parameters"}},{"kind":"Field","name":{"kind":"Name","value":"relatedFilterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedSortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedParameters"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}}]}}]}}]} as unknown as DocumentNode; -export const UpdateSavedViewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateSavedView"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateSavedViewInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateSavedView"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"baseEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"filterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"sortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"parameters"}},{"kind":"Field","name":{"kind":"Name","value":"relatedFilterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedSortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedParameters"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}}]}}]}}]} as unknown as DocumentNode; +export const MySavedViewsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MySavedViews"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"mySavedViews"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"rootLocationIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"baseEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"filterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"sortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"parameters"}},{"kind":"Field","name":{"kind":"Name","value":"relatedFilterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedSortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedParameters"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}}]}}]}}]} as unknown as DocumentNode; +export const SavedViewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SavedView"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"savedView"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"baseEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"filterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"sortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"parameters"}},{"kind":"Field","name":{"kind":"Name","value":"relatedFilterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedSortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedParameters"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}}]}}]}}]} as unknown as DocumentNode; +export const CreateSavedViewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateSavedView"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateSavedViewInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createSavedView"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"baseEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"filterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"sortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"parameters"}},{"kind":"Field","name":{"kind":"Name","value":"relatedFilterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedSortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedParameters"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}}]}}]}}]} as unknown as DocumentNode; +export const UpdateSavedViewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateSavedView"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateSavedViewInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateSavedView"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"baseEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"filterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"sortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"parameters"}},{"kind":"Field","name":{"kind":"Name","value":"relatedFilterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedSortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedParameters"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}}]}}]}}]} as unknown as DocumentNode; export const DeleteSavedViewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteSavedView"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteSavedView"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}]}}]} as unknown as DocumentNode; -export const DuplicateSavedViewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DuplicateSavedView"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"name"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"duplicateSavedView"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"Variable","name":{"kind":"Name","value":"name"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"baseEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"filterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"sortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"parameters"}},{"kind":"Field","name":{"kind":"Name","value":"relatedFilterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedSortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedParameters"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}}]}}]}}]} as unknown as DocumentNode; +export const DuplicateSavedViewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DuplicateSavedView"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"name"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"duplicateSavedView"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"Variable","name":{"kind":"Name","value":"name"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"baseEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"filterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"sortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"parameters"}},{"kind":"Field","name":{"kind":"Name","value":"relatedFilterDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedSortDefinition"}},{"kind":"Field","name":{"kind":"Name","value":"relatedParameters"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}}]}}]}}]} as unknown as DocumentNode; export const PatientCreatedDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"PatientCreated"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"patientCreated"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"rootLocationIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}}}]}]}}]} as unknown as DocumentNode; export const PatientUpdatedDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"PatientUpdated"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"patientId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"patientUpdated"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"patientId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"patientId"}}},{"kind":"Argument","name":{"kind":"Name","value":"rootLocationIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}}}]}]}}]} as unknown as DocumentNode; export const PatientStateChangedDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"PatientStateChanged"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"patientId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"patientStateChanged"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"patientId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"patientId"}}},{"kind":"Argument","name":{"kind":"Name","value":"rootLocationIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}}}]}]}}]} as unknown as DocumentNode; @@ -1481,9 +496,9 @@ export const ReopenTaskDocument = {"kind":"Document","definitions":[{"kind":"Ope export const AssignTaskToTeamDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AssignTaskToTeam"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"teamId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignTaskToTeam"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"teamId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"teamId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"assigneeTeam"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}}]} as unknown as DocumentNode; export const UnassignTaskFromTeamDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UnassignTaskFromTeam"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"unassignTaskFromTeam"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"assigneeTeam"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}}]} as unknown as DocumentNode; export const ApplyTaskGraphDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ApplyTaskGraph"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ApplyTaskGraphInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"applyTaskGraph"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"done"}},{"kind":"Field","name":{"kind":"Name","value":"dueDate"}},{"kind":"Field","name":{"kind":"Name","value":"updateDate"}},{"kind":"Field","name":{"kind":"Name","value":"sourceTaskPresetId"}},{"kind":"Field","name":{"kind":"Name","value":"assignees"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"lastOnline"}},{"kind":"Field","name":{"kind":"Name","value":"isOnline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"patient"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode; -export const CreateTaskPresetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateTaskPreset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateTaskPresetInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createTaskPreset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"scope"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"graph"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"priority"}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTime"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fromId"}},{"kind":"Field","name":{"kind":"Name","value":"toId"}}]}}]}}]}}]}}]} as unknown as DocumentNode; -export const UpdateTaskPresetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateTaskPreset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateTaskPresetInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateTaskPreset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"scope"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"graph"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"priority"}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTime"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fromId"}},{"kind":"Field","name":{"kind":"Name","value":"toId"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const CreateTaskPresetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateTaskPreset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateTaskPresetInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createTaskPreset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"graph"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"priority"}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTime"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fromId"}},{"kind":"Field","name":{"kind":"Name","value":"toId"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const UpdateTaskPresetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateTaskPreset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateTaskPresetInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateTaskPreset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"graph"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"priority"}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTime"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fromId"}},{"kind":"Field","name":{"kind":"Name","value":"toId"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const DeleteTaskPresetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteTaskPreset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteTaskPreset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}]}}]} as unknown as DocumentNode; -export const TaskPresetsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"TaskPresets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taskPresets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"scope"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"graph"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"priority"}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTime"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fromId"}},{"kind":"Field","name":{"kind":"Name","value":"toId"}}]}}]}}]}}]}}]} as unknown as DocumentNode; -export const TaskPresetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"TaskPreset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taskPreset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"scope"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"graph"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"priority"}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTime"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fromId"}},{"kind":"Field","name":{"kind":"Name","value":"toId"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const TaskPresetsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"TaskPresets"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taskPresets"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"rootLocationIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rootLocationIds"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"graph"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"priority"}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTime"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fromId"}},{"kind":"Field","name":{"kind":"Name","value":"toId"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const TaskPresetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"TaskPreset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taskPreset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"ownerUserId"}},{"kind":"Field","name":{"kind":"Name","value":"isOwner"}},{"kind":"Field","name":{"kind":"Name","value":"locationId"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"kind"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"graph"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"priority"}},{"kind":"Field","name":{"kind":"Name","value":"estimatedTime"}}]}},{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fromId"}},{"kind":"Field","name":{"kind":"Name","value":"toId"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const UpdateProfilePictureDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateProfilePicture"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateProfilePictureInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProfilePicture"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"username"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"firstname"}},{"kind":"Field","name":{"kind":"Name","value":"lastname"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"lastOnline"}},{"kind":"Field","name":{"kind":"Name","value":"isOnline"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/web/api/gql/types.ts b/web/api/gql/types.ts new file mode 100644 index 00000000..0ea63b2d --- /dev/null +++ b/web/api/gql/types.ts @@ -0,0 +1,1022 @@ +export type Maybe = T | null; +export type InputMaybe = Maybe; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: { input: string; output: string; } + String: { input: string; output: string; } + Boolean: { input: boolean; output: boolean; } + Int: { input: number; output: number; } + Float: { input: number; output: number; } + /** Date (isoformat) */ + Date: { input: any; output: any; } + /** Date with time (isoformat) */ + DateTime: { input: any; output: any; } +}; + +export type ApplyTaskGraphInput = { + assignToCurrentUser?: Scalars['Boolean']['input']; + graph?: InputMaybe; + patientId: Scalars['ID']['input']; + presetId?: InputMaybe; + sourcePresetId?: InputMaybe; +}; + +export type AuditLogType = { + __typename?: 'AuditLogType'; + activity: Scalars['String']['output']; + caseId: Scalars['String']['output']; + context?: Maybe; + timestamp: Scalars['DateTime']['output']; + userId?: Maybe; +}; + +export type CreateLocationNodeInput = { + kind: LocationType; + parentId?: InputMaybe; + title: Scalars['String']['input']; +}; + +export type CreatePatientInput = { + assignedLocationId?: InputMaybe; + assignedLocationIds?: InputMaybe>; + birthdate: Scalars['Date']['input']; + clinicId: Scalars['ID']['input']; + description?: InputMaybe; + firstname: Scalars['String']['input']; + lastname: Scalars['String']['input']; + positionId?: InputMaybe; + properties?: InputMaybe>; + sex: Sex; + state?: InputMaybe; + teamIds?: InputMaybe>; +}; + +export type CreatePropertyDefinitionInput = { + allowedEntities: Array; + description?: InputMaybe; + fieldType: FieldType; + isActive?: Scalars['Boolean']['input']; + locationId?: InputMaybe; + name: Scalars['String']['input']; + options?: InputMaybe>; + visibility?: ScopeVisibility; +}; + +export type CreateSavedViewInput = { + baseEntityType: SavedViewEntityType; + filterDefinition: Scalars['String']['input']; + locationId?: InputMaybe; + name: Scalars['String']['input']; + parameters: Scalars['String']['input']; + relatedFilterDefinition?: Scalars['String']['input']; + relatedParameters?: Scalars['String']['input']; + relatedSortDefinition?: Scalars['String']['input']; + sortDefinition: Scalars['String']['input']; + visibility?: ScopeVisibility; +}; + +export type CreateTaskInput = { + assigneeIds?: InputMaybe>; + assigneeTeamId?: InputMaybe; + description?: InputMaybe; + dueDate?: InputMaybe; + estimatedTime?: InputMaybe; + patientId?: InputMaybe; + previousTaskIds?: InputMaybe>; + priority?: InputMaybe; + properties?: InputMaybe>; + title: Scalars['String']['input']; +}; + +export type CreateTaskPresetInput = { + graph: TaskGraphInput; + key?: InputMaybe; + locationId?: InputMaybe; + name: Scalars['String']['input']; + visibility?: ScopeVisibility; +}; + +export enum FieldType { + FieldTypeCheckbox = 'FIELD_TYPE_CHECKBOX', + FieldTypeDate = 'FIELD_TYPE_DATE', + FieldTypeDateTime = 'FIELD_TYPE_DATE_TIME', + FieldTypeMultiSelect = 'FIELD_TYPE_MULTI_SELECT', + FieldTypeNumber = 'FIELD_TYPE_NUMBER', + FieldTypeSelect = 'FIELD_TYPE_SELECT', + FieldTypeText = 'FIELD_TYPE_TEXT', + FieldTypeUnspecified = 'FIELD_TYPE_UNSPECIFIED', + FieldTypeUser = 'FIELD_TYPE_USER' +} + +export type LocationNodeType = { + __typename?: 'LocationNodeType'; + children: Array; + id: Scalars['ID']['output']; + kind: LocationType; + organizationIds: Array; + parent?: Maybe; + parentId?: Maybe; + patients: Array; + title: Scalars['String']['output']; +}; + +export enum LocationType { + Bed = 'BED', + Clinic = 'CLINIC', + Hospital = 'HOSPITAL', + Other = 'OTHER', + Practice = 'PRACTICE', + Room = 'ROOM', + Team = 'TEAM', + Ward = 'WARD' +} + +export type Mutation = { + __typename?: 'Mutation'; + addTaskAssignee: TaskType; + admitPatient: PatientType; + applyTaskGraph: Array; + assignTaskToTeam: TaskType; + clearPatientProperty: Scalars['Int']['output']; + clearTaskProperty: Scalars['Int']['output']; + completeTask: TaskType; + createLocationNode: LocationNodeType; + createPatient: PatientType; + createPropertyDefinition: PropertyDefinitionType; + createSavedView: SavedView; + createTask: TaskType; + createTaskPreset: TaskPresetType; + deleteLocationNode: Scalars['Boolean']['output']; + deletePatient: Scalars['Boolean']['output']; + deletePropertyDefinition: Scalars['Boolean']['output']; + deleteSavedView: Scalars['Boolean']['output']; + deleteTask: Scalars['Boolean']['output']; + deleteTaskPreset: Scalars['Boolean']['output']; + dischargePatient: PatientType; + duplicateSavedView: SavedView; + markPatientDead: PatientType; + removeTaskAssignee: TaskType; + reopenTask: TaskType; + unassignTaskFromTeam: TaskType; + updateLocationNode: LocationNodeType; + updatePatient: PatientType; + updateProfilePicture: UserType; + updatePropertyDefinition: PropertyDefinitionType; + updateSavedView: SavedView; + updateTask: TaskType; + updateTaskPreset: TaskPresetType; + waitPatient: PatientType; +}; + + +export type MutationAddTaskAssigneeArgs = { + id: Scalars['ID']['input']; + userId: Scalars['ID']['input']; +}; + + +export type MutationAdmitPatientArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationApplyTaskGraphArgs = { + data: ApplyTaskGraphInput; +}; + + +export type MutationAssignTaskToTeamArgs = { + id: Scalars['ID']['input']; + teamId: Scalars['ID']['input']; +}; + + +export type MutationClearPatientPropertyArgs = { + patientIds: Array; + propertyDefinitionId: Scalars['ID']['input']; +}; + + +export type MutationClearTaskPropertyArgs = { + propertyDefinitionId: Scalars['ID']['input']; + taskIds: Array; +}; + + +export type MutationCompleteTaskArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationCreateLocationNodeArgs = { + data: CreateLocationNodeInput; +}; + + +export type MutationCreatePatientArgs = { + data: CreatePatientInput; +}; + + +export type MutationCreatePropertyDefinitionArgs = { + data: CreatePropertyDefinitionInput; +}; + + +export type MutationCreateSavedViewArgs = { + data: CreateSavedViewInput; +}; + + +export type MutationCreateTaskArgs = { + data: CreateTaskInput; +}; + + +export type MutationCreateTaskPresetArgs = { + data: CreateTaskPresetInput; +}; + + +export type MutationDeleteLocationNodeArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationDeletePatientArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationDeletePropertyDefinitionArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationDeleteSavedViewArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationDeleteTaskArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationDeleteTaskPresetArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationDischargePatientArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationDuplicateSavedViewArgs = { + id: Scalars['ID']['input']; + name: Scalars['String']['input']; +}; + + +export type MutationMarkPatientDeadArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationRemoveTaskAssigneeArgs = { + id: Scalars['ID']['input']; + userId: Scalars['ID']['input']; +}; + + +export type MutationReopenTaskArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationUnassignTaskFromTeamArgs = { + id: Scalars['ID']['input']; +}; + + +export type MutationUpdateLocationNodeArgs = { + data: UpdateLocationNodeInput; + id: Scalars['ID']['input']; +}; + + +export type MutationUpdatePatientArgs = { + data: UpdatePatientInput; + id: Scalars['ID']['input']; +}; + + +export type MutationUpdateProfilePictureArgs = { + data: UpdateProfilePictureInput; +}; + + +export type MutationUpdatePropertyDefinitionArgs = { + data: UpdatePropertyDefinitionInput; + id: Scalars['ID']['input']; +}; + + +export type MutationUpdateSavedViewArgs = { + data: UpdateSavedViewInput; + id: Scalars['ID']['input']; +}; + + +export type MutationUpdateTaskArgs = { + data: UpdateTaskInput; + id: Scalars['ID']['input']; +}; + + +export type MutationUpdateTaskPresetArgs = { + data: UpdateTaskPresetInput; + id: Scalars['ID']['input']; +}; + + +export type MutationWaitPatientArgs = { + id: Scalars['ID']['input']; +}; + +export type PaginationInput = { + pageIndex?: Scalars['Int']['input']; + pageSize?: InputMaybe; +}; + +export enum PatientState { + Admitted = 'ADMITTED', + Dead = 'DEAD', + Discharged = 'DISCHARGED', + Wait = 'WAIT' +} + +export type PatientType = { + __typename?: 'PatientType'; + age: Scalars['Int']['output']; + assignedLocation?: Maybe; + assignedLocationId?: Maybe; + assignedLocations: Array; + birthdate: Scalars['Date']['output']; + checksum: Scalars['String']['output']; + clinic: LocationNodeType; + clinicId: Scalars['ID']['output']; + clinicUpdateDate?: Maybe; + description?: Maybe; + firstname: Scalars['String']['output']; + id: Scalars['ID']['output']; + lastname: Scalars['String']['output']; + name: Scalars['String']['output']; + position?: Maybe; + positionId?: Maybe; + positionUpdateDate?: Maybe; + properties: Array; + sex: Sex; + state: PatientState; + stateUpdateDate?: Maybe; + tasks: Array; + teams: Array; + updateDate?: Maybe; +}; + + +export type PatientTypeTasksArgs = { + done?: InputMaybe; +}; + +export type PropertyDefinitionType = { + __typename?: 'PropertyDefinitionType'; + allowedEntities: Array; + canEdit: Scalars['Boolean']['output']; + description?: Maybe; + fieldType: FieldType; + id: Scalars['ID']['output']; + isActive: Scalars['Boolean']['output']; + location?: Maybe; + locationId?: Maybe; + name: Scalars['String']['output']; + options: Array; + ownerUserId?: Maybe; + visibility: ScopeVisibility; +}; + +export enum PropertyEntity { + Patient = 'PATIENT', + Task = 'TASK' +} + +export type PropertyValueInput = { + booleanValue?: InputMaybe; + dateTimeValue?: InputMaybe; + dateValue?: InputMaybe; + definitionId: Scalars['ID']['input']; + multiSelectValues?: InputMaybe>; + numberValue?: InputMaybe; + selectValue?: InputMaybe; + textValue?: InputMaybe; + userValue?: InputMaybe; +}; + +export type PropertyValueType = { + __typename?: 'PropertyValueType'; + booleanValue?: Maybe; + dateTimeValue?: Maybe; + dateValue?: Maybe; + definition: PropertyDefinitionType; + id: Scalars['ID']['output']; + multiSelectValues?: Maybe>; + numberValue?: Maybe; + selectValue?: Maybe; + team?: Maybe; + textValue?: Maybe; + user?: Maybe; + userValue?: Maybe; +}; + +export type Query = { + __typename?: 'Query'; + auditLogs: Array; + locationNode?: Maybe; + locationNodes: Array; + locationRoots: Array; + me?: Maybe; + mySavedViews: Array; + patient?: Maybe; + patients: Array; + patientsTotal: Scalars['Int']['output']; + propertyDefinitions: Array; + queryableFields: Array; + recentPatients: Array; + recentPatientsTotal: Scalars['Int']['output']; + recentTasks: Array; + recentTasksTotal: Scalars['Int']['output']; + savedView?: Maybe; + scopedPatientCounts: ScopedPatientCountsType; + task?: Maybe; + taskPreset?: Maybe; + taskPresetByKey?: Maybe; + taskPresets: Array; + tasks: Array; + tasksTotal: Scalars['Int']['output']; + user?: Maybe; + users: Array; +}; + + +export type QueryAuditLogsArgs = { + caseId: Scalars['ID']['input']; + limit?: InputMaybe; + offset?: InputMaybe; +}; + + +export type QueryLocationNodeArgs = { + id: Scalars['ID']['input']; +}; + + +export type QueryLocationNodesArgs = { + kind?: InputMaybe; + limit?: InputMaybe; + offset?: InputMaybe; + orderByName?: Scalars['Boolean']['input']; + parentId?: InputMaybe; + recursive?: Scalars['Boolean']['input']; + search?: InputMaybe; +}; + + +export type QueryMySavedViewsArgs = { + rootLocationIds?: InputMaybe>; +}; + + +export type QueryPatientArgs = { + id: Scalars['ID']['input']; +}; + + +export type QueryPatientsArgs = { + filters?: InputMaybe>; + locationNodeId?: InputMaybe; + pagination?: InputMaybe; + rootLocationIds?: InputMaybe>; + search?: InputMaybe; + sorts?: InputMaybe>; + states?: InputMaybe>; +}; + + +export type QueryPatientsTotalArgs = { + filters?: InputMaybe>; + locationNodeId?: InputMaybe; + rootLocationIds?: InputMaybe>; + search?: InputMaybe; + sorts?: InputMaybe>; + states?: InputMaybe>; +}; + + +export type QueryPropertyDefinitionsArgs = { + rootLocationIds?: InputMaybe>; +}; + + +export type QueryQueryableFieldsArgs = { + entity: Scalars['String']['input']; +}; + + +export type QueryRecentPatientsArgs = { + filters?: InputMaybe>; + pagination?: InputMaybe; + rootLocationIds?: InputMaybe>; + search?: InputMaybe; + sorts?: InputMaybe>; +}; + + +export type QueryRecentPatientsTotalArgs = { + filters?: InputMaybe>; + rootLocationIds?: InputMaybe>; + search?: InputMaybe; + sorts?: InputMaybe>; +}; + + +export type QueryRecentTasksArgs = { + filters?: InputMaybe>; + pagination?: InputMaybe; + rootLocationIds?: InputMaybe>; + search?: InputMaybe; + sorts?: InputMaybe>; +}; + + +export type QueryRecentTasksTotalArgs = { + filters?: InputMaybe>; + rootLocationIds?: InputMaybe>; + search?: InputMaybe; + sorts?: InputMaybe>; +}; + + +export type QuerySavedViewArgs = { + id: Scalars['ID']['input']; +}; + + +export type QueryScopedPatientCountsArgs = { + rootLocationIds?: InputMaybe>; +}; + + +export type QueryTaskArgs = { + id: Scalars['ID']['input']; +}; + + +export type QueryTaskPresetArgs = { + id: Scalars['ID']['input']; +}; + + +export type QueryTaskPresetByKeyArgs = { + key: Scalars['String']['input']; +}; + + +export type QueryTaskPresetsArgs = { + rootLocationIds?: InputMaybe>; +}; + + +export type QueryTasksArgs = { + assigneeId?: InputMaybe; + assigneeTeamId?: InputMaybe; + filters?: InputMaybe>; + pagination?: InputMaybe; + patientId?: InputMaybe; + rootLocationIds?: InputMaybe>; + search?: InputMaybe; + sorts?: InputMaybe>; +}; + + +export type QueryTasksTotalArgs = { + assigneeId?: InputMaybe; + assigneeTeamId?: InputMaybe; + filters?: InputMaybe>; + patientId?: InputMaybe; + rootLocationIds?: InputMaybe>; + search?: InputMaybe; + sorts?: InputMaybe>; +}; + + +export type QueryUserArgs = { + id: Scalars['ID']['input']; +}; + + +export type QueryUsersArgs = { + filters?: InputMaybe>; + pagination?: InputMaybe; + search?: InputMaybe; + sorts?: InputMaybe>; +}; + +export type QueryFilterClauseInput = { + fieldKey: Scalars['String']['input']; + operator: QueryOperator; + value?: InputMaybe; +}; + +export type QueryFilterValueInput = { + boolValue?: InputMaybe; + dateMax?: InputMaybe; + dateMin?: InputMaybe; + dateValue?: InputMaybe; + floatMax?: InputMaybe; + floatMin?: InputMaybe; + floatValue?: InputMaybe; + stringValue?: InputMaybe; + stringValues?: InputMaybe>; + uuidValue?: InputMaybe; + uuidValues?: InputMaybe>; +}; + +export enum QueryOperator { + AllIn = 'ALL_IN', + AnyEq = 'ANY_EQ', + AnyIn = 'ANY_IN', + Between = 'BETWEEN', + Contains = 'CONTAINS', + EndsWith = 'ENDS_WITH', + Eq = 'EQ', + Gt = 'GT', + Gte = 'GTE', + In = 'IN', + IsEmpty = 'IS_EMPTY', + IsNotEmpty = 'IS_NOT_EMPTY', + IsNotNull = 'IS_NOT_NULL', + IsNull = 'IS_NULL', + Lt = 'LT', + Lte = 'LTE', + Neq = 'NEQ', + NoneIn = 'NONE_IN', + NotBetween = 'NOT_BETWEEN', + NotContains = 'NOT_CONTAINS', + NotIn = 'NOT_IN', + StartsWith = 'STARTS_WITH' +} + +export type QuerySearchInput = { + includeProperties?: Scalars['Boolean']['input']; + searchText?: InputMaybe; +}; + +export type QuerySortClauseInput = { + direction: SortDirection; + fieldKey: Scalars['String']['input']; +}; + +export type QueryableChoiceMeta = { + __typename?: 'QueryableChoiceMeta'; + optionKeys: Array; + optionLabels: Array; +}; + +export type QueryableField = { + __typename?: 'QueryableField'; + allowedOperators: Array; + choice?: Maybe; + filterable: Scalars['Boolean']['output']; + key: Scalars['String']['output']; + kind: QueryableFieldKind; + label: Scalars['String']['output']; + propertyDefinitionId?: Maybe; + relation?: Maybe; + searchable: Scalars['Boolean']['output']; + sortDirections: Array; + sortable: Scalars['Boolean']['output']; + valueType: QueryableValueType; +}; + +export enum QueryableFieldKind { + Choice = 'CHOICE', + ChoiceList = 'CHOICE_LIST', + Property = 'PROPERTY', + Reference = 'REFERENCE', + ReferenceList = 'REFERENCE_LIST', + Scalar = 'SCALAR' +} + +export type QueryableRelationMeta = { + __typename?: 'QueryableRelationMeta'; + allowedFilterModes: Array; + idFieldKey: Scalars['String']['output']; + labelFieldKey: Scalars['String']['output']; + targetEntity: Scalars['String']['output']; +}; + +export enum QueryableValueType { + Boolean = 'BOOLEAN', + Date = 'DATE', + Datetime = 'DATETIME', + Number = 'NUMBER', + String = 'STRING', + StringList = 'STRING_LIST', + Uuid = 'UUID', + UuidList = 'UUID_LIST' +} + +export enum ReferenceFilterMode { + Id = 'ID', + Label = 'LABEL' +} + +export type SavedView = { + __typename?: 'SavedView'; + baseEntityType: SavedViewEntityType; + createdAt: Scalars['String']['output']; + filterDefinition: Scalars['String']['output']; + id: Scalars['ID']['output']; + isOwner: Scalars['Boolean']['output']; + location?: Maybe; + locationId?: Maybe; + name: Scalars['String']['output']; + ownerUserId: Scalars['ID']['output']; + parameters: Scalars['String']['output']; + relatedFilterDefinition: Scalars['String']['output']; + relatedParameters: Scalars['String']['output']; + relatedSortDefinition: Scalars['String']['output']; + sortDefinition: Scalars['String']['output']; + updatedAt: Scalars['String']['output']; + visibility: ScopeVisibility; +}; + +export enum SavedViewEntityType { + Patient = 'PATIENT', + Task = 'TASK' +} + +export enum ScopeVisibility { + Private = 'PRIVATE', + Public = 'PUBLIC' +} + +export type ScopedPatientCountsType = { + __typename?: 'ScopedPatientCountsType'; + scopedPatientsAdmitted: Scalars['Int']['output']; + scopedPatientsDeceased: Scalars['Int']['output']; + scopedPatientsDischarged: Scalars['Int']['output']; + scopedPatientsTotal: Scalars['Int']['output']; + scopedPatientsWaiting: Scalars['Int']['output']; +}; + +export enum Sex { + Female = 'FEMALE', + Male = 'MALE', + Unknown = 'UNKNOWN' +} + +export enum SortDirection { + Asc = 'ASC', + Desc = 'DESC' +} + +export type Subscription = { + __typename?: 'Subscription'; + locationNodeCreated: Scalars['ID']['output']; + locationNodeDeleted: Scalars['ID']['output']; + locationNodeUpdated: Scalars['ID']['output']; + patientCreated: Scalars['ID']['output']; + patientDeleted: Scalars['ID']['output']; + patientStateChanged: Scalars['ID']['output']; + patientUpdated: Scalars['ID']['output']; + taskCreated: Scalars['ID']['output']; + taskDeleted: Scalars['ID']['output']; + taskUpdated: Scalars['ID']['output']; +}; + + +export type SubscriptionLocationNodeUpdatedArgs = { + locationId?: InputMaybe; +}; + + +export type SubscriptionPatientCreatedArgs = { + rootLocationIds?: InputMaybe>; +}; + + +export type SubscriptionPatientDeletedArgs = { + rootLocationIds?: InputMaybe>; +}; + + +export type SubscriptionPatientStateChangedArgs = { + patientId?: InputMaybe; + rootLocationIds?: InputMaybe>; +}; + + +export type SubscriptionPatientUpdatedArgs = { + patientId?: InputMaybe; + rootLocationIds?: InputMaybe>; +}; + + +export type SubscriptionTaskCreatedArgs = { + rootLocationIds?: InputMaybe>; +}; + + +export type SubscriptionTaskDeletedArgs = { + rootLocationIds?: InputMaybe>; +}; + + +export type SubscriptionTaskUpdatedArgs = { + rootLocationIds?: InputMaybe>; + taskId?: InputMaybe; +}; + +export type TaskGraphEdgeInput = { + fromNodeId: Scalars['String']['input']; + toNodeId: Scalars['String']['input']; +}; + +export type TaskGraphEdgeType = { + __typename?: 'TaskGraphEdgeType'; + fromId: Scalars['String']['output']; + toId: Scalars['String']['output']; +}; + +export type TaskGraphInput = { + edges: Array; + nodes: Array; +}; + +export type TaskGraphNodeInput = { + description?: InputMaybe; + estimatedTime?: InputMaybe; + nodeId: Scalars['String']['input']; + priority?: InputMaybe; + title: Scalars['String']['input']; +}; + +export type TaskGraphNodeType = { + __typename?: 'TaskGraphNodeType'; + description?: Maybe; + estimatedTime?: Maybe; + id: Scalars['String']['output']; + priority?: Maybe; + title: Scalars['String']['output']; +}; + +export type TaskGraphType = { + __typename?: 'TaskGraphType'; + edges: Array; + nodes: Array; +}; + +export type TaskPresetType = { + __typename?: 'TaskPresetType'; + graph: TaskGraphType; + id: Scalars['ID']['output']; + isOwner: Scalars['Boolean']['output']; + key: Scalars['String']['output']; + location?: Maybe; + locationId?: Maybe; + name: Scalars['String']['output']; + ownerUserId?: Maybe; + visibility: ScopeVisibility; +}; + +export enum TaskPriority { + P1 = 'P1', + P2 = 'P2', + P3 = 'P3', + P4 = 'P4' +} + +export type TaskType = { + __typename?: 'TaskType'; + assigneeTeam?: Maybe; + assigneeTeamId?: Maybe; + assignees: Array; + checksum: Scalars['String']['output']; + creationDate: Scalars['DateTime']['output']; + description?: Maybe; + done: Scalars['Boolean']['output']; + dueDate?: Maybe; + estimatedTime?: Maybe; + id: Scalars['ID']['output']; + patient?: Maybe; + patientId?: Maybe; + priority?: Maybe; + properties: Array; + sourceTaskPresetId?: Maybe; + title: Scalars['String']['output']; + updateDate?: Maybe; +}; + +export type UpdateLocationNodeInput = { + kind?: InputMaybe; + parentId?: InputMaybe; + title?: InputMaybe; +}; + +export type UpdatePatientInput = { + assignedLocationId?: InputMaybe; + assignedLocationIds?: InputMaybe>; + birthdate?: InputMaybe; + checksum?: InputMaybe; + clinicId?: InputMaybe; + description?: InputMaybe; + firstname?: InputMaybe; + lastname?: InputMaybe; + positionId?: InputMaybe; + properties?: InputMaybe>; + sex?: InputMaybe; + teamIds?: InputMaybe>; +}; + +export type UpdateProfilePictureInput = { + avatarUrl: Scalars['String']['input']; +}; + +export type UpdatePropertyDefinitionInput = { + allowedEntities?: InputMaybe>; + description?: InputMaybe; + isActive?: InputMaybe; + locationId?: InputMaybe; + name?: InputMaybe; + options?: InputMaybe>; + visibility?: InputMaybe; +}; + +export type UpdateSavedViewInput = { + filterDefinition?: InputMaybe; + locationId?: InputMaybe; + name?: InputMaybe; + parameters?: InputMaybe; + relatedFilterDefinition?: InputMaybe; + relatedParameters?: InputMaybe; + relatedSortDefinition?: InputMaybe; + sortDefinition?: InputMaybe; + visibility?: InputMaybe; +}; + +export type UpdateTaskInput = { + assigneeIds?: InputMaybe>; + assigneeTeamId?: InputMaybe; + checksum?: InputMaybe; + description?: InputMaybe; + done?: InputMaybe; + dueDate?: InputMaybe; + estimatedTime?: InputMaybe; + patientId?: InputMaybe; + previousTaskIds?: InputMaybe>; + priority?: InputMaybe; + properties?: InputMaybe>; + title?: InputMaybe; +}; + +export type UpdateTaskPresetInput = { + graph?: InputMaybe; + key?: InputMaybe; + locationId?: InputMaybe; + name?: InputMaybe; + visibility?: InputMaybe; +}; + +export type UserType = { + __typename?: 'UserType'; + avatarUrl?: Maybe; + email?: Maybe; + firstname?: Maybe; + id: Scalars['ID']['output']; + isOnline: Scalars['Boolean']['output']; + lastOnline?: Maybe; + lastname?: Maybe; + name: Scalars['String']['output']; + organizations?: Maybe; + rootLocations: Array; + tasks: Array; + title?: Maybe; + username: Scalars['String']['output']; +}; + + +export type UserTypeTasksArgs = { + rootLocationIds?: InputMaybe>; +}; diff --git a/web/api/graphql/PropertyMutations.graphql b/web/api/graphql/PropertyMutations.graphql index 92353cdd..2afc232c 100644 --- a/web/api/graphql/PropertyMutations.graphql +++ b/web/api/graphql/PropertyMutations.graphql @@ -7,6 +7,25 @@ mutation CreatePropertyDefinition($data: CreatePropertyDefinitionInput!) { isActive allowedEntities options + visibility + ownerUserId + canEdit + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } } } @@ -19,6 +38,25 @@ mutation UpdatePropertyDefinition($id: ID!, $data: UpdatePropertyDefinitionInput isActive allowedEntities options + visibility + ownerUserId + canEdit + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } } } diff --git a/web/api/graphql/PropertyQueries.graphql b/web/api/graphql/PropertyQueries.graphql index ae4134f4..1a983d84 100644 --- a/web/api/graphql/PropertyQueries.graphql +++ b/web/api/graphql/PropertyQueries.graphql @@ -1,5 +1,5 @@ -query GetPropertyDefinitions { - propertyDefinitions { +query GetPropertyDefinitions($rootLocationIds: [ID!]) { + propertyDefinitions(rootLocationIds: $rootLocationIds) { id name description @@ -7,11 +7,30 @@ query GetPropertyDefinitions { isActive allowedEntities options + visibility + ownerUserId + canEdit + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } } } -query GetPropertiesForSubject($subjectId: ID!, $subjectType: PropertyEntity!) { - propertyDefinitions { +query GetPropertiesForSubject($subjectId: ID!, $subjectType: PropertyEntity!, $rootLocationIds: [ID!]) { + propertyDefinitions(rootLocationIds: $rootLocationIds) { id name description @@ -19,6 +38,25 @@ query GetPropertiesForSubject($subjectId: ID!, $subjectType: PropertyEntity!) { isActive allowedEntities options + visibility + ownerUserId + canEdit + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } } } diff --git a/web/api/graphql/SavedView.graphql b/web/api/graphql/SavedView.graphql index 1964b2b5..fd053c55 100644 --- a/web/api/graphql/SavedView.graphql +++ b/web/api/graphql/SavedView.graphql @@ -1,5 +1,5 @@ -query MySavedViews { - mySavedViews { +query MySavedViews($rootLocationIds: [ID!]) { + mySavedViews(rootLocationIds: $rootLocationIds) { id name baseEntityType @@ -11,6 +11,22 @@ query MySavedViews { relatedParameters ownerUserId visibility + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } createdAt updatedAt isOwner @@ -30,6 +46,22 @@ query SavedView($id: ID!) { relatedParameters ownerUserId visibility + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } createdAt updatedAt isOwner @@ -49,6 +81,22 @@ mutation CreateSavedView($data: CreateSavedViewInput!) { relatedParameters ownerUserId visibility + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } createdAt updatedAt isOwner @@ -68,6 +116,22 @@ mutation UpdateSavedView($id: ID!, $data: UpdateSavedViewInput!) { relatedParameters ownerUserId visibility + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } createdAt updatedAt isOwner @@ -91,6 +155,22 @@ mutation DuplicateSavedView($id: ID!, $name: String!) { relatedParameters ownerUserId visibility + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } createdAt updatedAt isOwner diff --git a/web/api/graphql/TaskPresetMutations.graphql b/web/api/graphql/TaskPresetMutations.graphql index 5dde5848..a56aae69 100644 --- a/web/api/graphql/TaskPresetMutations.graphql +++ b/web/api/graphql/TaskPresetMutations.graphql @@ -3,8 +3,25 @@ mutation CreateTaskPreset($data: CreateTaskPresetInput!) { id name key - scope + visibility ownerUserId + isOwner + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } graph { nodes { id @@ -26,8 +43,25 @@ mutation UpdateTaskPreset($id: ID!, $data: UpdateTaskPresetInput!) { id name key - scope + visibility ownerUserId + isOwner + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } graph { nodes { id diff --git a/web/api/graphql/TaskPresetQueries.graphql b/web/api/graphql/TaskPresetQueries.graphql index 6deadd50..fb412051 100644 --- a/web/api/graphql/TaskPresetQueries.graphql +++ b/web/api/graphql/TaskPresetQueries.graphql @@ -1,10 +1,27 @@ -query TaskPresets { - taskPresets { +query TaskPresets($rootLocationIds: [ID!]) { + taskPresets(rootLocationIds: $rootLocationIds) { id name key - scope + visibility ownerUserId + isOwner + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } graph { nodes { id @@ -26,8 +43,25 @@ query TaskPreset($id: ID!) { id name key - scope + visibility ownerUserId + isOwner + locationId + location { + id + title + kind + parent { + id + title + kind + parent { + id + title + kind + } + } + } graph { nodes { id diff --git a/web/api/mutations/tasks/updateTask.plan.ts b/web/api/mutations/tasks/updateTask.plan.ts index 668c953c..404f7e4c 100644 --- a/web/api/mutations/tasks/updateTask.plan.ts +++ b/web/api/mutations/tasks/updateTask.plan.ts @@ -47,11 +47,11 @@ function optimisticAssigneeTeam( if (assigneeTeamId === null) return null if (previous?.id === assigneeTeamId) return previous return { - __typename: 'LocationNodeType' as const, + __typename: 'LocationNodeType', id: assigneeTeamId, title: '', kind: LocationType.Team, - } + } as NonNullable } export const updateTaskOptimisticPlanKey = 'UpdateTask' diff --git a/web/codegen.ts b/web/codegen.ts index 625fed4f..22ffdc67 100644 --- a/web/codegen.ts +++ b/web/codegen.ts @@ -12,12 +12,34 @@ const schema = fs.existsSync(schemaFromBackend) ? schemaFromWeb : getConfig().graphqlEndpoint +const sharedConfig = { + scalars: { + ID: { input: 'string', output: 'string' }, + Date: 'any', + DateTime: 'any', + }, + skipTypename: false, + avoidOptionals: false, +} + const config: CodegenConfig = { schema, documents: 'api/graphql/**/*.graphql', generates: { + 'api/gql/types.ts': { + plugins: ['typescript'], + config: sharedConfig, + }, 'api/gql/generated.ts': { - plugins: ['typescript', 'typescript-operations', 'typed-document-node'], + plugins: [ + { add: { content: "export * from './types'" } }, + 'typescript-operations', + 'typed-document-node', + ], + config: { + ...sharedConfig, + importSchemaTypesFrom: 'api/gql/types', + }, }, }, } diff --git a/web/components/locations/ScopeChip.tsx b/web/components/locations/ScopeChip.tsx new file mode 100644 index 00000000..ff60d248 --- /dev/null +++ b/web/components/locations/ScopeChip.tsx @@ -0,0 +1,92 @@ +'use client' + +import { useMemo } from 'react' +import { Chip } from '@helpwave/hightide' +import { Lock } from 'lucide-react' +import clsx from 'clsx' +import { ScopeVisibility, type LocationType } from '@/api/gql/generated' +import { LocationChips } from '@/components/locations/LocationChips' +import { useLocations } from '@/data' +import { useTasksTranslation } from '@/i18n/useTasksTranslation' + +export type ScopeLocation = { + id: string, + title: string, + kind?: LocationType, + parentId?: string | null, + parent?: ScopeLocation | null, +} + +type PathNode = { id: string, title: string, kind?: LocationType } + +export function useScopeLocationPath(location: ScopeLocation | null | undefined): PathNode[] { + const needsLookup = !!location && !location.parent && !!location.parentId + const { data } = useLocations({ limit: 1000 }, { skip: !needsLookup }) + return useMemo(() => { + if (!location) return [] + const path: PathNode[] = [] + let current: ScopeLocation | null | undefined = location + while (current) { + path.unshift({ id: current.id, title: current.title, kind: current.kind }) + current = current.parent ?? null + } + if (location.parent || !location.parentId || !data?.locationNodes) { + return path + } + const byId = new Map(data.locationNodes.map(node => [node.id, node])) + let parentId: string | null | undefined = location.parentId + const seen = new Set([location.id]) + while (parentId && !seen.has(parentId)) { + const node = byId.get(parentId) + if (!node) break + seen.add(node.id) + path.unshift({ id: node.id, title: node.title, kind: node.kind }) + parentId = node.parentId + } + return path + }, [location, data?.locationNodes]) +} + +type ScopeLocationChipProps = { + location: ScopeLocation, + small?: boolean, + className?: string, +} + +export function ScopeLocationChip({ location, small = false, className }: ScopeLocationChipProps) { + const path = useScopeLocationPath(location) + return ( + 0 ? path : [location]} + disableLink + small={small} + className={className} + /> + ) +} + +type ScopeChipProps = { + visibility: ScopeVisibility, + location?: ScopeLocation | null, + small?: boolean, + className?: string, +} + +export function ScopeChip({ visibility, location, small = false, className }: ScopeChipProps) { + const translation = useTasksTranslation() + if (visibility === ScopeVisibility.Public && location) { + return + } + const isPublic = visibility === ScopeVisibility.Public + return ( + + {!isPublic && } + {isPublic ? translation('scopePublic') : translation('scopePrivate')} + + ) +} diff --git a/web/components/locations/ScopeVisibilityField.tsx b/web/components/locations/ScopeVisibilityField.tsx new file mode 100644 index 00000000..bdd6eaec --- /dev/null +++ b/web/components/locations/ScopeVisibilityField.tsx @@ -0,0 +1,122 @@ +'use client' + +import { useState } from 'react' +import { Button, Checkbox } from '@helpwave/hightide' +import { MapPin } from 'lucide-react' +import clsx from 'clsx' +import { ScopeVisibility } from '@/api/gql/generated' +import { LocationSelectionDialog } from '@/components/locations/LocationSelectionDialog' +import { ScopeLocationChip, type ScopeLocation } from '@/components/locations/ScopeChip' +import { useTasksTranslation } from '@/i18n/useTasksTranslation' + +export type ScopeValue = { + visibility: ScopeVisibility, + location: ScopeLocation | null, +} + +export const privateScope = (): ScopeValue => ({ + visibility: ScopeVisibility.Private, + location: null, +}) + +export const scopeFromEntity = (entity: { + visibility: ScopeVisibility, + location?: ScopeLocation | null, +}): ScopeValue => ({ + visibility: entity.visibility, + location: entity.visibility === ScopeVisibility.Public ? entity.location ?? null : null, +}) + +export const isScopeComplete = (value: ScopeValue): boolean => + value.visibility === ScopeVisibility.Private || value.location != null + +export const scopeToInput = (value: ScopeValue): { visibility: ScopeVisibility, locationId: string | null } => ({ + visibility: value.visibility, + locationId: value.visibility === ScopeVisibility.Public ? value.location?.id ?? null : null, +}) + +export const scopeEquals = (a: ScopeValue, b: ScopeValue): boolean => + a.visibility === b.visibility && (a.location?.id ?? null) === (b.location?.id ?? null) + +type ScopeVisibilityFieldProps = { + value: ScopeValue, + onChange: (value: ScopeValue) => void, + disabled?: boolean, + className?: string, +} + +export function ScopeVisibilityField({ + value, + onChange, + disabled = false, + className, +}: ScopeVisibilityFieldProps) { + const translation = useTasksTranslation() + const [dialogOpen, setDialogOpen] = useState(false) + const isPublic = value.visibility === ScopeVisibility.Public + + const setPublic = (checked: boolean) => { + if (disabled) return + onChange({ + visibility: checked ? ScopeVisibility.Public : ScopeVisibility.Private, + location: checked ? value.location : null, + }) + } + + return ( +
+ {translation('scopeVisibility')} +
+ +
setPublic(!isPublic)} + > + {translation('scopePublic')} + + {isPublic ? translation('scopePublicDescription') : translation('scopePrivateDescription')} + +
+
+ {isPublic && ( +
+
+ {translation('scopeStoredAt')} + {value.location ? ( + + ) : ( + {translation('scopeNoNodeSelected')} + )} +
+ +
+ )} + setDialogOpen(false)} + onSelect={(locations) => { + const node = locations[0] + if (!node) return + onChange({ visibility: ScopeVisibility.Public, location: node }) + }} + initialSelectedIds={value.location ? [value.location.id] : []} + multiSelect={false} + useCase="default" + /> +
+ ) +} diff --git a/web/components/patients/PatientDataEditor.tsx b/web/components/patients/PatientDataEditor.tsx index 90c9d435..37ad9091 100644 --- a/web/components/patients/PatientDataEditor.tsx +++ b/web/components/patients/PatientDataEditor.tsx @@ -3,11 +3,11 @@ import type { FormFieldDataHandling } from '@helpwave/hightide' import { FormProvider, Input, DateTimeInput, Select, SelectOption, Textarea, Checkbox, Button, ConfirmDialog, LoadingContainer, useCreateForm, FormField, Visibility, useFormObserverKey, IconButton } from '@helpwave/hightide' import { CenteredLoadingLogo } from '@/components/CenteredLoadingLogo' import { useTasksTranslation } from '@/i18n/useTasksTranslation' -import type { CreatePatientInput, LocationNodeType, UpdatePatientInput, GetPatientQuery } from '@/api/gql/generated' +import type { CreatePatientInput, LocationNodeType, UpdatePatientInput } from '@/api/gql/generated' import { Sex, PatientState } from '@/api/gql/generated' import { useLocations, usePatient } from '@/data' import { Building2, CheckIcon, Locate, PlusIcon, Users, XIcon } from 'lucide-react' -import { formatLocationPath, formatLocationPathFromId } from '@/utils/location' +import { formatLocationPath, formatLocationPathFromId, type TypedLocationPathNode } from '@/utils/location' import { toISODate } from './PatientDetailView' import { LocationSelectionDialog } from '@/components/locations/LocationSelectionDialog' import { @@ -27,9 +27,9 @@ import { serializePatientCreateDraft } from '@/utils/createDraftSnapshots' import { applyDefinedOverrides } from '@/utils/applyDefinedOverrides' type PatientFormValues = Omit & { - clinic: NonNullable['clinic'] | null, - teams?: NonNullable['teams'] | null, - position?: NonNullable['position'] | null, + clinic: TypedLocationPathNode | null, + teams?: TypedLocationPathNode[] | null, + position?: TypedLocationPathNode | null, } interface PatientDataEditorProps { diff --git a/web/components/properties/EditablePropertyCell.tsx b/web/components/properties/EditablePropertyCell.tsx index 32cc24ff..76ed344d 100644 --- a/web/components/properties/EditablePropertyCell.tsx +++ b/web/components/properties/EditablePropertyCell.tsx @@ -1,7 +1,8 @@ import type { ReactNode } from 'react' import clsx from 'clsx' import { Edit2 } from 'lucide-react' -import { FieldType, type PropertyDefinitionType, type PropertyValueInput, type PropertyValueType } from '@/api/gql/generated' +import { FieldType, type PropertyValueInput, type PropertyValueType } from '@/api/gql/generated' +import type { PropertyValueRowDefinition } from '@/utils/propertyColumn' import { PropertyCell } from '@/components/properties/PropertyCell' import { AssigneeSelect } from '@/components/tasks/AssigneeSelect' import { InTableTextEditPopUp } from '@/components/tables/in-table-edit/InTableTextEditPopUp' @@ -12,7 +13,7 @@ import { InTableSingleSelectEditPopUp } from '@/components/tables/in-table-edit/ import { InTableMultiSelectEditPopUp } from '@/components/tables/in-table-edit/InTableMultiSelectEditPopUp' export type EditablePropertyCellProps = { - definition: PropertyDefinitionType, + definition: PropertyValueRowDefinition, property?: PropertyValueType | undefined, allowUpdates: boolean, disabled?: boolean, diff --git a/web/components/properties/PropertyDetailView.tsx b/web/components/properties/PropertyDetailView.tsx index 66521028..bcc1fdeb 100644 --- a/web/components/properties/PropertyDetailView.tsx +++ b/web/components/properties/PropertyDetailView.tsx @@ -19,6 +19,14 @@ import { useTasksTranslation } from '@/i18n/useTasksTranslation' import { PlusIcon, XIcon } from 'lucide-react' import { FieldType, PropertyEntity } from '@/api/gql/generated' import { useCreatePropertyDefinition, useUpdatePropertyDefinition } from '@/data' +import { + isScopeComplete, + privateScope, + ScopeVisibilityField, + scopeFromEntity, + scopeToInput, + type ScopeValue +} from '@/components/locations/ScopeVisibilityField' interface PropertyDetailViewProps { id?: string, @@ -75,6 +83,31 @@ export const PropertyDetailView = ({ const [createProperty, { loading: isCreating }] = useCreatePropertyDefinition() const [updateProperty, { loading: isUpdating }] = useUpdatePropertyDefinition() + const [scope, setScope] = useState(() => ( + initialData?.visibility + ? scopeFromEntity({ visibility: initialData.visibility, location: initialData.location }) + : privateScope() + )) + const canEditScope = !isEditMode || initialData?.canEdit !== false + const initialVisibility = initialData?.visibility + const initialLocation = initialData?.location + + useEffect(() => { + setScope( + initialVisibility + ? scopeFromEntity({ visibility: initialVisibility, location: initialLocation }) + : privateScope() + ) + }, [id, initialVisibility, initialLocation]) + + const handleScopeChange = (next: ScopeValue) => { + setScope(next) + if (!isEditMode || !id || !isScopeComplete(next)) return + updateProperty({ + variables: { id, data: scopeToInput(next) }, + onCompleted: () => onSuccess(), + }) + } const persist = (updates: Partial) => { if (!isEditMode || !id) return @@ -112,7 +145,7 @@ export const PropertyDetailView = ({ }, }, onFormSubmit: (values) => { - if (!values.name.trim()) return + if (!values.name.trim() || !isScopeComplete(scope)) return const createData = { name: values.name, @@ -121,6 +154,7 @@ export const PropertyDetailView = ({ allowedEntities: [mapSubjectTypeToBackend(values.subjectType)], options: values.selectData?.options.map(opt => opt.name) || null, isActive: !values.isArchived, + ...scopeToInput(scope), } createProperty({ @@ -280,6 +314,12 @@ export const PropertyDetailView = ({ )} + + formKey="fieldType"> {({ value: fieldType }) => { const isSelectType = fieldType === 'multiSelect' || fieldType === 'singleSelect' @@ -475,7 +515,7 @@ export const PropertyDetailView = ({ - + + diff --git a/web/pages/view/[uid].tsx b/web/pages/view/[uid].tsx index 19e043a1..c90f2b5d 100644 --- a/web/pages/view/[uid].tsx +++ b/web/pages/view/[uid].tsx @@ -19,7 +19,6 @@ import { usePropertyDefinitions, useSavedView, useTasksPaginated } from '@/data' import { getPropertyColumnIds } from '@/hooks/usePropertyColumnVisibility' import { DuplicateSavedViewDocument, - MySavedViewsDocument, SavedViewDocument, UpdateSavedViewDocument, type DuplicateSavedViewMutation, @@ -43,6 +42,7 @@ import { import { SaveViewDialog } from '@/components/views/SaveViewDialog' import { SaveViewActionsMenu } from '@/components/views/SaveViewActionsMenu' import { SavedViewEntityTypeChip } from '@/components/views/SavedViewEntityTypeChip' +import { ScopeChip } from '@/components/locations/ScopeChip' import type { ColumnFiltersState } from '@tanstack/react-table' import { useTasksContext } from '@/hooks/useTasksContext' import { useTableState } from '@/hooks/useTableState' @@ -198,7 +198,7 @@ function SavedTaskViewTab({ awaitRefetchQueries: true, refetchQueries: [ { query: getParsedDocument(SavedViewDocument), variables: { id: viewId } }, - { query: getParsedDocument(MySavedViewsDocument) }, + 'MySavedViews', ], update(cache, { data }) { const view = data?.updateSavedView @@ -409,7 +409,7 @@ const ViewPage: NextPage = () => { DuplicateSavedViewMutation, DuplicateSavedViewMutationVariables >(getParsedDocument(DuplicateSavedViewDocument), { - refetchQueries: [{ query: getParsedDocument(MySavedViewsDocument) }], + refetchQueries: ['MySavedViews'], awaitRefetchQueries: true, update(cache, { data }) { const view = data?.duplicateSavedView @@ -481,6 +481,7 @@ const ViewPage: NextPage = () => {
{view.name} + {!view.isOwner && ( { if (!location) return [] diff --git a/web/utils/propertyColumn.tsx b/web/utils/propertyColumn.tsx index 1bf6daa8..f66e5c2f 100644 --- a/web/utils/propertyColumn.tsx +++ b/web/utils/propertyColumn.tsx @@ -11,8 +11,10 @@ import { getPropertyFilterFn } from './propertyFilterMapping' import { PropertyCell } from '@/components/properties/PropertyCell' import { EditablePropertyCell } from '@/components/properties/EditablePropertyCell' +export type PropertyValueRowDefinition = Pick + export type PropertyValueRow = Pick & { - definition: PropertyDefinitionType, + definition: PropertyValueRowDefinition, user?: { id: string, name: string, avatarUrl?: string | null, isOnline?: boolean } | null, team?: { id: string, title: string, kind: LocationType } | null, } @@ -69,7 +71,7 @@ function getPropertySizeInformation(fieldType: FieldType) { } } -function getFilterData(prop: PropertyDefinitionType) { +function getFilterData(prop: PropertyValueRowDefinition) { const filterFn = getPropertyFilterFn(prop.fieldType) if (filterFn === 'multiTags' || filterFn === 'singleTag') { return { @@ -83,7 +85,7 @@ function getFilterData(prop: PropertyDefinitionType) { } export function createPropertyColumn( - prop: PropertyDefinitionType, + prop: PropertyValueRowDefinition, hasFilter?: boolean, options?: PropertyColumnFactoryOptions ): ColumnDef { @@ -140,7 +142,7 @@ export function createPropertyColumn( } type PropertyDefinitionsData = { - propertyDefinitions?: PropertyDefinitionType[], + propertyDefinitions?: PropertyValueRowDefinition[], } | null | undefined export function getPropertyColumnsForEntity( diff --git a/web/utils/savedViewsCache.ts b/web/utils/savedViewsCache.ts index 65cc9be8..68caf732 100644 --- a/web/utils/savedViewsCache.ts +++ b/web/utils/savedViewsCache.ts @@ -1,43 +1,32 @@ -import type { ApolloCache } from '@apollo/client' -import { MySavedViewsDocument, type MySavedViewsQuery } from '@/api/gql/generated' -import { getParsedDocument } from '@/data/hooks/queryHelpers' +import type { ApolloCache, Reference } from '@apollo/client' +import type { MySavedViewsQuery } from '@/api/gql/generated' type SavedViewRow = MySavedViewsQuery['mySavedViews'][number] -const mySavedViewsQuery = { query: getParsedDocument(MySavedViewsDocument) } - export function appendSavedViewToMySavedViewsCache(cache: ApolloCache, view: SavedViewRow): void { - cache.updateQuery(mySavedViewsQuery, (data) => { - if (!data) { - return data - } - if (data.mySavedViews.some((v) => v.id === view.id)) { - return data - } - return { ...data, mySavedViews: [...data.mySavedViews, view] } + cache.modify({ + fields: { + mySavedViews(existing: readonly Reference[] = [], { readField, toReference }) { + if (existing.some((ref) => readField('id', ref) === view.id)) { + return existing + } + const ref = toReference({ __typename: 'SavedView', id: view.id }) + return ref ? [...existing, ref] : existing + }, + }, }) } export function replaceSavedViewInMySavedViewsCache(cache: ApolloCache, view: SavedViewRow): void { - cache.updateQuery(mySavedViewsQuery, (data) => { - if (!data) { - return data - } - const idx = data.mySavedViews.findIndex((v) => v.id === view.id) - if (idx === -1) { - return { ...data, mySavedViews: [...data.mySavedViews, view] } - } - const next = [...data.mySavedViews] - next[idx] = view - return { ...data, mySavedViews: next } - }) + appendSavedViewToMySavedViewsCache(cache, view) } export function removeSavedViewFromMySavedViewsCache(cache: ApolloCache, id: string): void { - cache.updateQuery(mySavedViewsQuery, (data) => { - if (!data) { - return data - } - return { ...data, mySavedViews: data.mySavedViews.filter((v) => v.id !== id) } + cache.modify({ + fields: { + mySavedViews(existing: readonly Reference[] = [], { readField }) { + return existing.filter((ref) => readField('id', ref) !== id) + }, + }, }) }