refresh tokens 0.1.2
This commit is contained in:
@@ -31,6 +31,7 @@ class User(Model):
|
||||
|
||||
refresh_token:Mapped[list['RefreshTokens']]=relationship(back_populates="user")
|
||||
report:Mapped[list["Stored"]]=relationship(back_populates="user")
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"ID: {self.id}, Name: {self.first_name}, Status: {self.status}"
|
||||
|
||||
@@ -84,7 +85,7 @@ class RefreshTokens(Model):
|
||||
|
||||
__tablename__= "refresh_tokens"
|
||||
|
||||
id:Mapped[int]=mapped_column(primary_key=True, index=True)
|
||||
id:Mapped[UUID]=mapped_column(Uuid(as_uuid=True),primary_key=True, index=True)
|
||||
user_id:Mapped[UUID]=mapped_column(ForeignKey("users.id", ondelete="CASCADE"), index=True)
|
||||
token_hash:Mapped[str]=mapped_column(String(255), unique=True)
|
||||
device_info:Mapped[str]=mapped_column(String(255))
|
||||
@@ -93,7 +94,7 @@ class RefreshTokens(Model):
|
||||
|
||||
expires_at:Mapped[datetime]=mapped_column(TIMESTAMP)
|
||||
created_at:Mapped[datetime]=mapped_column(TIMESTAMP, server_default=func.now())
|
||||
replaced_by:Mapped[int|None]=mapped_column(ForeignKey("refresh_tokens.id"), nullable=True, default=None)
|
||||
replaced_by:Mapped[UUID|None]=mapped_column(ForeignKey("refresh_tokens.id"), nullable=True, default=None)
|
||||
|
||||
|
||||
user:Mapped["User"]=relationship(back_populates="refresh_token")
|
||||
|
||||
Reference in New Issue
Block a user