GramCore/services/devices/services.py
2023-08-05 10:41:12 +08:00

26 lines
824 B
Python

from typing import Optional
from gram_core.base_service import BaseService
from gram_core.services.devices.repositories import DevicesRepository
from gram_core.services.devices.models import DevicesDataBase as Devices
class DevicesService(BaseService):
def __init__(self, devices_repository: DevicesRepository) -> None:
self._repository: DevicesRepository = devices_repository
async def update(self, devices: Devices):
await self._repository.update(devices)
async def add(self, devices: Devices):
await self._repository.add(devices)
async def get(
self,
account_id: int,
) -> Optional[Devices]:
return await self._repository.get(account_id)
async def delete(self, devices: Devices) -> None:
return await self._repository.delete(devices)