device_manager.api.dal#
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#
|
Add a new device to the database. |
|
Fetch a device from database. |
|
Get a list of all existing devices. |
|
Delete a device by identifier. |
|
Update an existing device in database. |
Module Contents#
- async device_manager.api.dal.dal_create_device(request: scanhub_libraries.models.DeviceCreationRequest, token_hash: str, salt: str) app.api.db.Device#
Add a new device to the database.
- Parameters:
entry (payload {BaseDevice} -- Pydantic base model to create a new database)
- async device_manager.api.dal.dal_get_device(device_id: uuid.UUID) app.api.db.Device | None#
Fetch a device from database.
- Parameters:
device (device_id {UUID} -- Identifier of the)
- Return type:
Device – Database orm model
- async device_manager.api.dal.dal_get_all_devices() list[app.api.db.Device]#
Get a list of all existing devices.
- Return type:
List[Device] – List of database orm models
- async device_manager.api.dal.dal_delete_device(device_id: uuid.UUID) bool#
Delete a device by identifier.
- Parameters:
deleted (device_id {UUID} -- Identifier of the device to be)
- Return type:
bool – Success of delete event
- async device_manager.api.dal.dal_update_device(device_id: uuid.UUID, payload: dict) app.api.db.Device | None#
Update an existing device in database.
- Parameters:
device (id {UUID} -- Identifier of)
update. (payload {dict} -- Dict with the fields to)
- Return type:
Device – Updated database orm model.