refacto: rename app into backend, to prepare for frontend dev
This commit is contained in:
parent
017092040d
commit
e605bf8603
32 changed files with 2 additions and 2 deletions
0
server/backend/domain/__init__.py
Normal file
0
server/backend/domain/__init__.py
Normal file
4
server/backend/domain/entities/__init__.py
Normal file
4
server/backend/domain/entities/__init__.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
from .uplink_event import UplinkEvent
|
||||
from .consumption_point import ConsumptionPoint, ConsumptionResponse
|
||||
|
||||
__all__ = ["UplinkEvent", "ConsumptionPoint", "ConsumptionResponse"]
|
||||
19
server/backend/domain/entities/consumption_point.py
Normal file
19
server/backend/domain/entities/consumption_point.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from domain.value_objects import Granularity
|
||||
|
||||
@dataclass
|
||||
class ConsumptionPoint:
|
||||
period: datetime
|
||||
pulse_count_start: int
|
||||
pulse_count_end: int
|
||||
delta_pulses: int
|
||||
delta_m3: float
|
||||
|
||||
@dataclass
|
||||
class ConsumptionResponse:
|
||||
dev_eui: str
|
||||
start: datetime
|
||||
end: datetime
|
||||
granularity: Granularity
|
||||
points: list[ConsumptionPoint]
|
||||
6
server/backend/domain/entities/uplink_event.py
Normal file
6
server/backend/domain/entities/uplink_event.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class UplinkEvent:
|
||||
dev_eui: str
|
||||
pulse_count: int
|
||||
17
server/backend/domain/exceptions.py
Normal file
17
server/backend/domain/exceptions.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class DomainError(Exception):
|
||||
"""Base pour toutes les erreurs de domaine"""
|
||||
|
||||
class InfrastructureError(Exception):
|
||||
"""Erreur technique levée par un adapter"""
|
||||
|
||||
class DatabaseConnectionError(InfrastructureError):
|
||||
"""Impossible de se connecter à la db"""
|
||||
|
||||
class DatabaseError(InfrastructureError):
|
||||
"""Erreur lors d'une opération en base de données."""
|
||||
|
||||
class MessageBrokerError(InfrastructureError):
|
||||
"""Impossible de se connecter au broker MQTT"""
|
||||
|
||||
class ValidationError(DomainError):
|
||||
"""Données d'entrée invalides"""
|
||||
3
server/backend/domain/value_objects.py
Normal file
3
server/backend/domain/value_objects.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from typing import Literal
|
||||
|
||||
Granularity = Literal["hour", "day", "month"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue