Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/crud/verification_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@


class VerificationTokenRepository:
"""Repository class for managing verification tokens in the database."""

def get_token(self, db: Session, token: str) -> VerificationToken | None:
"""
Args:
:param db:
:param token:
:return:
"""
Comment on lines +14 to +19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Complete the docstring with actual descriptions.

The docstring mixes incompatible formatting styles (Google's "Args:" with Sphinx's :param) and contains only empty placeholders without any actual documentation text.

📝 Proposed fix using Google style
-    def get_token(self, db: Session, token: str) -> VerificationToken | None:
-        """
-        Args:
-        :param db:
-        :param token:
-        :return:
-        """
+    def get_token(self, db: Session, token: str) -> VerificationToken | None:
+        """Retrieves a verification token by its token string.
+
+        Args:
+            db: Database session for executing the query.
+            token: Token string to look up.
+
+        Returns:
+            VerificationToken if found, None otherwise.
+        """
📝 Alternative fix using Sphinx/reStructuredText style
-    def get_token(self, db: Session, token: str) -> VerificationToken | None:
-        """
-        Args:
-        :param db:
-        :param token:
-        :return:
-        """
+    def get_token(self, db: Session, token: str) -> VerificationToken | None:
+        """Retrieves a verification token by its token string.
+
+        :param db: Database session for executing the query.
+        :param token: Token string to look up.
+        :return: VerificationToken if found, None otherwise.
+        """
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"""
Args:
:param db:
:param token:
:return:
"""
def get_token(self, db: Session, token: str) -> VerificationToken | None:
"""Retrieves a verification token by its token string.
Args:
db: Database session for executing the query.
token: Token string to look up.
Returns:
VerificationToken if found, None otherwise.
"""
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/crud/verification_token.py` around lines 14 - 19, The docstring in
app/crud/verification_token.py uses mixed/empty styles — replace the current
placeholder block with a single, consistent docstring (choose either Google or
Sphinx style) that documents the parameters and return: describe the db
parameter (type and role), the token parameter (what it represents and expected
type/format), and the return value (what is returned and its type). Update the
docstring surrounding the function/method that currently contains "Args:/ :param
db: / :param token: / :return:" so it uses one style consistently and provides
concrete descriptions for db, token, and the function's return.

statement = select(VerificationToken).where(VerificationToken.token == token)
return db.execute(statement).scalar_one_or_none()

Expand Down
10 changes: 10 additions & 0 deletions app/models/verification_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ def default_expiry() -> datetime:


class VerificationToken(Base):
"""Model representing a verification token for email verification or password reset.

Attributes:
id (int): Primary key identifier for the token.
user_id (int): Foreign key referencing the associated user.
token (str): Unique token string used for verification.
expires_at (datetime): Timestamp indicating when the token expires.
created_at (datetime): Timestamp indicating when the token was created.
"""

__tablename__ = "verification_tokens"

id: Mapped[int] = mapped_column(primary_key=True, index=True)
Expand Down
Loading