-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.py
61 lines (44 loc) · 1.28 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""
Database architecture.
User ID -> Language -> Location -> Phone Number -> Notification Time
"""
from abc import ABC, abstractmethod
from dataclasses import dataclass
from database import DatabaseBase
@dataclass
class User:
user_id: int
language: str = None
location: str = None
phone_number: str = None
notification_time: str = None
class UserRepositoryBase(ABC):
@abstractmethod
def create_user(self, user: User):
raise NotImplementedError
@abstractmethod
def get_user(self, user: User):
raise NotImplementedError
@abstractmethod
def update_user(self, user: User):
raise NotImplementedError
@abstractmethod
def delete_user(self, user: User):
raise NotImplementedError
@abstractmethod
def get_all_users(self, user: User):
raise NotImplementedError
class UserRepositoryJSONHandler(UserRepositoryBase):
def __init__(self, database: DatabaseBase):
self.database = database
def create_user(self, user: User):
existing_data = self.database.read()
pass
def get_user(self, user: User):
pass
def update_user(self, user: User):
pass
def delete_user(self, user: User):
pass
def get_all_users(self, user: User):
pass