-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76fb6f6
commit 0799e7e
Showing
3 changed files
with
37 additions
and
1 deletion.
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
19 changes: 19 additions & 0 deletions
19
redditrepostsleuth/core/db/repository/user_whitelist_repo.py
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from typing import Optional | ||
|
||
from redditrepostsleuth.core.db.databasemodels import UserWhitelist | ||
|
||
|
||
class UserWhitelistRepo: | ||
|
||
def __init__(self, db_session): | ||
self.db_session = db_session | ||
|
||
def add(self, item): | ||
self.db_session.add(item) | ||
|
||
def get_by_username_and_subreddit(self, username: str, monitored_sub_id: int) -> Optional[UserWhitelist]: | ||
return self.db_session.query(UserWhitelist).filter(UserWhitelist.username == username, UserWhitelist.monitored_sub_id == monitored_sub_id).first() | ||
|
||
|
||
def get_by_username(self, username: str) -> Optional[UserWhitelist]: | ||
return self.db_session.query(UserWhitelist).filter(UserWhitelist.username == username).first() |
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