device-manager.app.api.dal ========================== .. py:module:: device-manager.app.api.dal .. autoapi-nested-parse:: Device data access layer. Functions --------- .. autoapisummary:: device-manager.app.api.dal.dal_create_device device-manager.app.api.dal.dal_get_device device-manager.app.api.dal.dal_get_all_devices device-manager.app.api.dal.dal_delete_device device-manager.app.api.dal.dal_update_device Module Contents --------------- .. py:function:: dal_create_device(request: scanhub_libraries.models.DeviceCreationRequest, token_hash: str, salt: str) -> api.db.Device :async: Add a new device to the database. Arguments --------- payload {BaseDevice} -- Pydantic base model to create a new database entry .. py:function:: dal_get_device(device_id: uuid.UUID) -> api.db.Device | None :async: Fetch a device from database. Arguments --------- device_id {UUID} -- Identifier of the device Returns ------- Device -- Database orm model .. py:function:: dal_get_all_devices() -> list[api.db.Device] :async: Get a list of all existing devices. Returns ------- List[Device] -- List of database orm models .. py:function:: dal_delete_device(device_id: uuid.UUID) -> bool :async: Delete a device by identifier. Parameters ---------- device_id {UUID} -- Identifier of the device to be deleted Returns ------- bool -- Success of delete event .. py:function:: dal_update_device(device_id: uuid.UUID, payload: dict) -> api.db.Device | None :async: Update an existing device in database. Parameters ---------- id {UUID} -- Identifier of device payload {dict} -- Dict with the fields to update. Returns ------- Device -- Updated database orm model.