Skip to content

Commit bedd0a2

Browse files
committed
Refactoring
1 parent a4bd08b commit bedd0a2

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

database.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import sqlalchemy
44
from sqlalchemy.orm import Session
5-
from settings import getenv
5+
from utils import getenv
66

77

88
def _engine_str(name: str = getenv("DB_NAME")) -> str:

push/config.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,57 @@
11
from .apn_handler import TokenCredentials
2-
from settings import getenv
2+
from utils import getenv
33

44

55
class PushConfig:
6+
"""
7+
A class representing the configuration for push notifications.
8+
"""
69
AUTH_KEY_PATH: str | None = None
710
AUTH_KEY_ID: str | None = None
811
TEAM_ID: str | None = None
912
APNS_APP_BUNDLE_ID: str | None = None
1013

1114
@classmethod
1215
def get_auth_key_path(cls) -> str:
16+
"""
17+
Returns the path to the authentication key for APNS.
18+
"""
1319
if not cls.AUTH_KEY_PATH:
1420
cls.AUTH_KEY_PATH = getenv("APNS_AUTH_KEY_PATH")
1521
return cls.AUTH_KEY_PATH
1622

1723
@classmethod
1824
def get_auth_key_id(cls) -> str:
25+
"""
26+
Returns the ID of the authentication key for APNS.
27+
"""
1928
if not cls.AUTH_KEY_ID:
2029
cls.AUTH_KEY_ID = getenv("APNS_KEY_ID")
2130
return cls.AUTH_KEY_ID
2231

2332
@classmethod
2433
def get_team_id(cls) -> str:
34+
"""
35+
Returns the team ID for APNS.
36+
"""
2537
if not cls.TEAM_ID:
2638
cls.TEAM_ID = getenv("APNS_TEAM_ID")
2739
return cls.TEAM_ID
2840

2941
@classmethod
3042
def get_apns_app_bundle_id(cls) -> str:
43+
"""
44+
Returns the bundle ID for the APNS app.
45+
"""
3146
if not cls.APNS_APP_BUNDLE_ID:
3247
cls.APNS_APP_BUNDLE_ID = getenv("APNS_APP_BUNDLE_ID")
3348
return cls.APNS_APP_BUNDLE_ID
3449

3550
@classmethod
3651
def get_token_credentials(cls) -> TokenCredentials:
52+
"""
53+
Returns the token credentials for APNS.
54+
"""
3755
return TokenCredentials(
3856
auth_key_path=cls.get_auth_key_path(),
3957
auth_key_id=cls.get_auth_key_id(),
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)