This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
3 changed files
with
61 additions
and
2 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,7 +1,9 @@ | ||
from .students import Student | ||
from .telegram import Telegram | ||
from .tokens import Token | ||
|
||
__all__ = ( | ||
"Student", | ||
"Telegram", | ||
"Token", | ||
) |
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,20 @@ | ||
import sqlalchemy as s | ||
import sqlalchemy.orm as o | ||
|
||
from .base import Base | ||
|
||
|
||
class Token(Base): | ||
""" | ||
A table that contains API tokens to check if an user is registered or not in the database. | ||
""" | ||
__tablename__ = "tokens" | ||
|
||
id = s.Column(s.Integer, nullable=False, primary_key=True) | ||
token = s.Column(s.String, nullable=False) | ||
|
||
owner_id = s.Column(s.BigInteger, s.ForeignKey("telegram.id"), nullable=False) | ||
owner = o.relationship("Telegram", backref="tokens") | ||
|
||
def __repr__(self): | ||
return f"{self.__qualname__}({self.id=}, {self.token=}, {self.owner_id=})" |
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