Blog App
Build a blog app with the following features. You can Buy the solution from the Dev Shop.
Functional Requirements
- Create,Read,Update,Delete
- Notification new posts
- Search
- Commenting on Posts
- Reacting to posts
- Liking posts
Sample below:
python
class Post(x):
print("do bank stuff")
Non Functional Requirements
- Reliable
- Available
Schema
POST has many COMMENTS
COMMENT belongs to a POST
USER has many posts
POST belongs to a USER
Post
column | description |
---|---|
id | id of the item |
content | name of the item |
image_url | name of the item |
video_url | name of the item |
youtube_url | name of the item |
audio_url | name of the item |
user_id | user who made the post |
Comment
column | description |
---|---|
id | id of the item |
content | name of the item |
post_id | name of the item |
name | name of the item |
name | name of the item |
User
column | description |
---|---|
id | id of the item |
name of the item | |
password | name of the item |
first_name | name of the item |
last_name | name of the item |
PostLikes
column | description |
---|---|
id | id of the item |
post_id | name of the item |
user_id | name of the item |
PostReactions
column | description |
---|---|
id | id of the item |
name | name of the item |
reaction | enum of name of the item |
Business Rules
Rules about how things should work...
Solution
py
class Bank:
def __init__(self,name="New Bank"):
self.name = name
self.accounts = []
def add_account(self,x):
self.accounts.append(x)
class Account:
def __init__(self,name="New Account",account_holder=None):
self.amount = 0
self.name = name
self.account_holder = account_holder
def withdraw(self,x):
self.amount -= x
def deposit(self,x):
self.amount += x
def __repr__(self):
return str({
"name": self.name,
"amount": self.amount,
"account_holder": self.account_holder
})
chase = Bank("Chase")
print(chase.name)
my_account = Account("Household","Tutorial Doctor")
my_account.deposit(600.00)
my_account.withdraw(100.00)
print(my_account.amount)
chase.add_account(my_account)
print(my_account)
print(chase.accounts)
Things to consider
- What libraries could you use? built-in?
- What design patterns?