-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from CoToYo/db_update
Tiny code structure updates.
- Loading branch information
Showing
5 changed files
with
126 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import services.NewsService as NewsService | ||
from services.NewsService import NewsService | ||
|
||
""" | ||
return news without considering keywords | ||
""" | ||
|
||
class NewsController: | ||
def __init__(self) -> None: | ||
self.news_service = NewsService() | ||
|
||
def getNews(): | ||
return NewsService.getNews() | ||
""" | ||
return news without considering keywords | ||
""" | ||
|
||
def getNews(self): | ||
return self.news_service.getNews() | ||
|
||
""" | ||
return news based on certain keywords | ||
""" | ||
""" | ||
return news based on certain keywords | ||
""" | ||
|
||
def getNewsWithKeywords(self, user_keywords): | ||
return self.news_service.getNewsWithKeywords(user_keywords) | ||
|
||
def getNewsWithKeywords(user_keywords): | ||
return NewsService.getNewsWithKeywords(user_keywords) | ||
""" | ||
deal requests with wrong route | ||
""" | ||
|
||
|
||
""" | ||
deal requests with wrong route | ||
""" | ||
|
||
|
||
def notFound(error): | ||
return NewsService.notFound(error) | ||
def notFound(self, error): | ||
return self.news_service.notFound(error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
from config.Database import client | ||
|
||
db = client.CybernewsDB | ||
|
||
""" | ||
TODO: Read news from database. | ||
""" | ||
|
||
|
||
class CybernewsDB: | ||
def __init__(self): | ||
self.client = client | ||
self.db = self.client["CybernewsDB"] | ||
|
||
def get_collections(self, collection_name): | ||
return self.db.get_collection(collection_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters