File tree 2 files changed +31
-4
lines changed
2 files changed +31
-4
lines changed Original file line number Diff line number Diff line change 7
7
8
8
9
9
class DeviceService :
10
- """A service for registering and managing devices."""
10
+ """
11
+ A service for registering and managing devices.
12
+
13
+ Attributes:
14
+ session (Session): The database session to use. Injected by FastAPI.
15
+
16
+ Methods:
17
+ register_device(device: Device) -> Device: Register a device.
18
+ get_registered_devices() -> list[Device]: Get all registered devices.
19
+ clear_registered_devices() -> None: Clear all registered devices.
20
+ """
11
21
12
22
def __init__ (self , session : Session = Depends (db_session )):
13
23
"""
@@ -44,7 +54,8 @@ def get_registered_devices(self) -> list[Device]:
44
54
return [device .to_model () for device in devices ]
45
55
46
56
def clear_registered_devices (self ) -> None :
47
- """Clear all registered devices.
57
+ """
58
+ Clear all registered devices.
48
59
49
60
This method deletes all registered devices from the database.
50
61
"""
Original file line number Diff line number Diff line change @@ -9,14 +9,30 @@ class PushService:
9
9
10
10
Attributes:
11
11
handler (PushHandler): The handler used to send push notifications. Injected by FastAPI.
12
+
13
+ Methods:
14
+ send_push(message: Message) -> None: Sends a push notification.
12
15
"""
13
16
14
17
def __init__ (self , handler : PushHandler = Depends ()):
15
- """Initialize the Service."""
18
+ """
19
+ Initialize the PushService.
20
+
21
+ Args:
22
+ handler (PushHandler): The push notification handler to use. Injected by FastAPI.
23
+ """
16
24
self .handler = handler
17
25
18
26
def send_push (self , message : Message ) -> None :
19
- """Send a push notification."""
27
+ """
28
+ Send a push notification.
29
+
30
+ Args:
31
+ message (Message): The message to send.
32
+
33
+ Returns:
34
+ None
35
+ """
20
36
self .handler .send_multiple_push (
21
37
to_device_tokens = message .recipients , body = message .body
22
38
)
You can’t perform that action at this time.
0 commit comments