device_manager.api.dal ====================== .. py:module:: device_manager.api.dal .. autoapi-nested-parse:: Device data access layer. Provides functions to interact with the device database, including creating, updating, retrieving, and deleting device records. It uses SQLAlchemy for asynchronous database operations and Pydantic models for data validation. Copyright (C) 2023, BRAIN-LINK UG (haftungsbeschränkt). All Rights Reserved. SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-ScanHub-Commercial Functions --------- .. autoapisummary:: device_manager.api.dal.dal_create_device device_manager.api.dal.dal_get_device device_manager.api.dal.dal_get_all_devices device_manager.api.dal.dal_delete_device device_manager.api.dal.dal_update_device Module Contents --------------- .. py:function:: dal_create_device(request: scanhub_libraries.models.DeviceCreationRequest, token_hash: str, salt: str) -> app.api.db.Device :async: Add a new device to the database. :param payload {BaseDevice} -- Pydantic base model to create a new database entry: .. py:function:: dal_get_device(device_id: uuid.UUID) -> app.api.db.Device | None :async: Fetch a device from database. :param device_id {UUID} -- Identifier of the device: :rtype: Device -- Database orm model .. py:function:: dal_get_all_devices() -> list[app.api.db.Device] :async: Get a list of all existing devices. :rtype: List[Device] -- List of database orm models .. py:function:: dal_delete_device(device_id: uuid.UUID) -> bool :async: Delete a device by identifier. :param device_id {UUID} -- Identifier of the device to be deleted: :rtype: bool -- Success of delete event .. py:function:: dal_update_device(device_id: uuid.UUID, payload: dict) -> app.api.db.Device | None :async: Update an existing device in database. :param id {UUID} -- Identifier of device: :param payload {dict} -- Dict with the fields to update.: :rtype: Device -- Updated database orm model.